Repository navigation
[Fix] [NVIDIA] deepseek_v4: Build the DeepGEMM schedule for the low-ratio prefill-graph indexer on SM12x - #45381
Closed
mathieu-rossini wants to merge 1 commit into
Conversation
…atio prefill-graph indexer on SM12x On SM120 the model hook forces SGLANG_FP8_PAGED_MQA_LOGITS_TORCH, so PagedIndexerMetadata drops deep_gemm_metadata unless force_deep_gemm_metadata is set. _low_ratio_prefill_indexer_metadata never sets it, and the captured ratio-1/2 indexer always scores with deep_gemm_fp4_paged_mqa_logits, so the breakable prefill CUDA graph capture fails on the first DeepSeek-V4.1 layer with a ratio-1/2 source (DeepGEMM assertion t.is_cuda()). Force the schedule there on SM120, as the decode path does.
mathieu-rossini
requested review from
Fridge003,
HaiShaw,
Qiaolin-Yu,
hebiao064,
ispobock and
merrymercy
as code owners
October 20, 2026 11:46
4 of 5 tasks
3 of 5 tasks
Contributor
Author
|
Closing: this is no longer needed on |
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
On SM120,
--cuda-graph-backend-prefill breakablecannot start DeepSeek-V4.1, the 1017 variant included: the prefill CUDA graph capture fails in the ratio-1/2 indexer. BothDeepSeek-V4.1-FlashandDeepSeek-V4.1-Flash-1017declare the same 20 ratio-1 and 18 ratio-2 layers; reproduced with the 1017.The model hook forces
SGLANG_FP8_PAGED_MQA_LOGITS_TORCHon SM120, soPagedIndexerMetadata.__post_init__setsdeep_gemm_metadata = Noneunlessforce_deep_gemm_metadatais set._low_ratio_prefill_indexer_metadata, which builds the c1/c2 indexer metadata for the prefill graph, never sets it. The captured low-ratio indexer has no Torch path:_deep_gemm_prefill_capturedalways callsdeep_gemm_fp4_paged_mqa_logitswith the plan fromrow_chunks(), which is thenNone:This complements #45261, which fixes the same missing schedule on the decode path (
init_forward_metadata_indexer); without that one, V4.1 does not start on SM120 at all. The two PRs touch different functions and do not conflict.Modifications
_low_ratio_prefill_indexer_metadatapassesforce_deep_gemm_metadata=get_platform().is_sm120, the condition #45261 applies to the low-ratio decode metadata. On SM120 the prefill-graph indexer then gets its DeepGEMM schedule (per row chunk whenrow_chunk > 0). Other platforms are unchanged: there the flag staysFalseas before.Accuracy Tests
One of our GPU servers, 4x RTX PRO 6000 Blackwell (SM120), TP4 / EP4, DeepSeek-V4.1-Flash-1017 with DSpark,
--enable-encoder-swa-bounded-replay, FP8 KV cache,--chunked-prefill-size 2048, context 1M. Tree:main@ed0b8f43, FlashInfer 0.7.2, with three other open SM120 fixes that V4.1 needs here: #42371 (without itmake_candidate_indexerrefuses SM120 at backend start, issue #42364), a local equivalent of #45261 (the decode-path fix above) and a local equivalent of #42714. We hit the last one ourselves: without it, 64 running requests × 1M context (also 32 × 1M and 64 × 800K) failed at the first decode with an illegal memory access that a CUDA coredump placed in_page_split_kernel; with it, that configuration ran.--cuda-graph-backend-prefill breakable: the capture fails as above, on every rank.cuda graph: True.few_shot_gsm8k, parallel 64)The two runs without the graph show the run-to-run spread; the result with the graph falls inside it. The ~14K-token prompts fit under the graph's 16 384-token replay limit, so they prefill through the captured graph, where the ratio-1/2 indexers must pick the planted block.
Speed Tests and Profiling
No speed change is intended; this is a crash fix. For reference, on this machine the breakable prefill graph was slower than eager prefill above ~500 prompt tokens (median TTFT, prefix cache defeated, one request at a time):
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciDeveloped with AI assistance.
CI States
Latest PR Test (Base): ❌ Run #39417319004
Latest PR Test (Extra): ❌ Run #39417319065
Latest PR Test (AMD ROCm 10): ❌ Run #39417319003
Tip
Base CI only covers the core cases, and its workload may not exercise your change. Use
/rerun-testto run the tests your change touches, or copy this prompt for an agent: