Skip to content

An embedding is charged where it resides; a reclaiming grant ends the turn; a mind's children run below the engine - #5910

Closed
joelteply wants to merge 4 commits into
canaryfrom
fable/an-embedding-reserves-where-it-resides
Closed

joelteply wants to merge 4 commits into
canaryfrom
fable/an-embedding-reserves-where-it-resides

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Serves the residents' health on every kind of machine (Joel, 2026-11-10: "It depends on where it's resident... We just can't assume any specific machine"). Two commits.

1. An embedding is charged where it resides, and the lane's floor is what it embeds

  • LlamaCppBackend::context_pool decides where a context lives:
    • Device memory when llama offloads to a GPU (llama::supports_gpu_offload, new) and the backend offloads any layer.
    • Otherwise host memory, whatever the machine.
  • inference/embed_lane_memory.rs owns the lane's memory:
    • Each lease is charged to that pool.
    • The standing floor is re-stated at each lease, at the largest context the lane has embedded. The resolver's probe and calibration passes set it before any turn.
  • Deleted: EMBED_LANE_VRAM_BYTES (a fixed 1,792 MiB VRAM bound) and the resolver's reservation.
  • llamacpp_adapter.rs shrinks from 938 to 848 lines.

2. A turn whose grant is being reclaimed ends instead of waiting on the reclaim it blocks (fixes #5906)

Measured

  • Local tests: continuum-engine 1,527 passed on the live stack (serving-down window, 13:30Z).
  • Live: deployed on the M5 at 13:32:50Z (d613517). The 15-minute read, including Aris's acts, follows in a comment.

Not here

  • Residence tiers (device, host, flash: mmapped weights, KV pages on disk, streamed experts) as one accounting, and the VRAM board double count on shared memory. Proposed to Codex; it feeds the serving plan.
  • The per-token rate from the fork: card 9bddda93.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

joelteply and others added 2 commits November 10, 2026 07:25
…or is what it embeds

Joel, 2026-11-10: "It depends on where it's resident... We just can't assume any specific
machine." The embed lane leased VRAM on every node, even for a context in host memory (a backend
offloading no layer, or a build with no GPU), and its standing floor was a fixed 1,792 MiB VRAM
bound reserved by the resolver, which knows neither the context's residence nor her texts.

- LlamaCppBackend::context_pool: device memory when llama offloads to a GPU
  (llama::supports_gpu_offload) and the backend offloads any layer, else host memory.
- inference/embed_lane_memory.rs owns the lane's memory: each lease in that pool, and the floor
  re-stated at each lease at the largest context the lane has embedded (the resolver's probe
  and calibration passes set it first). EMBED_LANE_VRAM_BYTES and the resolver's reservation are
  deleted; the lease code leaves llamacpp_adapter.rs (938 -> 848 lines).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…reclaim it blocks

The reclaim of a mind's grant takes her turn lock (MindTurn::reclaim), so a turn that waits for
the reclaim inside itself waits on itself: on the M5 (d0abbdd, 2026-11-10) Aris parked to the
1,500 s tick deadline five times and acted 3 times in 132 minutes. Reclaiming refuses again (her
turn ends, the reclaim proceeds, she is regranted); queued and an engine relaunching still wait.
Each wait now probes its reason (delib.window.waiting), which the loop had dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…es idle cores and yields

On the M5 (2026-11-10) a resident's `cargo test` of the whole workspace ran at the engine's own
priority beside serving: load 36, 4.5 GB swapped, decode at 3.4 tokens/s against 56 at rest, and
the residents' acts fell from 39 to 10 per 15 minutes. Her build is never refused or capped for
it; it is scheduled like an OS background job.

- continuum-host process_class: Unix (macOS, Linux) lowers the child to the OS's lowest ordinary
  priority (PRIO_MAX), which still runs on every idle core; Windows gives it
  IDLE_PRIORITY_CLASS; elsewhere the parent's class.
- The kernel's command_for, the one way a caller's child is spawned, applies it to every child,
  confined or not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply joelteply changed the title An embedding is charged where it resides; a reclaiming grant ends the turn instead of deadlocking it An embedding is charged where it resides; a reclaiming grant ends the turn; a mind's children run below the engine Nov 10, 2026
@joelteply

Copy link
Copy Markdown
Contributor Author

Third commit: a mind's children run below the engine that serves her (continuum-host process_class, applied in the kernel's command_for). On Unix that's the OS's lowest ordinary priority; on Windows, the idle class. Measured before: a resident's full-workspace test run at the engine's priority pushed load to 36, swapped 4.5 GB, and dropped decode to 3.4 tokens/s (56 at rest). Tests: continuum-host 17 passed (including a child reporting a lower priority than its parent) and continuum-kernel 1,403 passed. Live on the M5 as caf627c. This is the interim contention fix; the full design is card 13c81ced.

…th a floor per pool

Codex on #5910: one context's bytes are in two pools (KV and device compute on the device; the
CPU's compute share and the output buffer on the host), a configured placement is not a measured
one, and one process-wide floor was reused across pools.

- Placement (configured, never measured: card 9bddda93) is Device, Host or Split. A split is not
  measured, so each pool is charged its upper bound.
- ContextBytes { device, host } comes from rates written as receipts (MiB llama reported over the
  tokens measured), now including the host-resident context: CPU KV 224 and compute 1,200.97 MiB
  at 2,048 tokens (engine-c, -ngl 0, logs in evidence/replicate-2026-11-10).
- embed_lane_memory leases each non-empty part in its pool, with a floor per pool.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Nov 10, 2026
…th a floor per pool

Codex on #5910: one context's bytes are in two pools (KV and device compute on the device; the
CPU's compute share and the output buffer on the host), a configured placement is not a measured
one, and one process-wide floor was reused across pools.

- Placement (configured, never measured: card 9bddda93) is Device, Host or Split. A split is not
  measured, so each pool is charged its upper bound.
- ContextBytes { device, host } comes from rates written as receipts (MiB llama reported over the
  tokens measured), now including the host-resident context: CPU KV 224 and compute 1,200.97 MiB
  at 2,048 tokens (engine-c, -ngl 0, logs in evidence/replicate-2026-11-10).
- embed_lane_memory leases each non-empty part in its pool, with a floor per pool.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Included in the live stack, #5917 (one line of work: no duplicate copies). #5913's board change stays reverted there until a serving-plan replay proves it.

@joelteply joelteply closed this Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant