Skip to content

[AMD][dsv4] fix 2P1D 8k1k straggler (decode/prefill context-length asymmetry)#2257

Open
inkcherry wants to merge 1 commit into
SemiAnalysisAI:mainfrom
inkcherry:pr/dsv4-straggler-fix
Open

[AMD][dsv4] fix 2P1D 8k1k straggler (decode/prefill context-length asymmetry)#2257
inkcherry wants to merge 1 commit into
SemiAnalysisAI:mainfrom
inkcherry:pr/dsv4-straggler-fix

Conversation

@inkcherry

@inkcherry inkcherry commented Jul 17, 2026

Copy link
Copy Markdown

In the 2P1D 8k1k run at concurrency 500/512 a few requests hang until the client timeout (p99.9 TTFT ~1800s).

models.yaml sets context_length: 9217 on the prefill role only, and server_sglang.sh only passes --context-length to 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-length to decode (read from models.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).

…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.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant