Repository navigation
[Fix] deepseek_v4: Fix mHC prewarm when chunked prefill is disabled - #43448
Merged
Qiaolin-Yu merged 5 commits intoOct 21, 2026
Merged
Qiaolin-Yu merged 5 commits into
Qiaolin-Yu merged 5 commits into
Conversation
`prewarm_mhc_pre` sized its token buckets from `chunked_prefill_size`. With `--chunked-prefill-size -1` that produced a single bucket of -1 tokens and `residual.new_zeros(-1, ...)` raised during weight loading, so DeepSeek V4 could not start with chunked prefill disabled. Fall back to `max_prefill_tokens`, the bound on a prefill batch when prefill is not chunked (same rule as the pre-capture activation reserve). Co-Authored-By: Claude Opus 5.5 <[email protected]>
5 tasks done
maocheng23
requested review from
BBuf,
DarkSharpness,
HaiShaw,
HydraQYH,
celve and
yuan-luo
as code owners
October 10, 2026 00:23
4 tasks done
Oasis-Git
approved these changes
Oct 12, 2026
Oasis-Git
left a comment
Collaborator
There was a problem hiding this comment.
We do not need the new added ut test. pls remove it. Also pls trim the comments
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Collaborator
Author
|
Comment addressed |
4 of 5 tasks
This comment has been minimized.
This comment has been minimized.
This was referenced Oct 20, 2026
3 tasks done
bvolpato
added a commit
to bvolpato/sglang
that referenced
this pull request
Nov 1, 2026
The load hook returned early when chunked prefill was disabled. Since sgl-project#43448, prewarm_mhc_pre uses --max-prefill-tokens as the limit in that case, so the check only removed coverage. With --chunked-prefill-size -1, the first eager prefills then compiled the kernels on the serving path. Remove the check, its comment, and the get_schedule import. On a cold B200 cache the hook now warms all buckets at load, and later hc_attn_pre calls up to 16384 tokens compile nothing.
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
prewarm_mhc_presizes its token buckets fromchunked_prefill_size. With--chunked-prefill-size -1(chunked prefill disabled) that produces a single bucket of-1tokens, soresidual.new_zeros(-1, ...)raises while weights load. DeepSeek V4 cannot start with chunked prefill disabled.Servers that capture prefill hidden states turn chunked prefill off, so a request's states arrive in one forward. They hit this on DeepSeek V4.
Modifications
When chunked prefill is disabled or unset, size the prewarm buckets from
max_prefill_tokens, which bounds a prefill batch in that case. This is the same rulepre_capture_activation_reserve_mbuses.Accuracy Tests
Not applicable: startup-only change. No kernel or forward code changed.
Speed Tests and Profiling
Not applicable: startup-only change.
Tests
No unit test: removed per review. The fallback cases (
-1/0/Nonechunked prefill) were exercised by a since-removed CPU test that failed without the fix and passed with it.Checklist
🤖 Generated with Claude Code
CI States
Latest PR Test (Base): ❌ Run #39315285282
Latest PR Test (Extra): ❌ Run #39315285323
Latest PR Test (AMD ROCm 10): ❌ Run #39315285257