Repository navigation
fix(router): make the per-class decode wait limit correct for disaggregated serving - #18056
ishandhanani wants to merge 21 commits into
Conversation
Add a PairedPoolRoom hook a host installs on a scheduler (set_paired_pool). A policy class with a decode_busy_threshold_frac then also waits until the paired pool, the decode pool behind a prefill router, has a rank within that fraction. The queue checks the hook with its own prefill check in the drain path and in the never-queue direct path, and caches one answer per class per gate pass for requests without a LoRA. Classes without a decode fraction never consult it, and a scheduler with no hook is unchanged. LocalScheduler::any_rank_has_room reads booked load from the slot registry without a turn of the actor. subscribe_room_changed exposes a broadcast hint (RoomChanged) fired on releases, cleanup drains, peer-router state and worker config changes. It is separate from the actor's notify_one CapacityUpdates so a paired queue never steals the actor's permits. ScheduleRequest and SelectionOperation carry an in-process admitted_upstream flag: the queue books such a request directly, with no class wait and no deadline expiry, while selection still applies reject thresholds. Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
…egated serving In disaggregated KV routing the prefill and decode routers both run a policy-class queue with the same profile. The class decode wait limit did nothing on the prefill router, which tracks no held blocks, and on the decode router it could hold a decode leg after its prefill was dispatched, stranding prefill KV and breaking SGLang bootstrap. Make the prefill hop the only gate. The frontend now installs the decode RoutingHost on the PrefillRouter whenever routing is KV, and every prefill binding's KV router judges class decode limits on a lazily resolved DecodePoolRoom over the decode router: its booked load, reachable workers and the request's LoRA through the decode router's own availability filter. Until the decode host exists the pool reports room. RoutingHost books every decode-phase request as AdmittedUpstream, so the decode queue never holds or expires one: a decode leg whose prefill is running and a conditional-disagg bypass alike. Only the prefill router sets the decode phase, so aggregated requests keep the full class gate. Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
State where decode_busy_threshold_frac is judged: on the same workers in aggregated serving, and at the prefill hop against the decode pool in disaggregated KV routing, where the decode hop books legs without waiting. List what the pool-level decode check applies and what decode selection still enforces. Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
|
/ok to test 2be8ec8 |
ishandhanani
left a comment
There was a problem hiding this comment.
Round 1 AI review
Automated review (round 1 of up to 2 before a human review). Findings may be wrong; reply on a thread to dispute one.
This PR makes the prefill hop's policy-class queue the only admission gate in KV-routed disaggregated serving. The prefill queue now checks each class's decode_busy_threshold_frac against the decode router's booked load through a PairedPoolRoom hook and wakes on a RoomChanged signal. The decode hop books decode-phase requests directly. I read the wiring, the wake path (every decode free path calls capacity_changed or direct_release, and the prefill actor subscribes before its first answer), and the new tests, and found them sound. One problem remains: decode-phase requests are mapped to AdmittedUpstream by phase alone, so conditional-disagg bypass requests lose all class gating even though nothing upstream admitted them and they hold no prefill KV.
New findings: 1 BUG
The next AI round runs after new commits are pushed.
✅ Dynamo PR CI passed — run 45079071102 (attempt 1) on
|
The decode hop booked every decode-phase request as AdmittedUpstream, including a conditional-disagg bypass. A bypass never passes the prefill queue and holds no staged KV, so it lost every class limit, queue limit and deadline. Book directly only decode legs with staged KV; the bypass keeps the decode queue's full class gate, as before this change. Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
|
/ok to test d5dd600 |
ishandhanani
left a comment
There was a problem hiding this comment.
Round 2 AI review
Automated review (round 2 of up to 2 before a human review). Findings may be wrong; reply on a thread to dispute one.
The new commit fixes the round-1 finding. The decode hop now books directly only decode legs that are in the decode phase and have staged KV. A conditional-disagg bypass keeps the full class gate at the decode router, which is the pre-PR behavior and correct, because that request never passed the prefill queue and holds no prefill KV. The docs, the code comments, and the end-to-end test are updated to match: the test now shows the bypass waiting while decode is full and being released when decode KV is freed. I found no new issues in the changed code.
New findings: none
Earlier findings: 1 fixed, 0 no longer apply, 0 still open
The author's agent picks up this feedback next.
…ng request make_scheduling_request no longer returns it as a third tuple element that the advisory path discards.
|
/ok to test 2356540 |
ishandhanani
left a comment
There was a problem hiding this comment.
Deslop · 1 cleanup · d5dd600 → 2356540
Automated deslop of this PR's own diff: duplicate or redundant new structures, one-use abstractions, dead paths, and comments a person would not write, with behavior unchanged.
Read through the whole PR diff (7301490..d5dd600) and made one cleanup. It is pushed as a fast-forward with no rewrite, and the worktree was already clean, so nothing was stashed. The cleanup: make_scheduling_request had grown a third return value, admitted_upstream. Its one user, the admitted path, now reads request.admitted_upstream before the call, and the function signature and the advisory call site are back to how they were on main. Behavior is unchanged: the advisory path ignored the flag before and still does. Checks: cargo check -p dynamo-kv-router builds clean, cargo test -p dynamo-kv-router --lib scheduling:: passes (316 passed, 1 ignored), cargo fmt --check is clean, and the commit is signed. Things I looked at and left alone: (1) KvRouter::set_paired_pool has two callers (activation and a routing_host test). (2) KvRouter::subscribe_room_changed and ActiveSequencesMultiWorker::any_rank_has_room are one-line forwarders, but they sit at layer boundaries and the fields behind them are private. (3) RoomChanged exists so a second watcher cannot steal the actor's notify_one permits. (4) PairedPoolGate::changed and close_room_changed are needed for the select! borrow and to stop watching once the signal is closed. (5) pub(crate) mod decode_room is used by routing_host/tests.rs. (6) The admitted_upstream doc comments on ScheduleRequest, SelectionOperation and FindBestMatchAdmission each sit on a public or boundary type. (7) The comment in DecodePoolRoom::has_room states a rule that is easy to miss: a request this gate lets through is routed at decode exactly as it would be with no decode wait limit.
235654044amake_scheduling_requestreturned a 3-tuple only to passadmitted_upstreamthrough, and the advisory caller threw it away. The admitted path now reads the field before converting the request, and the destructure binds it as_, so the signature and both call sites match main again.
…sagg-decode-gate # Conflicts: # lib/kv-router/src/scheduling/queue.rs # lib/kv-router/src/scheduling/types.rs
|
CI babysit · merged DetailsWhy: the branch conflicts with main. Merged origin/main into the PR branch and pushed the merge as 5b1fa3c. It is a plain merge on top of the old head, so nothing was rewritten or force-pushed, and the worktree was clean so nothing was stashed. Two files conflicted: lib/kv-router/src/scheduling/queue.rs and types.rs. They clashed with main's admission queue rework (#17723 flat policy-class config, #17724 EDF ordering, #17725 controlled delay, #18008 Fx availability set). The rest merged automatically. Main's #17723 also removed the old policy-class YAML keys, so five tests the PR added (four in queue.rs, one in lib/llm/src/kv_router/routing_host/tests.rs) failed to parse their config; I moved them to the new flat format and they pass. Checks on the merge:
|
|
/ok to test 5b1fa3c |
…your PRs get resolved; each action is logged and noted on the PR On your own PR in Babysit, a failing CI pass now decides between re-running failed jobs (flakes, infra, cancelled runs) and merging the base branch (merge_base: only when the base has what fixes the failure); the author's agent does the merge. A merge conflict goes straight to the author's agent (a sync run, once per head): fetch the base, merge it in (no rebase, nothing rewritten), resolve keeping both intents, run the narrowest checks, push. A conflict that needs your call aborts the merge and asks you. Every re-run and merge posts a short folded PR comment (CI babysit · ...) under the factory marker, and each pass and sync is a telemetry job with outcomes (babysit_outcome, conflicts_resolved, pushed). Other people's PRs keep re-run or ask; we do not push to their branches. Live on ai-dynamo/dynamo#18056: two conflicts with main's admission queue rework resolved, five PR tests moved to main's new config format, merge 5b1fa3c455 pushed, PR mergeable again, comment posted.
…sagg-decode-gate # Conflicts: # lib/llm/src/kv_router.rs # lib/router/scheduler/src/local.rs # lib/router/scheduler/src/queue.rs # lib/router/scheduler/src/types.rs # lib/router/slot-tracker/src/multi_worker.rs # lib/router/slot-tracker/src/prompt_registry.rs
|
/ok to test 3935cf9 |
…sagg-decode-gate # Conflicts: # lib/router/scheduler/src/local.rs
|
CI babysit · merged DetailsWhy: the branch conflicts with main. Merged origin/main into the PR branch and pushed the merge as 8858607. It is a plain merge on top of the old head, so nothing was rewritten or force-pushed, and the worktree was clean so nothing was stashed. One file conflicted, lib/router/scheduler/src/local.rs, because main's #18799 deleted the legacy
|
|
/ok to test 8858607 |
…sagg-decode-gate # Conflicts: # docs/fern/pages/developer-guide/knowledge-base/modular-components/router/configuration-and-tuning.md # lib/router/scheduler/src/queue.rs
|
CI babysit · merged DetailsWhy: the branch conflicts with main. Merged origin/main into the PR branch and pushed the merge as 2bb6d80. It is a plain merge on top of the old head, so nothing was rewritten or force-pushed, and the worktree was clean so nothing was stashed. Both conflicts come from main's #18443 (dispatch gate and session lanes), which reworked the same scheduler queue code this PR changes. Main now gives each lane-check answer a reason (
|
|
/ok to test 2bb6d80 |
|
CI babysit · the author's agent is fixing a CI failure the PR causes Detailsrust-clippy (.) and rust-tests (.) fail to compile lib/router-plugins/builtin/tests/thunderagent_gate.rs:126 with E0063
|
…quest Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
|
CI babysit · the author's agent fixed a CI failure the PR caused ( DetailsThe babysitter's diagnosis was right. Both rust-clippy (.) and rust-tests (.) fail with E0063
|
|
/ok to test 5a45746 |
|
CI babysit · treating 1 check as expected, not failing DetailsOpt-in gates or summary jobs; they need a label or another check, not a code change.
|
|
CI babysit · re-ran 1 failed job Detailsrust-tests (.) has no failing test or compile error: its log stops partway through the passing dynamo-llm lib tests at 16:01:09 with no test result line, which looks like the runner died rather than anything the PR changed. I re-ran the failed jobs; pre-merge-status-check only failed because rust-tests did. |
|
CI babysit · re-ran 1 failed job DetailsOn the re-run, rust-tests (.) failed on logging::tests::test_tokio_console_respects_console_format in dynamo-runtime: that test runs its own nested cargo build, and the linker crashed during it ("linking with cc failed", with an LLVM "please submit a bug report" note). The PR does not change dynamo-runtime logging, and the previous attempt died for a different reason (truncated log), so this looks like runner instability and I re-ran the failed jobs. |
|
CI babysit · re-ran 1 failed job Detailsrust-tests (.) failed for the second time in a row on dynamo-runtime logging::tests::test_tokio_console_respects_console_format, with the same linker crash inside the nested cargo build that test runs. The PR changes nothing under lib/runtime or any Cargo or .cargo config, and main's recent runs of this workflow are green, so I re-ran the failed jobs. If it fails a third time, the human should look at that test's nested build on this runner image, or merge main to pick up a fresh build cache. |
|
CI babysit · merged DetailsWhy: Nothing has changed since pass 4: the head is still 5a45746, and rust-tests (.) attempt 4 is the same failure, where the nested cargo build in logging::tests::test_tokio_console_respects_console_format dies with |
|
/ok to test b7b3473 |
|
CI babysit · an agent is fixing a CI failure the PR causes Detailsrust-clippy (.) and rust-feature-builds fail to compile dynamo-bench with E0063 |
The selection replay benchmark (ai-dynamo#17959) builds SelectionOperation without the admitted_upstream field this branch adds, so dynamo-bench failed to compile with the selection-replay feature. Replayed requests have no upstream hop, so the field is false. Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
|
CI babysit · an agent fixed a CI failure the PR caused ( DetailsPushed f87118f to the PR branch with a plain push; the PR head is now f87118f and it is still a draft. The commit adds
|
|
/ok to test f87118f |
ishandhanani
left a comment
There was a problem hiding this comment.
Round 3 AI review · 1 TEST, 1 DESIGN, 1 NIT
Automated review, round 3. Every finding is posted, NITs included; findings may be wrong, so reply on a thread to dispute one.
The PR makes the prefill hop's policy-class queue the only gate for class decode wait limits in KV-routed disaggregated serving, and the decode hop books decode legs with staged KV directly. Since round 2 it took one cleanup commit, two one-line compile fixes and 14 merges from main. I read the hand-resolved merge of the paired-pool gate into main's lane checks, recheck scopes and wake loop and found it correct; RecheckScope::Capacity is the right scope for a decode-room wake, because a gate-held head is refused before the pool is asked. Three things remain: the direct-booking path now skips the dispatch gate that main added, with no doc or test saying so; the release of a lane-blocked head on the room signal has no test; and the PR description is stale.
Read: rust-code-review, deep-code-review, deep-code-review/references/quality.md, general-review, general-review/references/risk-buckets.md, graham-code-review, pr-checklist, lib/mocker/src/replay/online/AGENTS.md, lib/router-plugins/builtin/AGENTS.md, lib/router/slot-tracker/AGENTS.md, lib/llm/src/kv_router/AGENTS.md, lib/router/kv-router/AGENTS.md, lib/router/scheduler/AGENTS.md, docs/fern/pages/AGENTS.md, docs/fern/AGENTS.md, lib/bench/AGENTS.md, lib/llm/AGENTS.md, AGENTS.md
The author's agent picks up this feedback next.
| // The paired pool may have room for a request held only on it. Those lanes are | ||
| // blocked on capacity, so recheck every capacity-blocked lane. | ||
| open = PairedPoolGate::changed(&mut self.paired_pool.room_changed), | ||
| if paired_room_changed => { | ||
| if !open { | ||
| self.paired_pool.close_room_changed(); | ||
| } | ||
| self.handle_update(None, Some(RecheckScope::Capacity)).await; | ||
| continue; | ||
| } |
There was a problem hiding this comment.
[TEST] No test for a lane-blocked head released by the room signal (AI review, round 3)
The merge turned the room wake into handle_update(None, Some(RecheckScope::Capacity)). That scope is now what releases a head held on decode room in a worker lane. A request pinned to a prefill worker (hard session affinity or an explicit pin) is filed in blocked_lanes as Blocked(Capacity) and is asked again only when a recheck covers it.
All four paired-pool tests enqueue unpinned, session-less requests. Those sit in the shared heap, which is re-asked on every drain, so the tests would also pass with None here. With None, a pinned request would wait for an unrelated full recheck: its own worker freeing, a cleanup drain, or the periodic queue update.
Fix: add a case to paired_pool_holds_until_its_room_signal_releases_the_request with pinned_worker: Some(..).
The SharedCapacity arm at line 2850 is also untested, and no in-tree host reaches it: the prefill hop runs no classifier, so an unconstrained head has no lane key and is always in the shared heap.
| if admitted_upstream { | ||
| let context = AdmissionContext { | ||
| class_index, | ||
| due_at: None, | ||
| attempt_tx, | ||
| lifecycle_transfer, | ||
| }; | ||
| return self.admit_one(context, request, decay_now, prepared) == Admission::Booked; | ||
| } |
There was a problem hiding this comment.
[DESIGN] Admitted-upstream decode legs skip the dispatch gate main added (AI review, round 3)
Main's #18443, merged into this branch since round 2, asks an installed DispatchGate about every queued head in drain_ready. This early return books a decode leg with staged KV before it is queued, so the decode router's gate gets neither check nor dispatched for it. Its holds and its Go target are skipped.
When: every remote-prefill request in KV-routed disaggregated serving, when the decode set's classifier returns a gate. On the base branch the gate held these legs.
Cost: a gate policy silently stops holding in disaggregated serving. Nothing leaks: the classifier still sees the request at Sent, and ThunderAgent commits it there as it does for a never-queue class.
Not holding fits this PR, since a hold would strand the prefill's KV. But nothing says so:
- The doc on
install_dispatch_gatenames the zero-queue-limit class as the only request admitted without asking the gate. custom-admission-control.md:299says Dynamo asks the gate about each queue head before it dispatches.- The disaggregated bullet at
configuration-and-tuning.md:349lists only class limits and deadlines.
Fix: state the exception in those three places and in the admitted_upstream doc comments. Add a queue test with a gate installed, where an admitted-upstream request books while the gate answers Hold. If a gate must be able to hold disaggregated requests, it has to be asked at the prefill hop, which runs no classifier today; say which you intend.
| let admission = match admission { | ||
| FindBestMatchAdmission::WithAdmission | ||
| if phase == RequestPhase::Decode && staged_kv == StagedKv::Present => | ||
| { | ||
| FindBestMatchAdmission::AdmittedUpstream | ||
| } | ||
| admission => admission, | ||
| }; |
There was a problem hiding this comment.
[NIT] PR description no longer describes the code at this head (AI review, round 3)
The description is stale in two ways.
Behavior. It says the decode queue "books every RequestPhase::Decode request at once", that RoutingHost books every decode-phase request as AdmittedUpstream, and that no class limit applies to a conditional-disagg bypass. Since the round-1 fix, only a decode leg with staged KV books directly (this match), and a bypass keeps the full class gate at the decode router. The docs page and the end-to-end test already say that.
Paths and validation. It names lib/kv-router and reports cargo test -p dynamo-kv-router --lib --features standalone-selection on main 73014901d4. After the crate split the code is in lib/router/scheduler and lib/router/slot-tracker, and the queue tests run under dynamo-scheduler.
Fix: update the Decode queue bullet, the lib/llm bullet, the bypass known limit, the crate names and the validation commands. Add the dispatch-gate behavior to the known limits.
ishandhanani
left a comment
There was a problem hiding this comment.
Round 3 AI perf review · 3 PERF
Automated performance review, round 3. Every finding is posted, NITs included; findings may be wrong, so reply on a thread to dispute one.
This turn looked only at cost. For aggregated serving the change adds two branches per head check and a small fill per pass, which the code settles as negligible, and I found no removable clones. The disaggregated path has three costs on the prefill admission actor: once subscribed it wakes and re-asks every capacity-blocked lane on every decode release, it re-walks every decode rank per arrival while held, and that walk probes a SipHash set per rank. Nothing was measured: no existing bench installs a paired pool and the PR's own queue-gate numbers predate the merges, so each finding names the case that would settle it.
Read: dynamo-perf-best-practices, dynamo-clone-hotpath-audit, dynamo-frontend-benchmark, lib/router-plugins/builtin/AGENTS.md, lib/router/slot-tracker/AGENTS.md, lib/llm/src/kv_router/AGENTS.md, lib/router/kv-router/AGENTS.md, lib/router/scheduler/AGENTS.md
The author's agent picks up this feedback next.
| // The paired pool may have room for a request held only on it. Those lanes are | ||
| // blocked on capacity, so recheck every capacity-blocked lane. | ||
| open = PairedPoolGate::changed(&mut self.paired_pool.room_changed), | ||
| if paired_room_changed => { | ||
| if !open { | ||
| self.paired_pool.close_room_changed(); | ||
| } | ||
| self.handle_update(None, Some(RecheckScope::Capacity)).await; | ||
| continue; | ||
| } |
There was a problem hiding this comment.
[PERF] Prefill actor wakes and sweeps blocked lanes on every decode release (AI perf review, round 3)
Once any request of a class with decode_busy_threshold_frac has consulted the pool, has_room keeps the watch::Receiver for the life of the actor (line 1062). This branch then fires on every decode-side change, whether or not a head is held on decode room.
What fires it: every decode release (capacity_changed, direct_release, drain_cleanup), every prefill completion that released prompt load, every remote-state change from a peer router (bookings included), and every config tick.
Cost per event against base:
- Sender, on the request task:
send_replacetakes the watch's write lock and callsnotify_waiterson its 8Notifys. Base paid nothing for a paired queue. - Prefill admission actor: one extra turn (
expire_due_classes,drain_into,drain_ready, the select futures rebuilt). With nothing queued, that is a no-op turn per decode release. - With a backlog,
RecheckScope::Capacitysetsrecheck.capacityon every class, so the next dispatch re-asks every capacity-blocked lane. That includes lanes blocked on their own prefill worker and classes with no decode limit. On base a worker free re-asks only the lanes waiting on that worker (feat(router): dispatch gate and session lanes; ThunderAgent on the gate #18443). With hard session affinity that is up to one lane per prefill rank per decode release: at about 1,000 blocked lanes and 1,000 releases a second, about a million lane checks a second on the one actor.
Fix: keep the subscription only while a head is held on the pool. Record in PairedPoolGate that has_room returned false. When a wake or a pass finds nothing held, set room_changed = None, so receiver_count() is 0 and this branch is off. has_room already re-subscribes before its next read, so no wake is missed.
Not measured: the benches run caller and actor on one thread and install no paired pool. A multi-thread run that frees decode bookings while the prefill queue holds about 1,000 pinned lanes on their own limit would settle the size; report admission latency and actor CPU.
| fn begin_pass(&mut self) { | ||
| self.pass_room.fill(None); | ||
| } |
There was a problem hiding this comment.
[PERF] Held pool verdict re-walks every decode rank on each arrival (AI perf review, round 3)
begin_pass clears the pool's answer at the start of every pass, and every Enqueue runs a pass (handle_enqueued → drain_ready). While the decode pool is past a class limit, each arriving request walks every decode rank again under the decode load table's read guard and still gets false.
A false answer cannot change without a RoomChanged signal: releases, peer state and config changes all fire it, and new bookings only add load. So in the held state the walk is repeated work.
Cost: O(decode ranks) per arrival on the prefill admission actor, in exactly the overload state. On base the prefill hop's pass stops at its first rank with room. At 4,096 decode ranks that is 4,096 snapshot copies and set probes per arriving request.
Fix: keep a Some(false) across passes. Clear it in the room-changed branch and on a full drain (Drain::Full), which also covers an availability change that fires no signal. Keep re-reading a true answer: bookings fire no signal, and that read stops at the first rank with room.
Not measured. A selection_core queue-gate case with a paired pool of 4,096 ranks at the limit would show the per-admission cost.
| let lora_candidates_are_ours = request.lora_name.is_none() | ||
| || (request.pinned_worker.is_none() && request.allowed_worker_ids.is_none()); | ||
| let available = if lora_candidates_are_ours { | ||
| (self.available_workers)(request) | ||
| } else { | ||
| self.client.available_instance_ids() | ||
| }; | ||
| self.selection | ||
| .scheduler() | ||
| .any_rank_has_room(limits, available.as_deref()) |
There was a problem hiding this comment.
[PERF] Decode-pool read probes a SipHash set once per rank (AI perf review, round 3)
has_room_for_prefill_request hands any_rank_has_room the provider's HashSet<WorkerId>, which hashes with SipHash, and the closure probes it once per decode rank (lib/router/scheduler/src/local.rs:577). lib/router/scheduler/AGENTS.md rules that out for a loop over ranks. #18008 added AvailableWorkerIds so the queue probes an Fx set converted once per source Arc; this path bypasses it.
Two more costs in the same walk:
PromptRegistry::any_rank_has_roomgoes throughiter_indexed, which copies each rank's snapshot beforeeligibleis asked. A request whose eligible set is a few workers still copies and probes every rank ahead of them.- For a LoRA request the provider runs
refresh_admission, which builds aVecand aHashSetover the decode workers.PairedPoolGate::has_roomdoes not cache LoRA answers, so that runs per LoRA head per check, on the prefill actor.
When: every pool read that does not stop at the first rank, which means a pool at or near the class limit, or a narrow eligible set. There is one read per class per pass, and one per LoRA head.
Cost: roughly 20 ns of hashing per rank by my estimate, so about 80 µs per walk at 4,096 ranks, plus an O(decode workers) allocation per LoRA head.
Fix: resolve the set through the decode scheduler's own AvailableWorkerIds, for example by taking the request in LocalScheduler::any_rank_has_room. Test eligible on the rank id before reading its load. For LoRA, cache the answer per class and adapter within a pass.
Not measured; the same selection_core paired-pool case at 4,096 ranks would settle it.
Summary
#16618 added a per-class decode limit,
policy_classes[].decode_busy_threshold_frac, to the policy-class queue. It works in aggregated serving. In disaggregated serving it is wrong:This PR makes the prefill queue the only admission gate in disaggregated KV routing. The decode queue holds nothing.
RoomChangedsignal wakes the prefill queue.RequestPhase::Decoderequest at once, with no class wait and no deadline. Router-wide reject thresholds, such as--active-decode-blocks-threshold, still apply at worker selection.The
BusyThresholds::has_roomdecode check from #16618 and the reject path do not change.Code changes:
lib/kv-router: adds aPairedPoolRoomhook that a host installs withset_paired_pool. Only classes that setdecode_busy_threshold_fracuse it.LocalScheduler::any_rank_has_roomreads booked load. An in-processadmitted_upstreamflag tells the queue to book a request directly. Wire types do not change.lib/llm: the frontend installs the decodeRoutingHoston thePrefillRouterfor all KV routing, not only for conditional disagg. Each prefill KV router gets aDecodePoolRoomthat points to the decode router.RoutingHostbooks every decode-phase request asAdmittedUpstream. Only the prefill router sets the decode phase, so aggregated requests keep the full class gate.Known limits:
decode_busy_thresholdin--router-conditional-disagg-config.Part of #16543
Validation
Run on main
73014901d4:cargo fmt --all --check: pass.cargo clippy -p dynamo-kv-router -p dynamo-llm --all-targets -- -D warnings: pass.cargo test -p dynamo-kv-router --lib --features standalone-selection: 1433 passed, 0 failed, 3 ignored.cargo test -p dynamo-llm --lib kv_router::: 492 passed, 0 failed.cd lib/bindings/python && cargo check: pass.pre-commit run --files <changed files>: pass.python3 docs/fern/scripts/docs_lint.py <changed page>: 0 errors.New tests:
disagg_decode_wait_limit_gates_the_prefill_hop_and_never_the_decode_hop: uses two real KV hosts with one policy file. Decode requests book past the decode limit with no wait. A new request waits at the prefill hop while decode is full, and freed decode KV releases it.paired_pool_holds_until_its_room_signal_releases_the_request,paired_pool_rejects_a_never_queue_class_like_its_own_workers,paired_pool_is_ignored_by_classes_without_a_decode_limit: queue behavior with the hook.admitted_upstream_skips_class_limits_but_not_reject_thresholds: a direct booking skips class limits and deadlines, but reject thresholds still apply.pool_room_reads_booked_decode_blocks_and_signals_releases: the load read and the room signal.kv_decode_host_resolves_the_decode_pool_without_conditional_disagg.Performance: before the rebase, the aggregated queue-gate benchmark (
selection_coreno_hints_queue_gate) showed no regression at 64, 512, and 4096 workers. I did not run it again after the rebase.Waiting on the author
The PR factory stopped at
f87118f: the author's agent stopped before it finished.Kept up to date by the PR factory. An item goes when it is answered; this section goes when nothing is waiting.