Repository navigation
[Fix] [AMD] dsv4.1: Fix decode graph capture with quantized low-ratio activations - #46151
Merged
hnyls2002 merged 6 commits intoOct 24, 2026
Merged
Conversation
sgl-project#45407 made forward_low_ratio_sources slice x and q_lora to the hoisted rows on every step. On HIP q_lora (and on some routes x) arrives quantized, an Mxfp8Activation or Fp8GridActivation struct, which a slice cannot cut, so every DeepSeek-V4.1 decode graph capture failed with "'Mxfp8Activation' object is not subscriptable". A struct is now cut field by field, and kept as is when all its rows are live (every decode and verify step); a tensor slices as before. write_tail_source_kv counts a struct's rows the same way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kevin-mii
requested review from
Fridge003,
HaiShaw,
Qiaolin-Yu,
hebiao064,
ispobock and
merrymercy
as code owners
October 23, 2026 18:56
Collaborator
Author
|
/tag-and-rerun-ci |
…rows Simpler form of the fix: forward_low_ratio_sources cuts x and q_lora only when the step has rows past the hoisted ones (DP attention padding an eager extend), as before sgl-project#45407; in every other case they already have n rows. That cut keeps HIP's quantized activations whole, field by field. write_tail_source_kv's input is a bf16 tensor (fused_boundary_attn_input), so it keeps sgl-project#45407's check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… rows The all-rows-live pass-through (the crash sgl-project#45407 caused) and the DP-padding cut are separate cases, each with the failure it prevents in its docstring. The hoisted req / pos assertions go: test_tail_break_uses_live_prefix_of_hoisted_rows pins them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…guards `_first_rows` states its contract and why a struct is cut by fields; the two test docstrings state the TypeError each prevents. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…orts The q_lora fixture sits beside `_run` and the cut struct is named `cut` rather than `got`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The DP padding case also fails on main's unconditional slice, so the pass-through case for all-live rows guarded nothing more; the helper goes with it. Decode and verify steps stay covered by the HIP e2e. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
/rerun-test test/registered/e2e/models/test_deepseek_v41_flash_gb300_dp2ep2.py test/registered/e2e/models/test_deepseek_v41_flash_gb300_trtllm_bounded_bcg.py |
Contributor
|
🚀 |
4 of 5 tasks
Open
5 tasks
3 of 5 tasks
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
#45407 made
forward_low_ratio_sourcescutxandq_lorato the hoisted rows on every step (x[:n],q_lora[:n]); before, it cut them only when DP attention padded an eager extend. On ROCm,q_lora(and on some routesx) reaches it quantized, as anMxfp8Activation(q and scale) or anFp8GridActivation: structs that refuse a slice. Since #45407, a DeepSeek-V4.1 server on MI35x fails while capturing its decode graphs (seen with--monokernel-backend amd; the failing call is SGLang's own forward, which every decode step of a plain server runs):Modifications
forward_low_ratio_sourcescutsx,positionsandq_loraonly when DP padding left rows past the hoisted ones, as before [Fix] [NVIDIA] deepseek-v4.1: Fix the breakable prefill CUDA graph in the late-layer tail on SM90 #45407. Decode and verify steps, where every row is live, pass them on uncut._first_rows, which cuts a quantized struct field by field (msgspec.structs.replace) and a tensor with[:n]. On CUDA both are tensors here, so CUDA takes the same cut as on main.Accuracy Tests
MI350X, TP4, DeepSeek-V4.1-Flash, this branch on main 74c08f3, with sgl-project/sgl-amd-mono main 52dceb0:
test/registered/unit/layers/test_dsv41_late_layer_tail_readers.py: 13 passed. The new case (DP padding cuts a quantizedq_lorafield by field) fails on main with the error above.test/registered/kernels/ops/attention/dsv4/test_dsv41_decode_glue_hip.py: 6 passed.test/e2e/test_deepseek_v41_server.py(--monokernel-backend amd): 9 passed. GSM8K: 0.930 (DSpark verify server), 0.905 (decode server). Both servers step past the monokernels' widths onto this path.test/kernels/test_deepseek_v41_kernels.pyagainst this SGLang (K1, K2 and the FFN launch bit for bit, with and without aiter's preshuffle, every width the spec builds): 6 passed, on 048555d.The other GPU runs used e62ad22. The commits after it change only docstrings and the unit test.
Speed Tests and Profiling
No speed change intended: decode and verify steps now skip a cut that kept every row. AgentX (InferenceX agentic coding, TP4, concurrency 1, 900 s) with the monokernels, on this PR's first version (048555d, same decode and verify path): P90 637.6 tok/s/user, P50 668.0, 6627 tok/s/GPU, acceptance length 3.52.
Checklist
🤖 Generated with Claude Code
CI States
Latest PR Test (Base): ⏳ Run #40030122492
Latest PR Test (Extra): ❌ Run #40030122499
Latest PR Test (AMD ROCm 10): ❌ Run #40030122510