Skip to content

The embedder's floor is resident: its whole need stays reserved between embeds, cleared only when it unloads - #6006

Merged
joelteply merged 1 commit into
canaryfrom
fable/the-embedder-floor-is-resident
Nov 14, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fable/the-embedder-floor-is-resident

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Serves residents' recall under the one memory budget (plan line 3/3b). Follow-up to #5996, from its live receipt.

Receipt (the M5, canary 7f875cc, engine -c 551865 / allocated 551,936, booted ~07:52Z 2026-11-14)

Cause

embed_lane_memory.rs on canary (LaneFloors::grant / release): the reservation was weights plus the leases held now. Between embeds it was the weights alone, so room_beside_others (#5993) and available_for handed the context's room to the engine.

Fix, at the owner

  • EmbedResidency: the embed lane's resident claim, its whole need (weights plus one window context: 639 MB + 1,495 MB on the device at most). It is reserved per pool from the embedder's first embed (the resolver's probe) and held by the backend (LlamaCppBackend::embed_residency, a OnceLock). It is cleared only in its Drop, when the embedder unloads (nothing holds what it isn't using: an idle embedder that is still loaded is used every turn).
  • Leases are granted inside the claim and never move it. A request past the window is still EmbedLeaseError::Oversized.
  • The boot counts the device room, the embed floor outside it #5993's room_beside_others counts the reservation, so a boot or a regrowth sizes beside it.
  • Deleted: PoolFloor, LaneFloors, the FLOORS static and its grant/release bookkeeping.

Pinned tests

  • an_embed_after_an_idle_gap_is_granted_beside_an_engine_that_fills_the_room: the engine leases every byte the board allows, then an embed, the idle gap, and an embed after it are all granted, up to the widest window. The claim never moves.
  • a_refused_request_leaves_the_floor_unchanged: an oversized request and a capacity refusal both leave the claim as it was.
  • unloading_the_embedder_clears_its_floor: a release keeps the claim; dropping the residency clears it to 0.

Not run locally: this machine serves live minds, so CI is the compiler.

Residuals

  • Engine sized before the embedder loads: the claim is made at the embedder's first embed (resolution is lazy, on first recall). An engine sized before that can still take the room until its next sizing; this case is pinned as a typed refusal. Closing it needs the embed claim made before serving's first launch: owner is serving boot order (Codex), with a card to follow.
  • Weights counted twice: the weights in the floor are resident but unleased, so other consumers' available_for holds back about 0.6 GB extra beyond physical_used (unchanged from The embedder holds its need: a window-bounded context, a floor set by grants and lowered by releases #5996).

Lines

+128 / −151 across 5 files. stringly_errors unchanged.

Live check after deploy

In the first hour on the M5: embed.vram.refused = 0 and embedding.neural.failed = 0, with embed.vram.leased at or below 1,495,269,376 B.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…en embeds, cleared only when it unloads

The M5 (canary 7f875cc, engine -c 551865, booted ~07:52Z 2026-11-14): after #5996 the embed requests
are small (186,908,672 and 373,817,344 B), but by 08:16Z embed.vram.refused = 13 and
embedding.neural.failed = 11, all at available=0. #5996's floor fell to the weights between embeds, so
the engine's pool and the other claims took the next context's room.

EmbedResidency (embed_lane_memory.rs) is the embed lane's resident claim: weights plus one window
context (~2.1 GB on the device at most), reserved per pool from the first embed and held by the
backend (LlamaCppBackend::embed_residency). It is cleared only in its Drop, when the embedder unloads.
Leases are granted inside it and never move it. #5993's room_beside_others counts the reservation, so
a boot or a regrowth sizes beside it. The LaneFloors grant/release bookkeeping is deleted.

Pinned: an_embed_after_an_idle_gap_is_granted_beside_an_engine_that_fills_the_room,
a_refused_request_leaves_the_floor_unchanged, unloading_the_embedder_clears_its_floor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply merged commit 04336be into canary Nov 14, 2026
32 checks passed
@joelteply
joelteply deleted the fable/the-embedder-floor-is-resident branch November 14, 2026 09:25
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