Repository navigation
router: --decode-request-weight balances decode DP ranks by held requests - #213
Merged
llying-001 merged 3 commits intoOct 23, 2026
Merged
Conversation
llying-001
requested review from
jiejingzhangamd,
limou102 and
xiaobochen-amd
as code owners
October 22, 2026 11:33
llying-001
added a commit
that referenced
this pull request
Oct 22, 2026
…5 GPU1), campaign watchdog, window-length analysis, PR #213 Co-authored-by: Cursor <cursoragent@cursor.com>
llying-001
added a commit
that referenced
this pull request
Oct 23, 2026
#213 decode request balance to 4+8, add 4+8 C48 and 2P C128) + frontier_gap.py Co-authored-by: Cursor <cursoragent@cursor.com>
… demand Under DP attention every decode step waits for the busiest rank, whose cost grows with its request count as well as its context. Decode input demand balances in-flight input tokens only, so one rank can hold many short requests. The new weight (tokens per held request, default 0 = unchanged) adds weight * requests to each candidate's projected tokens, the form Dynamo uses for router-decode-active-request-weight. Exposes the per-target request count as infera_router_decode_demand_requests. Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: liyingli <liyingli@amd.com>
…and the 2P1D kit README, with the 1P1D C88 A/B Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: liyingli <liyingli@amd.com>
…s by default up.sh passes --decode-request-weight $DECODE_REQUEST_WEIGHT (env.sh, default 1,000,000, recorded per run); 0 keeps token-only decode demand. The README section is no longer optional. Signed-off-by: liyingli <liyingli@amd.com> Co-authored-by: Cursor <cursoragent@cursor.com>
llying-001
force-pushed
the
feat/sglang-mix-glm5.2-tp4-v0522
branch
from
October 23, 2026 09:05
d395c3b to
f491b56
Compare
llying-001
force-pushed
the
feat/decode-dp-request-balance
branch
from
October 23, 2026 09:05
e923f90 to
3ad7527
Compare
llying-001
added a commit
that referenced
this pull request
Oct 23, 2026
…unning; ex_campaign.sh builds the PR 210+213 image and runs the PD example (PP4 prefill + balance) Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
Author
Contributor
Author
9 of 12 tasks
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.
Description
Stacked on #210 (base
feat/sglang-mix-glm5.2-tp4-v0522); retarget tomainonce #210 merges. Only the last two commits are this PR.Under DP attention every decode step waits for the busiest of the decode ranks, and that rank's step time grows with its request count as well as its context.
--decode-input-demand onbalances in-flight input tokens only, so a rank can hold many short requests for another's one long request. In #210's sweep this shows up as interactivity that barely moves with concurrency (2P1D p90 35.7 at C176, 40.8 at C96).This adds
--decode-request-weight W(INFERA_DECODE_REQUEST_WEIGHT, default 0 = unchanged): with decode input demand on (or shadow), each Decode candidate costsHeld requests are the existing demand reservations (booked at the pick, released at response EOF, cancellation or failure), so this is the same count Dynamo charges with
router-decode-active-request-weight(decode blocks + weight × active requests; GB300's GLM-5.2 recipe uses 8192 blocks per request, i.e. request counts dominate).Type of change
Changes
rust/router/src/config.rs:--decode-request-weight <tokens>(envINFERA_DECODE_REQUEST_WEIGHT, default 0); rejected unless--decode-input-demandisshadoworon.rust/router/src/policy.rs: the demand cost addsweight × held requestsfrom the ledger; thedecode_demanddebug event carries the weight. Inshadowthe suggestion uses the weighted cost and selection stays legacy.rust/router/src/metrics.rs,decode_demand.rs:infera_router_decode_demand_requests{target}gauge, set on book and release.infera/server/args.py,launch_rust.py: the same flag on the Python launcher, forwarded to the Rust router only when given (Rust-only, like--decode-input-demand).decode_request_weight_balances_requests_held,decode_request_weight_in_shadow_keeps_the_legacy_pick,decode_request_weight_requires_decode_demand; launcher forwarding / validation intests/unit/server/test_launch_rust.py.manual/reference/cli.md,manual/features/kv_aware_routing.md(Request-count weight),examples/sglang_2p1d_glm5.2/README.md(Decode request balancing, with the data below).Validation
Unit (in the
lmsysorg/sglang-rocm:v0.5.22-rocm720-mi35x-20261018base, cargo 1.99.1):cargo test --release -p infera-router354 + 46 + 4 + 14 passed, 0 failed;cargo fmt --checkclean;pytest tests/unit/server/test_launch_rust.py25 passed;ruff format --check/ruff checkclean on the touched Python files.AgentX, GLM-5.2-MXFP4, 1P1D C88 with #210's kit (
PREFILL_WORKERS=1, prefill on GPUs 4-7, forced acceptance 3.61) on two AUS MI355X nodes (smci355-ccs-aus-n04-25 prefill / n06-33 decode). The image is #210'sDockerfile.sglang; the router binary was built from this branch in the same base and mounted withINFERA_ROUTER_BIN. Prefills carry the decode's EAGLE flags (#210 note 10). Both points on one deployment, one after the other; before each the router was restarted with its weight and the prefill's cache flushed (/flush_cache, checked: every prefill rank's first batch had 0 cached tokens). 10 warm-up requests per lane, 1800 s measured (the job was preempted every 0.5-1 h, so a 3600 s point rarely completed):--decode-request-weightDecode ranks over the measured window (decode log,
#running-req/#tokenper rank, 3 s bins):Data, scripts and analysis:
llying/1p1d-decode-balance-aus-20261021/ondev/pd_opt/glm_5.2_agentx.Checklist: