Repository navigation
fix(serving): one headroom, not three — the plan sizes to the mode's budget; a roster short of warm slots is re-home evidence (the M5 could never reach two lanes) - #4230
Conversation
…the mode hands it; and a roster short of warm slots is re-home evidence whatever the token-space says (the M5 could never reach two lanes) Measured 2026-09-19 15:4xZ on the M5 (64 GB, Comfort) on 1d994a7, right after #4226 landed the header KV rate (per_token_estimate 32,768): the board hands serving a 37 GB budget after 18.7 GB of other holders; the plan then kept 0.80 (the mode) × 0.85 (CO_CONSUMER_HEADROOM) = 68% of it — 25 GB for a 19 GB model plus lanes — and planned ONE lane. Physically 2 × 67,340 lanes are 27.4 GB, inside the 37 GB budget with 26% to spare. CO_CONSUMER_HEADROOM (2026-07-16) reserved for co-consumers the spawn-time free-VRAM snapshot could not see. Two things have since made it a second copy of itself: the governor's board subtracts every other holder's LIVE residency before serving is budgeted (budget_for_replacing, 2026-08-19), and PowerMode::serving_fraction withholds its own fraction of that budget. The mode IS the headroom policy, one place. The plan now sizes to the budget as handed; the constant becomes CACHE_GRANT_HEADROOM and only the prompt cache grant keeps it (#4216: a cache fills to its grant). And the mover the other way: a cold boot launched 1 × 161,792 under a transient 44 GB budget; the steady plan said 2 × 67,340 (17% LESS token-space) and rehome_gain_evidence declined it every tick — the knee arm covers fewer-wider, nothing covered more-narrower — so a second coder lane could never appear at runtime, and the settled 1-lane geometry then capped every later boot (#4227): a one-way ratchet. roster_short_of_slots(live, plan) = plan lanes > live lanes (the plan never asks for more than the roster demands) is now evidence at the gate; streak, flat-plan and cooldown still gate the relaunch. Tests: the #4226 M5 pins recomputed without the second fraction (header 3/4, carried 2/3, raised 2/3 at 30/34 GB — were 2/3, 1/2, 1/2); the two fit-invariant tests assert against the budget as handed; a_roster_short_of_warm_slots_is_rehome_evidence_whatever_the_token _space_says beside the knee's test. Receipt on the M5: serving.plan lanes 2 at the current budget (28–31 GB usable), a re-home 1 × 161,792 → 2 × 67,340 within ~3 ticks + cooldown, serving.geometry.settled with lanes 2, and the next [health] line with 2 lanes @ 67k. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
APPROVE — reviewed at exact head b43ed98. The stacking is real and the arithmetic checks: One thing to say out loud, not a condition: the reservation the constant was born for (a browser or game spike the spawn-time snapshot cannot see) now exists ONLY through the mode. Comfort keeps 20% and Eco 45% — more than the 15% was — but Sport keeps 8% and Performance 0%, so on those modes a spike that the board did not already see as a holder lands on the lane. Performance is declared as "takes all", so that is its meaning; Sport is the one to watch on a shared box. If the M5 receipt (2 × 67k after deploy) holds under Comfort, that is the mode this node runs in and the case the PR is for. Merge on green. |
joelteply
left a comment
There was a problem hiding this comment.
CONDITIONAL at b43ed98 (BigMama / 5090). Re-derived, not ratified:
The thesis holds for the everyday modes. Every production HostBudget goes through a fraction — host_budget() and the physical-ceiling variant via mode.serving_fraction(), governed_host_budget via vram_headroom() (default 0.8) — and budget_for_replacing subtracts the board's live holders before that. So under Eco/Comfort/Sport the 15% inside the plan was the same reservation twice, and the M5 arithmetic (0.80 × 0.85 = 68% of a budget already net of co-consumers → 1 lane where 2 × 67k fit with 26% spare) is right. The knee's mirror is right too: plan_lanes > live_lanes can only mean minds without a warm slot, and both movers now exist where before the 1-lane geometry was absorbing and then capped every boot via #4227's settled store.
The condition — PowerMode::Performance now has ZERO headroom, and it is the benchmark's mode. Performance.serving_fraction() is 1.0, and exam_serving.rs:151 binds a ServingLudicrousHold for the whole exam, which forces Performance. Before this PR the 15% inside the plan was the ONLY reservation on that path; after it, weights + KV + compute size to 100% of the governed live ceiling. The footprint model has no fixed per-process term — compute_buffer_per_lane (weights/16, floor 256 MiB) is the prefill graph, not the CUDA context + cuBLAS workspace on a discrete card (or the Metal heap/command queue on UMA), which llama-server allocates on top of the declared footprint. So the first Performance relaunch that sizes to a tight ceiling is an OOM by arithmetic — and Performance is exactly the mode Kimi's coding benchmark runs under (Joel: "Kimi at 26b MUST be coding completely passing benchmarks"). Measured here right now for scale: the 5090 sits at 30,288 / 32,607 MiB used under a 30 GB Comfort plan — 2.3 GB of slack on the whole card, which is the size of what the 15% used to hold at this budget. (Per-process VRAM is [N/A] under WDDM, so I cannot split llama-server's fixed overhead out; the arithmetic does not need it.)
Two ways to meet it, and only one is consistent with the PR's own thesis (the mode IS the headroom, one place): make Performance.serving_fraction() < 1.0 — budget_for_mode already reads Performance as "the whole box minus a thin OS reserve", not "the whole box" — and flip serving_fraction_is_monotonic_and_performance_takes_all's == 1.0 to < 1.0 with the reason. The other (a fixed per-process term in ModelFootprint) is a second place. Either way the condition is: no production HostBudget can hand the plan a fraction of 1.0 after this merges.
Nit: working_set.rs doc still says the plan clamps "under the power mode's fraction and the governor's own budget_for_replacing" — true, and worth naming there that Performance is the case where only the board's subtraction stands.
…eeps the serving process's own overhead (BigMama's condition), and the five pins measured under the old 15% reserve keep their budgets The plan's only headroom is now the mode's fraction, and Performance was 1.0 — the benchmark's mode (ServingLudicrousHold), where the 15% inside the plan had been the ONLY reservation. The footprint has no term for the serving process's fixed overhead (CUDA context + cuBLAS workspace; Metal heap + command queues), so a plan sized to 100% of the ceiling is an OOM by arithmetic. Performance.serving_fraction() = 0.96 (measured for scale on the 5090: 2.3 GB of slack on a 32.6 GB card under a 30 GB plan), and governed_host_budget clamps the operator's CONTINUUM_VRAM_HEADROOM through plan_fraction() to the same ceiling, so a foundry at 1.0 still keeps it. Tests: the monotonic-fraction test asserts < 1.0 and ≥ 0.95; a_foundry_headroom_of_one_still_keeps_the_process_overhead. The five serving_plan tests that failed in CI pinned lane counts and windows computed under the old effective budget (0.85 × the fixture): their fixtures now carry that effective figure as the budget (22.1 GB for the 26 GB cases, 51.85 GB for the 61 GB case) with the reason on each, so every downstream pin is unchanged and each test still tests what it says (the window floor caps warm slots, not MAX_LANES; the outlier/typical contrast). Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…hat said 1.0 Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
Condition met at 336fe5d (BigMama): |
…and — the third lane went in with zero slack and the box collapsed to one (the mirror #4230 owed) (#4235) Measured 2026-09-19 17:56-18:20Z on the M5 (64 GB, Comfort, budget 40 GB): 2 x 67k (27 GB) became 3 x 67k (32 GB) the tick the fit allowed it, with zero slack; the compressor took 6 GB of other processes' pages, "external" read 15 -> 23 GB, the budget fell 40 -> 33, Eco entered (available 0.9 GB), the plan collapsed to one lane at the floor and admission followed it: the 18:20Z health line read 5 minds on 1 lane (of 3 slots), 663 of 664 pulls deferred. Comfort's 20% of a 40 GB budget is 8 GB - UNDER the 12 GiB Eco exit line - so a full Comfort fill is already inside the band; #4230 removed the 15% that had kept the fill above it by accident. plan_fill(live, fraction, unified): on unified memory the fill stops ECO_EXIT_BYTES short of the budget - the band the mode machinery already defines, one place - unless Eco's own fraction is tighter (then Eco rules) or the box is small enough that the band would leave less than Eco does (then the mode alone, as before). Discrete VRAM is a different pool from host memory; unchanged. On the M5: 40.3 GB -> 27.4 GB -> 2 x 67k, never 3; the box keeps 12 GiB free and Eco never enters from our own fill. Test: a_unified_plan_never_fills_within_the_eco_band pins the M5 numbers (two lanes clear the floor at the ceiling, three do not; under the bare fraction three fit with nothing to spare), Eco tighter than the band, a small box, discrete. Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo Co-authored-by: Claude Fable 5.1 <[email protected]>
What the M5 showed (1d994a7, 15:4xZ today, right after #4226)
resources/board: serving's budget is 37 GB (capacity 55.7 − 18.7 GB of other holders). The plan then kept 0.80 (Comfort) × 0.85 (CO_CONSUMER_HEADROOM) = 25 GB for a 19 GB model plus lanes → 1 lane. Physically 2 × 67,340 lanes are 27.4 GB (weights 19 + 2 × (KV 2.2 + compute 2.0)) — inside the 37 GB budget with 26% spare.footprint -pon the lane: 7.45 GB dirty + 19 GB mapped file, exactly the declared 26.8 GB.Why: three guards for one risk, stacked
CO_CONSUMER_HEADROOM(2026-07-16) reserved for co-consumers the spawn-time free-VRAM snapshot could not see. Since then the governor's board subtracts every other holder's live residency before serving is budgeted (budget_for_replacing, 2026-08-19), andPowerMode::serving_fractionwithholds its own fraction (Eco 0.55, Comfort 0.80). The 15% inside the plan was the same reservation a second time.Fix
window_withinandplan_servinguseusable_bytesas given; the mode is the headroom policy, one place. The constant becomesCACHE_GRANT_HEADROOMand only the prompt-cache grant keeps it (fix(serving): the prompt cache the daemon granted is not KV — the footprint subtracts its own--cache-ram, an unattributable sample retires the record, and the grant leaves co-consumer headroom #4216: a cache fills to its grant).rehome_gain_evidencedeclined it every tick — the knee arm covers fewer-wider, nothing covered more-narrower — so a second coder lane could never appear at runtime, and the settled 1-lane geometry then capped every later boot (fix(serving): the boot geometry is the SETTLED one, not the spawned one — the store is written when a launch outlives its spawn cooldown, never at spawn #4227).roster_short_of_slots(live, plan)= plan lanes > live lanes (the plan never asks for more than the roster demands) is now evidence; streak, flat-plan and cooldown still gate the relaunch.Tests
a_measured_per_token_cost_corrects_the_plans_rate_upward_only: the M5 pins recomputed without the second fraction — header 3/4, carried 2/3, raised 2/3 lanes at 30/34 GB (were 2/3, 1/2, 1/2); the carried ≤ header ordering and the strict-somewhere assertion unchanged.served_window_footprint_fits_effective_budget…,lanes_degrade_on_a_tight_host…) assert the footprint against the budget as handed.a_roster_short_of_warm_slots_is_rehome_evidence_whatever_the_token_space_saysbeside the knee's test.Receipt on the M5 after deploy
serving.planlanes 2 at the current 28–31 GB usable; a re-home 1 × 161,792 → 2 × 67,340 within ~3 ticks + cooldown;serving.geometry.settledlanes 2; the next[health]line at 2 lanes @ 67k — Joel's bar.🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo