Repository navigation
Conversation
mmangkad
requested review from
Fridge003,
HaiShaw,
Qiaolin-Yu,
hebiao064,
ispobock and
merrymercy
as code owners
October 15, 2026 01:09
4 of 5 tasks
This branch has not been deployed
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.
Motivation
GLM-5.3-Flash MTP 5/1/6 decode spends about 5% of each step with the GPU outside CUDA graphs. The largest gap is between the draft-extend and draft graphs, where
DeepseekSparseAttnMultiStepBackendfills each of the 4 draft-step backends separately, though every step ends up holding identical metadata.Modifications
page_tableand seqlen buffers.DeepseekSparseAttnBackendgets two protected helpers:_init_cuda_graph_state_sharedsizes only the multi-CTA KV counter, which_forward_trtllmreads per backend, and_share_cuda_graph_metadataaliases step 0's metadata.test_dsa_metadata_replay.pycaptures and replays the steps through the wrapper forindex_kpool4 (KPool fusion on and off) and 1, and checks that steps share step 0's buffers, only step 0 refreshes, and the result matches the ordinary path.Sharing is safe because every step consumes the same precomputed input and the draft forward only reads the metadata. All writes to
DSAMetadata/KPoolWritePlanare in the init and replay paths; the one forward-time writer (dsa_npu_indexer.py) is prefill-only.Only GLM-5.3-Flash sets
index_kpool(4); DeepSeek-V3.2 and GLM-5 through 5.3 use 1. With more than 3 draft steps, those models used the multi-destination copy block, which never refreshedpaged_mqa_schedule_metadata/topk_v2_planfor the first three steps; they now get the full refresh.Some cleanups this change enables can be done as a follow-up.
Accuracy Tests
sgl-eval 0.1.2 GSM8K, 200 examples, temperature 1.0, top_p 0.95, thinking on.
test_dsa_metadata_replay.py: 3 passed (6 subtests) on GB300.Speed Tests and Profiling
GLM-5.3-Flash, 4× GB300,
--tp-size 4, trtllm DSA, fp8_e4m3 KV,flashinfer_trtllmMoE, EAGLE 5/1/6, greedy, 2,048 output tokens. Accept length pinned withSGLANG_SIMULATE_ACC_LEN=5 SGLANG_SIMULATE_ACC_TOKEN_MODE=real-draft-token(5.00 on every run).fwd_occupancy, concurrency 1 / 8 / 32nsys, batch size 1, medians over ~165–185 steps:
fused_metadata_copy_kernelper stepThe draft → verify gap also shrinks because the verify graph launch waits on host work: with less of it during draft replay, the launch lands sooner.
The draft-extend → draft gap of the median step (by that gap), same 400 µs scale, starting 40 µs before the draft-extend graph ends:
Before: the copy ladder, including 4
fused_metadata_copy_kernel, runs until the draft graph starts at ~326 µs.After: only step 0's refresh remains; the draft graph starts at ~215 µs.
CI States
Latest PR Test (Base): ❌ Run #38664087872
Latest PR Test (Extra): ❌ Run #38664087888
Latest PR Test (AMD ROCm 10): ❌ Run #38664087886