[AMD][dsv4] fix 2P1D 8k1k straggler (decode/prefill context-length asymmetry)#2257
Open
inkcherry wants to merge 1 commit into
Open
[AMD][dsv4] fix 2P1D 8k1k straggler (decode/prefill context-length asymmetry)#2257inkcherry wants to merge 1 commit into
inkcherry wants to merge 1 commit into
Conversation
…aggler) Satisfies MOTIVATION_RULES rule 2 (root cause) + rule 3 (fix). Root cause of the 8k1k conc-500/512 straggler tail (last few requests hang to the 1800s client timeout, p99.9 TTFT ~1802s): a prefill/decode context-length asymmetry. models.yaml sets context_length: 9217 for the DeepSeek-V4-Pro prefill role but not the decode role, and server_sglang.sh only appends --context-length to PREFILL_MODE_FLAGS. So prefill runs with context_length=9217 (max input 9211) while decode falls back to the model's default (~1M; observed max_req_input_len 1048570). A request whose input exceeds 9211 -- e.g. random-dataset prompts that retokenize above the 8192 target -- is ACCEPTED by decode (which pre-allocates KV and waits for the transfer) but REJECTED by prefill with HTTP 400 (so prefill never registers the bootstrap room and never sends KV). The decode request then waits forever for a KV transfer that never comes and hangs to the client timeout. (The permanently-pending decode requests also re-query the prefill bootstrap every scheduler iteration, which is what exhausted ephemeral ports in a separate failure mode addressed by the bootstrap-session-pool patch.) Fix: parse a decode context_length from models.yaml and append --context-length to DECODE_MODE_FLAGS, defaulting to the prefill value when unset so the two roles always agree in PD-disaggregation. Over-length requests now fail fast at decode admission (HTTP 400) instead of hanging. Valid requests are unaffected.
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.
In the 2P1D 8k1k run at concurrency 500/512 a few requests hang until the client timeout (p99.9 TTFT ~1800s).
models.yamlsetscontext_length: 9217on the prefill role only, andserver_sglang.shonly passes--context-lengthto prefill, so decode falls back to the model default (~1M). A request longer than 9216 is accepted by decode (allocates KV, waits for the transfer) but rejected by prefill with HTTP 400, so prefill never sends the KV and that decode request waits forever.Changed
Also pass
--context-lengthto decode (read frommodels.yaml, defaulting to the prefill value) so both sides use the same limit.Validated
Before: conc-500 stalled with 33/1000 (rr=1.0) and 4/1000 (rr=0.8) requests hung to the timeout. After: conc-500 and conc-512 complete 100% in ~140s with normal p99.9. gsm8k accuracy unchanged (0.958).