Skip to content

[sgl-router] policies_reorg: build pools from ModelConfig - #40273

Closed
sherlockwu wants to merge 1 commit into
router/policies-reorg-2-loadfrom
router/policies-reorg-3-factory
Closed

sherlockwu wants to merge 1 commit into
router/policies-reorg-2-loadfrom
router/policies-reorg-3-factory

Conversation

@sherlockwu

@sherlockwu sherlockwu commented Sep 19, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

Third PR of the engine-selection redesign, on top of #40271. Connects configuration to the new resolver: each bucket gets its own policy instance and admission, and a bucket can override the model's --policy.

Modifications

  • policies_reorg/factory.rs: build_pools(&ModelConfig) builds the prefill pool (also used for plain requests) and the decode pool. Buckets come from the bucket JSON; a stage without buckets gets one implicit catch-all bucket running the model policy (decode: power-of-two). Unsupported kinds (fused_score, score_policy, legacy_host_affinity, and the affinity/cache kinds until their PRs) are rejected at build time.
  • Migrated admission is explicit: Capacity for power-of-two, session-aware and cache-aware kinds; the bucket's max_pending_prefill_tokens as a per-bucket PendingPrefill check; --filter overloaded with --max-in-flight as InFlightLimit. Since each bucket has its own policy instance, the pending-prefill budget is one number, not a per-engine map.
  • config::BucketSpec.policy: Option<PolicyKind> (serde default, snake_case) is the per-bucket override. Existing literals gain policy: None.
  • buckets_reorg::Pools is now { prefill, decode } instead of an enum: whether a deployment is PD is only known from discovered worker modes, and the design says prefill buckets also apply to plain requests. Pools::plain builds one with an empty decode pool.
  • admission::PendingPrefill added.

Checklist

  • cargo clippy --locked --workspace --all-targets -- -D warnings clean
  • cargo test --lib policies_reorg (5), cargo test --test component policies_reorg (6), plus the legacy config and proxy bucket tests pass

🤖 Generated with Claude Code


CI States

Latest PR Test (Base): ✅ Run #35410111714
Latest PR Test (Extra): ❌ Run #35410111580
Latest PR Test (AMD ROCm 10): ➖ No AMD PR run found for this commit.

factory::build_pools turns the model's policy, decode policy and bucket JSON
into prefill and decode pools with one policy instance per bucket. A bucket
may override the model policy via a new optional `policy` field. Migrated
admission stays explicit: capacity for power-of-two style kinds, the
bucket's pending-prefill budget, and the --filter overloaded in-flight limit.
Pools becomes a struct because PD versus plain is only known from discovered
worker modes; the prefill pool also serves plain requests.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@sherlockwu

Copy link
Copy Markdown
Collaborator Author

Closing: the series stops at the power-of-two PR (#40271) for now.

@sherlockwu sherlockwu closed this Sep 19, 2026
@sherlockwu
sherlockwu deleted the router/policies-reorg-3-factory branch September 19, 2026 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant