Repository navigation
[Fix] deepseek-v4: Preserve decoder-tail token-count ownership - #45915
Merged
Merged
Conversation
ch-wan
requested review from
Fridge003,
Ying1123,
hnyls2002,
ispobock and
merrymercy
as code owners
October 22, 2026 23:45
This was referenced Oct 22, 2026
ch-wan
force-pushed
the
cheng/hot-fix/decoder-tail-global-counter
branch
3 times, most recently
from
October 23, 2026 11:35
c05521b to
b556b74
Compare
ch-wan
force-pushed
the
cheng/hot-fix/decoder-tail-global-counter
branch
from
October 23, 2026 19:27
b556b74 to
c6e2917
Compare
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.
This PR is part of a stack (oldest at bottom):
Motivation
DeepSeek-V4 decoder-tail graphs need the current live token prefix on every replay. A row graph previously owned only the LOCAL count, so a distinct GLOBAL MoE count could not safely follow changing replay sizes. This prevented capture of supported attention-TP-sharded tails; borrowing the parent counter would instead leave captured kernels reading another batch's state.
This change gives each opted-in graph its own LOCAL and GLOBAL count views. Replay updates both while preserving the parent batch's counters and the existing default row-runner behavior.
Changes
DecoderReplayTail.runtoRowBucketGraphRunner.Review order
python/sglang/srt/models/deepseek_v4_replay_tail.py: capture admission and the gathered GLOBAL prefix.python/sglang/srt/model_executor/runner/row_bucket_graph_runner.py: count storage, localization, cache identity and replay updates.test_num_token_non_padded_localization.pyandtest_decoder_tail_moe_bound.py: domain selection, parent-storage preservation and changing-prefix replay.Validation
Based on main
25ad569ff9. Checks ran on the integrated sourcef3a116529a; all four implementation/test files match this PR'sf3d331d859exactly.Full-model attention, real multi-rank collectives and serving performance were not tested. These checks establish count ownership and CUDA replay behavior, not a whole-stack performance result. Eager CPU submission overhead is outside the performance scope.
Rebase validation
This five-PR stack was rebased without conflicts onto main
8b9f72417f. All five patches retain their stable patch IDs relative to the preceding published stack; the newer main commits do not touch the stack's changed files. The existing removal of the unusedmaterialized_routingparameter and its three call-site arguments in #45917 is preserved.Each rebased PR commit passed its configured pre-commit checks independently. The final stack passes
git diff --check, and all 72 changed Python files parse successfully. CPU test suites, native GPU tests and performance measurements were not rerun for this rebase. Previously reported results, including those at integratede6670af1ad, remain evidence for those earlier revisions with their stated limits.CPU CI follow-up
Run 39935811691 exposed an upstream Flux2 import test registered in the CPU suite, whose environment lacks the diffusion dependencies. The import chain also queries the active GPU. #45915 moves that check to the existing CUDA diffusion unit suite, which installs those dependencies, while retaining its XPU registration and the real subprocess check that blocks Intel Triton imports. This registration fix is propagated through the stack.
The Flux2 import check passes on 1× NVIDIA B300 with PyTorch 2.14.1+cu130, Triton 3.8.0 and Diffusers 0.37.0; its five Intel-XPU numerical cases are skipped on CUDA and were not rerun on XPU. Full integrated registry collection validates 2,535 files / 3,077 registrations, including the enabled diffusion/XPU selections and the preceding GGUF MUSA fix. Configured checks pass for the changed files. Only three test files change across this follow-up; production code is unchanged. A fresh full CI result is not claimed.
Merge preparation
Rebased this component onto main
9d7ad308bdfor squash merge. Resolved the overlap with #46040 by keeping the CPU registration removed and retaining the diffusion CUDA import regression alongside its XPU registration. No test suites or performance measurements were rerun for this merge. Earlier validation sections describe their named revisions.CI States
Latest PR Test (Base): ❌ Run #40011615879
Latest PR Test (Extra): ❌ Run #40011615862
Latest PR Test (AMD ROCm 10): ❌ Run #40011615911