Repository navigation
A page switch never stalls the other minds' decode: dyno 11b, the kv_page probe reads the engine's copy and IO apart, engine pin to fork #118 - #6002
Open
joelteply wants to merge 4 commits into
Conversation
…de; the kv_page probe reads the engine's copy and IO apart The pinned fork runs a page save or restore, disk IO included, as one task on its single task loop: every other slot's decode waits for it, and switches issued together wait for each other (the M5 2026-11-14 00:18:13Z: Benchy's restore waited 1,024 ms behind Aris's 1,012 ms). Dyno 11b models the switch on the loop vs streamed (the loop copies the state in or out, the files move on a worker), from the restart day's receipts plus the M5's host memcpy (40,558,095 B/ms, measured 2026-11-14T07:24:45Z): - four residents' saves at once: decode stall 13,547 ms -> 204 ms; last receipt 13,547 ms -> 5,021 ms - the Aris/Benchy restore pair: Benchy's receipt 1,917 ms -> 1,026 ms; decode stall 1,917 ms -> 70 ms The kv_page.action probe reads the engine's receipt through one owner (EngineWork, in page_receipt.rs) and adds copy_ms (the engine loop's share, what other slots wait for) and io_ms (its IO worker's), "none" from an engine without them (fork PR #118). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…bytes_in_flight (fork #118 review) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
… with the in-flight byte budget Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
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.
How this serves the minds: a mind's page save or restore no longer freezes every other resident's decode, and two minds returning at once each wait only for their own page. This is path step 1, "Fast", and order-of-work line 3b (one live engine, its minds' memory moved by us; graphics-engine model: async resource streaming, where the render thread never blocks on IO).
Measured (the problem)
The pinned fork runs every KV page save and restore, disk IO included, as one task on its single task loop (
tools/server/server-queue.cpp:138-153; save atserver-context.cpp~2809/2960, restore ~2996/3076 on cd2e16d87). Receipt: two restores the core issued together on the M5 at 2026-11-14 00:18:13Z. Benchy waited 1,024 ms, which is exactly Aris's 1,012 ms restore in the engine (fixtures/dyno/2026-11-13-restart.jsonengine_page_lanes).Dyno 11b (
core/continuum-engine/src/capacity/dyno/restart/stall.rs): before and afterThe rates come from the restart day's receipts (save 603,433 B/ms, restore 1,464,377 B/ms, 32,273 B/token). The host copy rate is new: 40,558,095 B/ms, a memcpy measured on this M5 (Apple M5 Pro) at 2026-11-14T07:24:45Z while it served. The engine's
copy_msreceipt replaces it after deploy.Assumption, not measured: concurrent streams each keep their measured single-stream disk rate. The per-stream rates are 0.6 to 1.5 GB/s, under the SSD's, but the aggregate is unmeasured, and
io_mson the live node settles it.Change
switches_at_once(&[Switch], PageIo::{OnTheLoop, Streamed}), plus three tests. Four saves stall decode for their copies, not their writes. Two restores issued together each wait only for their own read. No receipt arrives before its own IO. The fixture gainshost_copy_bytes_per_mswith its receipt.inference.kv_page.actionreads the engine's receipt through one owner,page_receipt::EngineWork. That replaces the three inline field reads inturn_admission.rs, andengine_fieldsis now private to it. The probe addscopy_ms(the engine loop's share, which is what other slots wait for) andio_ms(its IO worker's). Both read "none" from an older engine. One pinned test covers this.core/vendor/llama.cppandcore/vendor/LLAMA_CPP_PINmove together to the merge of server: a KV page's file IO runs on a worker; the task loop only copies the state in or out llama.cpp#118 oncodex/s4-per-mind-integration. The HTTP contract and the page files are unchanged, so pages on disk still restore. A restore whose slot was given another task while it read now gets a typed 400 ("refusal": "slot_reassigned"). The core already treats it asTerminal::Rejected, which leads to a cold prefill, and the occupant's KV is kept.Follow-up: the page IO byte budget (owner: Fable, with #6011's owner)
Fork #118 now admits every in-flight page switch's host bytes against one runtime budget (
POST /page-io/budget,GET /page-io). Until the core sets it, it is 0, meaning one switch at a time: still off the engine loop, but the overlap that dyno 11b predicts for saves needs room. The owner of the live host room (#6011,live_pool) sets it as one more holder of that room. The probe already reportsadmit_msandio_bytes_in_flight.Follow-up: the stage contract (owner: Fable)
Page save/restore completion moves onto the minimal stage contract once it merges (branch
fable/prefill-during-the-tool:RuntimeModulewith typed produces andArtifactSelectorsubscriptions). A page's completion becomes an artifact that other stages (admission, the prefill stage) subscribe to, with no per-feature channel. This PR deliberately keeps the core change to the probes and the pin.Measured after deploy (open)
The check is
inference.kv_page.actioncopy_ms/io_mson the M5, plus the decode of resident slots during a stop checkpoint and a restore pair. Owner: Fable, due on the first deploy carrying this pin.🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo