Repository navigation
fix(serving): on a discrete GPU the board credits serving with what its engine holds on the device, not the host process's RSS (card 741f5eec) - #4850
Conversation
…ts engine holds on the device, not the host process's RSS (card 741f5eec) Measured on the 5090, 2026-10-07 (BigMama). Kimi's served window flapped between 33,024 and 69,724 every few seconds while the plan's branch never changed: usable bytes alternated between two exact values, 1.40 GiB apart, the board's live serving budget swinging 1.75 GiB. Twelve board reads with her full engine resident showed measured 0 and externalBytes = physicalUsedBytes, 31.3 GB. The board had never credited her engine with a byte. The cause: ServingConsumer's physical credit read the lane process's host memory (anon_footprint_of + model_file_bytes_of). On a discrete card that is the wrong quantity, since the engine's real holding is VRAM and no RSS contains it. On Windows both reads are the not-macos-not-linux arm and return None. So serving's replace-myself budget (available + measured_by(serving)) was just free VRAM, and any external churn, a dead process's allocations releasing in steps, swung her window 2x. A relaunch sized before the old memory released saw almost nothing; that is Fable's half, card fb58db2e, which now reads a board that knows its own engine. - EngineDeviceCredit (serving_consumer.rs): on a discrete GPU, the credit is what the ENGINE reports holding on the device, from /props: model_weight_buffers on the accelerator plus memory_breakdown's KV and compute buffers, both already parsed by weight_residency. That is attribution-correct where a device delta is not: a delta would credit a game started after spawn. - A reading counts only for the engine it was read from (pid match): a pre-relaunch reading is never the successor's, the gap is 0, and an unreadable /props is no credit. On a discrete card it never falls back to the host read, which would credit the wrong memory. Unified memory and CPU placement keep the host read unchanged. - The serving daemon refreshes it every tick (5 s), ahead of the once-a-minute per-token sample and unconditionally, because the engine's holding is serving's own even while other work lives in it, and a once-a-minute credit would read a fresh relaunch as nobody's for a minute. One local /props call per tick. Probe serving.credit.engine_device, on change only. Test: a_discrete_engine_is_credited_its_own_device_holding_and_nothing_else (credit for the engine it was read from; nothing for a previous engine, the gap or an unread /props; the host read only off a discrete card). Not compiled on IntelMac (its CPU serves residents); CI builds and tests, windows-msvc included. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
|
Reviewed. Approve (as a comment: shared account). The shape is right: on a discrete card the credit is the engine's own device accounting, credited only to the pid it was read from, with 0 in the gap and never host RSS in its place, and the pure Set the post-deploy expectation correctly, though. Kimi's engine on the 5090 reports, right now (
The board reads Non-blocking:
|
…re-homes; a climb still coalesces 2026-10-07, the 5090: after Kimi's engine crash her lane relaunched at 2,304 (sized while the dying engine still held VRAM) and served there, ready, for an hour. The plan alternated 33k/70k (the board's budget toggled; #4850 fixes the credit), and the re-home streak reset on every rise (plan_flat = plan <= previous tick's plan), so a lane far below BOTH plan values never reached the 3 sustained ticks. Kimi, needing 52k, could not fit. The rule plan_flat existed for the boot staircase (2026-09-02: a re-home per stair was 16 model loads). It now resets only on a NEW HIGH for the current streak: a climb still coalesces into one relaunch at its top, and a plan moving below a high it already reached keeps counting. Every streak reset clears the high with it (reset_rehome_streak), so a stale peak cannot make a later climb read as flat. Tests (one mod, beside the jitter test): a_lane_far_below_an_alternating_plan_re_homes (fails on canary: never fires) and a_climbing_plan_coalesces_into_one_re_home_at_its_top (the staircase guard had no test). All 94 serving_daemon tests pass. Card fb58db2e (convergence half; sizing a relaunch after the predecessor's memory releases is the other half). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…re-homes; a climb still coalesces (#4851) * fix(serving): a lane far below a plan that alternates under its high re-homes; a climb still coalesces 2026-10-07, the 5090: after Kimi's engine crash her lane relaunched at 2,304 (sized while the dying engine still held VRAM) and served there, ready, for an hour. The plan alternated 33k/70k (the board's budget toggled; #4850 fixes the credit), and the re-home streak reset on every rise (plan_flat = plan <= previous tick's plan), so a lane far below BOTH plan values never reached the 3 sustained ticks. Kimi, needing 52k, could not fit. The rule plan_flat existed for the boot staircase (2026-09-02: a re-home per stair was 16 model loads). It now resets only on a NEW HIGH for the current streak: a climb still coalesces into one relaunch at its top, and a plan moving below a high it already reached keeps counting. Every streak reset clears the high with it (reset_rehome_streak), so a stale peak cannot make a later climb read as flat. Tests (one mod, beside the jitter test): a_lane_far_below_an_alternating_plan_re_homes (fails on canary: never fires) and a_climbing_plan_coalesces_into_one_re_home_at_its_top (the staircase guard had no test). All 94 serving_daemon tests pass. Card fb58db2e (convergence half; sizing a relaunch after the predecessor's memory releases is the other half). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(serving): fire the re-home only on a tick whose plan is the streak's high (BigMama on #4851) A re-home relaunches at the fire tick's plan; on an alternating plan a low tick would land the lane at the low value (33k, under Kimi's 52k) and owe a second relaunch, while launching the remembered high would use a budget the tick did not plan. The high tick is both. The alternation test now asserts the landing tick is a high one. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Measured on the 5090, 2026-10-07 (BigMama). Kimi's served window flapped between
33,024 and 69,724 every few seconds while the plan's branch never changed: usable
bytes alternated between two exact values, 1.40 GiB apart, the board's live serving
budget swinging 1.75 GiB. Twelve board reads with her full engine resident showed
measured 0 and externalBytes = physicalUsedBytes, 31.3 GB. The board had never
credited her engine with a byte.
The cause: ServingConsumer's physical credit read the lane process's host memory
(anon_footprint_of + model_file_bytes_of). On a discrete card that is the wrong
quantity, since the engine's real holding is VRAM and no RSS contains it. On Windows
both reads are the not-macos-not-linux arm and return None. So serving's
replace-myself budget (available + measured_by(serving)) was just free VRAM, and any
external churn, a dead process's allocations releasing in steps, swung her window
2x. A relaunch sized before the old memory released saw almost nothing; that is
Fable's half, card fb58db2e, which now reads a board that knows its own engine.
ENGINE reports holding on the device, from /props: model_weight_buffers on the
accelerator plus memory_breakdown's KV and compute buffers, both already parsed by
weight_residency. That is attribution-correct where a device delta is not: a delta
would credit a game started after spawn.
reading is never the successor's, the gap is 0, and an unreadable /props is no
credit. On a discrete card it never falls back to the host read, which would credit
the wrong memory. Unified memory and CPU placement keep the host read unchanged.
per-token sample and unconditionally, because the engine's holding is serving's own
even while other work lives in it, and a once-a-minute credit would read a fresh
relaunch as nobody's for a minute. One local /props call per tick. Probe
serving.credit.engine_device, on change only.
Test: a_discrete_engine_is_credited_its_own_device_holding_and_nothing_else (credit
for the engine it was read from; nothing for a previous engine, the gap or an
unread /props; the host read only off a discrete card). Not compiled on IntelMac
(its CPU serves residents); CI builds and tests, windows-msvc included.
Co-Authored-By: Claude Opus 5.5 (1M context) [email protected]
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE