Skip to content

[Fix] dsv41: Bound MoE routing to live SWA graph-tail rows - #44347

Merged
kpham-sgl merged 5 commits into
sgl-project:mainfrom
kpham-sgl:codex/dsv41-swa-routing-bound
Oct 15, 2026
Merged

kpham-sgl merged 5 commits into
sgl-project:mainfrom
kpham-sgl:codex/dsv41-swa-routing-bound

Conversation

@kpham-sgl

@kpham-sgl kpham-sgl commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

During DeepSeek V4.1 bounded decoder SWA replay inside a breakable prefill graph, attention switches to the live tail while MoE can retain the full-prefill GPU row bound. A 128-row tail can therefore expose a routing bound of 16,384 rows.

Modifications

Bind the global and local GPU routing counts to a persistent tail scalar while the late layers run. Clamp the existing count so an idle DP peer stays at zero, then restore the original CPU count and GPU tensor references on exit. Reuse the scalar across replays so captured MoE kernels retain a stable address.

This is an independent fix against main, separated from the MegaAttention integration in #43922.

Accuracy Tests

  • The same routing method implementations previously passed eight CUDA graph checks across two GB300s, covering counts 128, 7, idle 0, and 256. Those checks ran on the optimization branch; AST comparison confirms both extracted routing methods are identical here.

Speed Tests and Profiling

A separate end-to-end throughput benefit has not been measured for this fix alone. The earlier AgentX comparison combined it with the Mega query-layout optimization. Eager tails already use compact tensors; this fix addresses the padded graph-tail path.


CI States

Latest PR Test (Base): ❌ Run #38680117421
Latest PR Test (Extra): ❌ Run #38680117400
Latest PR Test (AMD ROCm 10): ❌ Run #38680117454

@kpham-sgl

Copy link
Copy Markdown
Collaborator Author

/rerun-test test/registered/e2e/models/test_deepseek_v41_flash_gb300.py

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

🚀 4-gpu-gb300 (1 test): ✅ View workflow run

cd test/ && python3 registered/e2e/models/test_deepseek_v41_flash_gb300.py

@kpham-sgl
kpham-sgl merged commit d4daf52 into sgl-project:main Oct 15, 2026
106 of 122 checks passed
listar2000 pushed a commit to listar2000/miles that referenced this pull request Oct 30, 2026
…e rows [fork fix-065]

Inside the prefill CUDA graph the late-layer tail block is padded to a fixed
capacity. The tail switch pointed only the CPU non-padded count at the real
tail rows, so MoE dispatch still read the GPU counts and routed the padding
rows. SGLang's fix (#44347) clamps the GPU counts to the tail's real rows
while the late layers run and restores them after. It also drops a
duplicated block of tail fields in __init__.

Patch page: fork/patches/fix-065-sglang-swa-fixes.md

Fork-Fix: fix-065
Touches: sglang:python/sglang/srt/layers/attention/deepseek_v4_backend.py
Evidence: sgl-project/sglang#44347 (main d4daf5236); the 1-node A/B on this branch's image
Upstream-Status: merged in sgl-project/sglang main 80afdc128 (d4daf5236, #44347); not on sglang-miles 5403606db9
Remove-When: SGLANG_COMMIT includes sgl-project/sglang d4daf5236
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant