Skip to content

server: the host pool, one streaming byte budget; resident bytes as pool-owned handles (host-pool slice 3) - #136

Open
joelteply wants to merge 7 commits into
fable/engine-module-s4from
fable/host-pool-s4
Open

joelteply wants to merge 7 commits into
fable/engine-module-s4from
fable/host-pool-s4

Conversation

@joelteply

Copy link
Copy Markdown

Slice 3 of the unmerged fable/host-pool work, stacked on #135. This replaces the prompt cache's guess-and-refuse memory model with one streaming pool (CONTINUUM-ENGINE 4.7.6; Joel, 2026-11-16: "dynamic stream based allocation", not "stops and failures").

What it adds (headers and tests only, no call sites yet)

server_host_pool: prompt-cache entries, checkpoints and RAM pages are kinds of resident in one pool with one byte budget, like a game engine's texture streamer.

  • Reserve first: bytes are reserved for a resident's whole peak before anything is copied.
  • Evict by value: the reservation names the lowest-valued unpinned residents to evict. An evicted resident stays charged until its owner physically frees it, so the pool never credits bytes that still exist.
  • One unit of value across kinds: seconds of prefill saved per byte kept.
    • A resident with no measured restore is explicitly unmeasured, never given a guessed number.
    • Unmeasured residents are evicted first, then measured ones by ascending value per byte.
  • Pinned residents (a restore or save in flight) are never evicted.
  • The budget is the core's grant, keyed by engine instance and a strictly rising generation.
  • Typed outcomes: std::expected, where awaiting_release means "free these, then reserve again".

host_bytes: a resident's bytes as an RAII handle the pool owns, shared by reference.

Measured (M5, Apple clang 21, 2026-11-16)

  • test-server-host-pool: ok (7 scenarios, 20,000 mixed steps).
  • test-server-host-bytes: ok.
  • Standalone at -std=c++23 -Wall -Wextra -Werror under ASan and UBSan: 0 reports.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

… checkpoints and pages; a resident's bytes are a pool-owned handle (host-pool slice 3)

From fable/host-pool (900617b, 3cf8a4e, ff1708c, 79b1929), final form. The engine's host memory as
ONE pool like a game engine's texture streamer: bytes are reserved before a resident is copied (its whole
peak); the reservation names the lowest-valued unpinned residents to evict, and an evicted resident stays
charged until its owner physically frees it; value is one unit across kinds (seconds of prefill saved per byte
kept, UNMEASURED explicit, never guessed); pinned residents (restore or save in flight) are never evicted; the
budget is the core's grant keyed by engine instance and a rising generation; outcomes are std::expected with
typed reasons. host_bytes: a resident's bytes as an RAII handle the pool owns, shared by reference.
No call sites yet: wiring replaces the prompt cache's own limit and disk-tier guesses.

Receipt (M5, Apple clang 21): test-server-host-pool ok (7 scenarios, 20,000 mixed steps) and
test-server-host-bytes ok, from the cmake build and standalone at -std=c++23 -Wall -Wextra -Werror under
-fsanitize=address,undefined: 0 reports.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant