Repository navigation
[Fix] dsa: Fix ragged seed indices before MTP draft decode - #42565
Conversation
3d35505 to
d1be205
Compare
|
@Fridge003 @ispobock could you take a look when you have time? We hit this in production with this PR applied as a hotfix, and it does not fully fix the issue. Setup: GLM-5.3-W4AFP8, TP8 / DP4 dp-attention, EAGLE 3/1/4, fp8 KV, The gap: this PR converts seeds only on the MHA path ( (Code paths read from our deployed image, sglang-runtime 1.5.0. We have not reproduced it on main yet.)
Update (2026-10-09):
Minor review notes:
|
BBuf
left a comment
There was a problem hiding this comment.
Both the MHA export and IndexTopKShareState.publish now use the seed conversion, and the CPU mapping tests cover the intended representation change. Could we add one GPU regression that exercises the real prefill-to-first-draft-decode transition with SGLANG_DSA_FUSE_TOPK=1 and a shared cached prefix, where ragged logical offsets differ from physical KV slots? Please cover both the MHA and sparse-MLA seed export paths and compare attention outputs or logprobs with a reference. The current tests mock backend selection and the index producer, so they do not yet validate that producer/consumer handoff.
|
/rerun-test test/registered/unit/layers/attention/test_index_topk_share.py Targeted validation for 6ad90aae3303. This CPU coverage does not replace the GPU seed-to-draft integration regression requested in review. |
|
🚀 |
c5e290f to
7190ed1
Compare
@BBuf thanks for reviewing, i just added a GPU regression test, which covers the handoff from draft prefill to the first draft decode end to end on real kernels. With |
|
Can we clean up the test files? The test files change is too large. |
7190ed1 to
bf4f910
Compare
Draft prefill longer than index_topk runs sparse MLA and exports its seed through IndexTopKShareState.publish(), which copied fused RAGGED (batch-global logical) top-k indices unchanged. Draft decode reads them as physical KV slots, so long shared prefixes overran the KV pool and caused illegal memory accesses. Route both MHA and sparse-MLA seed exports through write_mtp_seed(), which applies the backend's prepare_mtp_seed_indices conversion. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Replace the standalone GPU test with a kit helper built on DSAMockModelRunner and build_dsa_sparse_attention_fixture, with two cases in test_dsa.py covering the dense-MHA and sparse-MLA export paths. Co-Authored-By: Claude Fable 5.1 <[email protected]>
bf4f910 to
017956a
Compare
@BBuf agreed it was too much, i dropped the standalone GPU test file and moved the check into the existing DSA attention fixture instead |
…ct#42565) Co-authored-by: Claude Opus 5.5 <[email protected]> (cherry picked from commit 7c99ace) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VDwTQn4gGFgVhzGXFs4aJx
Motivation
Fused DSA prefill can produce top-k indices into the batch’s flattened logical KV space. The draft model captures these indices as MTP seeds and reuses them in the next draft decode, which expects physical KV slots.
This mismatch can select incorrect KV entries or cause out-of-bounds reads, particularly when long requests share cached prefixes and logical offsets exceed physical cache capacity.
The engine config that exercises this error:
Modifications
prepare_mtp_seed_indices()to map fused RAGGED seeds through the producer’s page table before capture.Accuracy Tests
CPU: tests added in
test/registered/unit/layers/attention/test_index_topk_share.pySpeed Tests and Profiling
The conversion applies only to fused RAGGED seed export at the draft-prefill (EXTEND) → next draft-decode (DECODE) boundary. Post-verification draft extend (DRAFT_EXTEND_V2) already exports PAGED seeds and requires no conversion.
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): 🚫 Run #38691837325
Latest PR Test (Extra): ❌ Run #38691837344
Latest PR Test (AMD ROCm 10): ❌ Run #38691837469