Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
6535fda1
Unverified
Commit
6535fda1
authored
Sep 29, 2025
by
Cheng Wan
Committed by
GitHub
Sep 29, 2025
Browse files
[Profile] dump memory trace when cuda graph profile is enabled (#11083)
parent
3713eb61
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
python/sglang/srt/model_executor/cuda_graph_runner.py
python/sglang/srt/model_executor/cuda_graph_runner.py
+4
-0
No files found.
python/sglang/srt/model_executor/cuda_graph_runner.py
View file @
6535fda1
...
...
@@ -437,6 +437,7 @@ class CudaGraphRunner:
activities
=
[
ProfilerActivity
.
CPU
,
ProfilerActivity
.
CUDA
],
record_shapes
=
True
,
)
torch
.
cuda
.
memory
.
_record_memory_history
()
# Trigger CUDA graph capture for specific shapes.
# Capture the large shapes first so that the smaller shapes
...
...
@@ -485,6 +486,8 @@ class CudaGraphRunner:
save_gemlite_cache
()
if
self
.
enable_profile_cuda_graph
:
torch
.
cuda
.
memory
.
_dump_snapshot
(
f
"cuda_graph_runner_memory_usage.pickle"
)
torch
.
cuda
.
memory
.
_record_memory_history
(
enabled
=
None
)
log_message
=
(
"Sorted by CUDA Time:
\n
"
+
prof
.
key_averages
(
group_by_input_shape
=
True
).
table
(
...
...
@@ -494,6 +497,7 @@ class CudaGraphRunner:
+
prof
.
key_averages
(
group_by_input_shape
=
True
).
table
(
sort_by
=
"cpu_time_total"
,
row_limit
=
10
)
+
"
\n\n
Memory Usage is saved to cuda_graph_runner_memory_usage.pickle
\n
"
)
logger
.
info
(
log_message
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment