Repository navigation
[SM120] dspark: widen SWA index width to an instantiated sparse-MLA shape - #34717
AliceChenyy wants to merge 2 commits into
Conversation
…hape
DSPARK does not start on consumer Blackwell (SM120). CUDA graph capture aborts:
Check failed: (ok) is false: Unsupported sparse-MLA prefill configuration:
model=DSV4 num_heads=16 topk=192 page_block_size=64
`build_dspark_swa_page_indices` derives its index width from
`swa_window + block_size`, which lands on 192 for the DSPARK shape (128
sliding-window entries + the draft block). FlashInfer's SM120 sparse-MLA prefill
matrix instantiates topk in {128, 512, 1024, 2048}, so the host gate rejects 192
-- and it rejects it by aborting the process, not by falling back. `num_heads=16`
itself is supported.
Widen an uninstantiated width to the next instantiated one. The padded tail is
-1 and the kernel already masks per row through `topk_length`, so the extra
columns are inert. 128 stays in the set deliberately: it is the only width the
DSv4 dual (SWA extra-cache) dispatch instantiates, and widening it breaks MTP.
The exact-192 shape is the better long-term answer and now exists upstream --
flashinfer-ai/flashinfer#4380 added topk 192/256 for DSV4 decode and single-cache
prefill. It ships only in nightly 0.6.18; the latest stable (v0.6.17) still
dispatches {128, 512, 1024, 2048}, and sglang pins flashinfer_python==0.6.15.post1.
This change is what works on the pinned dependency. It costs nothing measurable:
against a nightly-0.6.18 build using the exact 192 width, end-to-end serving is
identical within run-to-run noise.
Measured on 4x RTX 6000D (SM120), TP4, deepseek-ai/DeepSeek-V4-Flash-0731,
--moe-runner-backend flashinfer_mxfp4 --speculative-algorithm DSPARK:
width bs throughput TPOT ITL
192 1 91.00 tok/s 10.87ms 9.82ms
512 1 92.13 tok/s 10.73ms 9.82ms
192 8 313.41 18.00 10.62
512 8 311.69 17.09 10.63
192 32 520.8/522.2 37.7/39.0 21.4/22.4
512 32 524.5/522.7 38.4/38.4 21.2/21.9
AIME25 (sgl-eval, n-repeats 16, 480 samples): pass@1 98.33%, 0 truncated.
Reference on 4x B200 (SM100), same command: 98.96%.
Without this change the server does not reach ready state at all.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Keep the two things that cannot be derived from the code -- FlashInfer aborts on an uninstantiated width rather than falling back, and 128 must stay in the set or MTP breaks. The measurement table lives in the PR description, and the note about lazy arch detection described module-level code that no longer exists. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
| def _sm120_index_width(width: int) -> int: | ||
| if width in _SM120_INDEX_WIDTHS or not is_sm120_supported(): |
There was a problem hiding this comment.
Please use get_platform().is_sm120 instead of is_sm120_supported
| _SM120_INDEX_WIDTHS = (128, 512, 1024, 2048) | ||
|
|
||
|
|
||
| def _sm120_index_width(width: int) -> int: |
There was a problem hiding this comment.
Move this function to python/sglang/kernels/ops/attention/flash_mla_sm120.py
| block_swa_locs = full_to_swa_mapping[block_full_locs].to(torch.int32) | ||
|
|
||
| target_width = ceil_align(swa_window + block_size, page_index_aligned_size) | ||
| target_width = _sm120_index_width( |
There was a problem hiding this comment.
Change to this form:
target_width = ceil_align(swa_window + block_size, page_index_aligned_size) if not get_platform().is_sm120 else ceil_align_sm120(swa_window + block_size, page_index_aligned_size)
…indexer) + stack_want decisions - stack.txt: entries 1-2 (local) + Group A boot-critical indexer chain sgl-project#42371/sgl-project#42861/sgl-project#45261/sgl-project#42294/sgl-project#43008 (fe7be85..0dbd8c5). - stack_want.txt: consolidated decision set from 8 parallel evaluators + dsv41(422)/SM120(254) sweeps + sybil/qwen harvests. Records E verdict (merge only sgl-project#43376) and D verdict (merge only sgl-project#42368; sgl-project#33407/sgl-project#34717 dead on flashinfer 0.7.2).
|
Closing: main now pins FlashInfer 0.7.4, whose SM120 sparse-MLA prefill accepts any topk that is a multiple of 64 with heads in {8,16,32,64} ( |
Purpose
DSPARK does not start on consumer Blackwell (SM120). CUDA graph capture aborts:
build_dspark_swa_page_indicesderives its index width fromswa_window + block_size,which lands on 192 for the DSPARK shape (128 sliding-window entries + the draft
block). FlashInfer's SM120 sparse-MLA prefill matrix instantiates
topkin{128, 512, 1024, 2048}, so the host gate rejects 192 — and it rejects it by abortingthe process, not by falling back.
num_heads=16itself is supported.What this does
Widen an uninstantiated index width to the next instantiated one. The padded tail is
-1and the kernel already masks per row throughtopk_length, so the extra columnsare inert.
128stays in the set deliberately: it is the only width the DSv4 dual (SWAextra-cache) dispatch instantiates, and widening it breaks the MTP path.
Relationship to flashinfer-ai/flashinfer#4380
The exact-192 shape is the better long-term answer and now exists upstream — #4380
added
topk192/256 for DSV4 decode and single-cache prefill, and vLLM builds on it invllm-project/vllm#51538 by carrying the true dense width (aligned to the kernel's
64-entry tile) instead of rounding.
That path is not available here yet:
sglang pins
flashinfer_python==0.6.15.post1, so this change is what works on thepinned dependency. When the pin moves to a release carrying #4380, switching to the
exact width is a one-line follow-up.
I prototyped that follow-up (probe
_DECODE_DSV4_DISPATCHat runtime, use 192 whenpresent, fall back otherwise) and measured it — see below. It made no measurable
difference, so it is not included here rather than carrying the extra complexity and
its two fragile assumptions (intersecting across head counts, and using the decode
table as a proxy because FlashInfer exposes no prefill capability query).
Measurements
4x RTX 6000D (SM120), TP4,
deepseek-ai/DeepSeek-V4-Flash-0731,--moe-runner-backend flashinfer_mxfp4 --speculative-algorithm DSPARK,--mem-fraction-static 0.80. ISL 8192 / OSL 1024.Rounded 512 (this PR) vs exact 192 (nightly-0.6.18 build), same tree, same FlashInfer:
Identical within run-to-run noise at every batch size (bs=32 was repeated twice per
arm; the within-arm spread is as large as the between-arm difference).
Accuracy,
sgl-eval run aime25 --n-repeats 16 --max-tokens 200000(480 samples):The SM120 row is re-measured on the exact commit in this PR. An earlier run of the same
eval on the pre-cleanup variant of this patch (module-level arch detection instead of the
lazy call) gave 98.33% / stdev 3.65%, i.e. the same result within noise.
Without this change the SM120 server never reaches ready state, so there is no
same-arch baseline to compare against.
Regression check
No effect off SM120:
_sm120_index_widthreturns its argument unchanged whenis_sm120_supported()is false, and arch detection is called inside the function so itdoes not pull CUDA into module import.
On SM120 with
DeepSeek-V4-Flash(fp8), FlashInfer 0.6.18, GSM8K 50q:Both match their pre-existing baselines.
CI States
Latest PR Test (Base): ❌ Run #31684742437
Latest PR Test (Extra): ❌ Run #31684742223