Repository navigation
[Fix] sgl-router: Send disagg_prefill_dp_rank to decode under --dp-aware - #44072
Merged
ShangmingCai merged 3 commits intoOct 15, 2026
Merged
ShangmingCai merged 3 commits into
ShangmingCai merged 3 commits into
Conversation
AMD-yanfeiwang
force-pushed
the
fix/sgl-router-pd-prefill-rank-hint
branch
from
October 14, 2026 03:50
5fe8a72 to
c4dddff
Compare
This was referenced Oct 14, 2026
With --dp-aware in PD mode the router pins the prefill DP rank but did not tell decode which rank that was. Unless prefill runs --load-balance-method follow_bootstrap_room, SGLang's decode then looks up every room on prefill's bootstrap server, which prefill has to register first; under load that held decode KV-receiver setup at 0.6-0.75 s per request instead of ~5 ms. Name the pinned rank in the decode body, as sgl-model-gateway does. Prefill's body is unchanged, and a batch or n > 1 request still leaves the prefill rank to the engine.
AMD-yanfeiwang
force-pushed
the
fix/sgl-router-pd-prefill-rank-hint
branch
from
October 14, 2026 03:55
c4dddff to
d12b15b
Compare
12 of 14 tasks
Since sgl-project#43511, step 3 is turn-based under --dp-rank-policy round_robin, so "load only" no longer describes it. Match main's wording. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Collaborator
|
/tag-and-rerun-ci |
ShangmingCai
approved these changes
Oct 15, 2026
ShangmingCai
added a commit
that referenced
this pull request
Oct 16, 2026
Resolve conflicts with #42674 (squash-merged), #42818 and #44072: - prepare() resolves OpenAI-route models with lookup_openai, so HTTP `model: "base:adapter"` keeps routing to the base model. - Leg::new passes the pinned prefill rank so decode still receives disagg_prefill_dp_rank under --dp-aware. - PreparedRequest::completion and ::typed set cache_namespace. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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
With
--dp-awarein PD mode, sgl-router pins the prefill DP rank but does not tell decode which rank that is. Decode needs it to set up its KV receiver. It can derive it from the bootstrap room only if prefill runs--load-balance-method follow_bootstrap_room; with any other method, decode asks prefill's bootstrap server, which learns the room only when prefill's scheduler picks the request up, so decode polls until then. Every decode handshake therefore waits on prefill's scheduler loop, and with the default--optimistic-prefill-attempts 0, prefill does not run a request until it sees decode ready.sgl-model-gatewayandmini_lbalready senddisagg_prefill_dp_rankto decode.Modifications
--dp-awarepins the prefill rank, the decode body also carries it asdisagg_prefill_dp_rank, for/generate,/v1/completions,/v1/chat/completionsand/v1/messages. The prefill body is unchanged, and batch /n > 1requests, which leave the prefill rank to the engine, send none.Testing
dp_rank_routing::pd_generate_carries_each_rank_in_its_body: decode'sdisagg_prefill_dp_rankequals prefill'srouted_dp_rank(fails without this change).pd_fan_out_leaves_the_prefill_rank_to_the_engine: decode gets none.cargo +nightly fmt --all -- --check,cargo check,cargo clippy -- -D warnings,cargo test --release --workspace -- --skip parity_matrix.Benchmark (MI355X)
DeepSeek-V4-Pro, 1 prefill + 1 decode engine with 8 DP-attention ranks each, AgentX trace replay with AIPerf (multi-turn agentic sessions, 96% prefix-cache hit), 1 h per concurrency, prefill
--optimistic-prefill-attempts 2. Router--policy sticky --routing-key-header X-SMG-Routing-Key --decode-policy power_of_two --dp-aware, decode ranks round-robin (#43511), built at 1e86143.The runs predate this patch, so both arms use the same router binary and differ only in prefill's load-balance method:
round_robin, so decode looks every room up, as on main today;follow_bootstrap_room, so decode computes the rank from the room. That is the information this PR sends, so decode's handshake is the same.Handshake, mean over the hour (before → after):
The first two columns are each engine's
kv_transfer_bootstrap_ms: until decode's receiver is ready, and until prefill sees it ready. The prealloc queue is decode's#prealloc-req, summed over its 8 ranks. For reference,sgl-model-gatewayon the same engines, which sends the rank like this PR, measured 0 ms, 30–34 ms and 0 at every concurrency. With least-in-flight decode ranks (main's default), decode's handshake went from 587–723 ms to 0.End to end, AIPerf (before → after):
--optimistic-prefill-attempts 2let prefill start requests before decode was ready, which kept the late handshake off the critical path. With the default of 0, prefill holds each request until it sees decode ready, which took about 1.5 s here instead of about 50 ms; that case was not measured.CI States
Latest PR Test (Base): ✅ Run #38682284072
Latest PR Test (Extra): ❌ Run #38682284058
Latest PR Test (AMD ROCm 10): ➖ No AMD PR run found for this commit.