Repository navigation
[Fix] dsv4: Make compact-verify replays find their own tier's metadata under forced uniform capture - #42713
Open
ormandj wants to merge 2 commits into
Open
[Fix] dsv4: Make compact-verify replays find their own tier's metadata under forced uniform capture#42713ormandj wants to merge 2 commits into
ormandj wants to merge 2 commits into
Conversation
ormandj
requested review from
Qiaolin-Yu,
Ying1123,
hnyls2002 and
merrymercy
as code owners
October 6, 2026 04:54
ormandj
force-pushed
the
forced-uniform-capture-token-key
branch
from
October 7, 2026 05:42
6b44301 to
add0627
Compare
17 of 56 tasks
detain
added a commit
to detain/sglang
that referenced
this pull request
Oct 20, 2026
… correctness) - core batch [10-15]: sgl-project#43376 long-ctx indexer OOM bound, sgl-project#42368 FlashInfer-0.7 decode dispatch, sgl-project#39914 extra-KV 64-token page split + candidate fallback, sgl-project#42714 graph-safe page-split buffers, sgl-project#32464 SM120 sparse-prefill test gate, sgl-project#34027 int32->int64 page-split overflow guard. - Group C [16-23]: sgl-project#42717 TP-rank verify-budget, sgl-project#43225/sgl-project#43374 compact-verify seq_lens + padding renorm, sgl-project#42718 packed-verify token->request map, sgl-project#42713 forced-uniform capture metadata, sgl-project#45301 padded-query graph lifetime, sgl-project#44141 bounded-replay guard, sgl-project#45185 V4.1-Flash-1017 FP8 QDQ (env-gated, default OFF). sgl-project#42710 skipped (superseded upstream: step_logits already fp32).
With SGLANG_TEST_RAGGED_VERIFY_FORCE_UNIFORM_CAPTURE in compact mode the capture carries no layout and the DSv4 backend keyed its metadata by request count, while replay keys it by token count and picked another tier's metadata.
Keying a layout-free capture by token count let a packed replay reuse a graph that recorded uniform attention geometry: with two requests of 3 and 4 tokens in the 12-token tier, request 1's tokens attended as request 0. Capture each forced-uniform tier with a layout of tier // width full-width rows instead, so it records the packed geometry that replay refreshes and keys by token count like every compact capture. Drop the key special case.
ormandj
force-pushed
the
forced-uniform-capture-token-key
branch
from
October 29, 2026 21:46
add0627 to
8ee1d04
Compare
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
With
SGLANG_RAGGED_VERIFY_MODE=compactandSGLANG_TEST_RAGGED_VERIFY_FORCE_UNIFORM_CAPTURE=1,DecodeCudaGraphRunnercaptures each token tierTwithT // widthfull-width requests and noRaggedVerifyLayout.compute_target_verify_graph_keythen keys the DeepSeek-V4 backend's captured metadata by request count,T // width. Every compact replay carries a layout and is keyed by token count,T.A replay can select metadata captured for a different tier, or find no entry for its tier. Example: width 6, tiers 6/12/24/36. A 6-token replay finds key 6, which holds the metadata captured for the 36-token tier (6 requests). Copying the 6-token replay's metadata into buffers captured for 36 tokens fails on a shape mismatch; in my DeepSeek-V4.1-Flash DSpark runs this happened on the first replay.
Modifications
In compact mode with
SGLANG_TEST_RAGGED_VERIFY_FORCE_UNIFORM_CAPTURE=1,DecodeCudaGraphRunnernow captures each token tier with aRaggedVerifyLayoutoftier // widthfull-width rows instead of no layout. The capture keeps the uniform geometry the flag asks for, but it records the packed attention path that replay refreshes, and it keys by token count like every compact capture, socompute_target_verify_graph_keyis unchanged. A layout-free capture recordedexpand_extend_with_same_lengthfor the DeepSeek-V4 attention metadata. A packed replay that only matched its key would reuse those kernels: with two requests of 3 and 4 tokens in the 12-token tier, request 1's first three tokens (packed indices 3 to 5) would attend with request 0's KV and causal lengths. Other modes are unchanged.This change covers the DeepSeek-V4 attention metadata. On DeepSeek-V4.1, compact replay, with or without this flag, also needs #42718, which maps packed verify tokens to their requests for the Engram hasher and the ratio-2 compressor, and #42709, which shares one capture layout between the two attention variants of a tier.
Accuracy Tests
TestForcedUniformCapture(CPU,test/registered/spec/dspark/test_ragged_verify.py) checks three things under forced-uniform compact capture: every tier's capture carries a full-width layout registered for replay staging, the key of a one-request replay padded to each tier finds that tier's capture, and staging two requests of 3 and 4 tokens into the 12-token tier moves the second request's start from token 6 to token 3. It fails on main, where the capture has no layout.test_ragged_verify.py,test_decode_cuda_graph_runner.pyandtest_dspark_scheduler.py: 45 passed on CPU.Speed Tests and Profiling
Not applicable: test-only capture mode.
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 #40960545799
Latest PR Test (Extra): ❌ Run #40960545808
Latest PR Test (AMD ROCm 10): ❌ Run #40960545823