Put the DSA cuda-graph page table in the pausable memory region - #33479
Merged
Merged
Conversation
The wide page_table (max_num_tokens x max_ctx_len int32) is the dominant static cuda-graph buffer under speculative decoding, and it stayed resident while the engine was paused because it was allocated outside the memory saver's cuda-graph region. It and the flashmla metadata are rewritten in full by the replay metadata path before every replay, so nothing needs to survive a pause. Allocate both inside the region. cache_seqlens, cu_seqlens_q/k and real_page_table are written once at init and would come back zeroed after a resume, so they stay outside. Only takes effect with --enable-memory-saver and SGLANG_MEMORY_SAVER_CUDA_GRAPH=1; otherwise the region is a nullcontext and allocation is unchanged.
yueming-yuan
requested review from
Fridge003,
HaiShaw,
Qiaolin-Yu,
hebiao064,
ispobock and
merrymercy
as code owners
August 4, 2026 04:26
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
yueming-yuan
added a commit
that referenced
this pull request
Aug 25, 2026
Kh4L
pushed a commit
to Kh4L/sglang
that referenced
this pull request
Sep 8, 2026
…on (sgl-project#33479) (cherry picked from commit 5d8e317)
46 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Under RL training the engine is paused between rollouts to hand its GPU memory to the trainer. The DSA backend's wide
page_table—max_num_tokens x max_ctx_lenint32, the dominant static cuda-graph buffer once speculative decoding widensmax_num_tokens— stayed resident across the pause becauseinit_cuda_graph_stateallocated it outside the memory saver's cuda-graph region.page_tableandflashmla_metadataare rewritten in full by the replay metadata path before every replay, so neither needs to survive a pause; both move inside the region.cache_seqlens,cu_seqlens_q,cu_seqlens_kandreal_page_tableare written once at init and would silently come back zeroed after a resume, so they stay outside.The region comes from
TorchMemorySaverAdapterwith theGPU_MEMORY_TYPE_CUDA_GRAPHtag, matching how the graph runners tag their pools. Without--enable-memory-saverandSGLANG_MEMORY_SAVER_CUDA_GRAPH=1the helper returns anullcontext, so allocation is byte-for-byte unchanged on the default path.Measured on GLM-5.2 744B (DSA + EAGLE) on GB300.
🤖 Generated with Claude Code
CI States
Latest PR Test (Base): ❌ Run #30877692286
Latest PR Test (Extra): ❌ Run #30877692198