Skip to content

A pass that seats nothing gives its granted reserve back - #6284

Open
joelteply wants to merge 20 commits into
canaryfrom
28aac827/trainer-learns-through-learnport
Open

joelteply wants to merge 20 commits into
canaryfrom
28aac827/trainer-learns-through-learnport

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

A granted ask became the bucket's reserve and was released only when its seat was seated or let go. A pass
that never measured a seat (nothing pending, decide said not now, a refusal before the measure) kept the
reserve from every other consumer with nothing to spend it on. seat_bucket now releases the reserve
whenever the pass ends with the bucket unseated.

Measured (IntelMac): training_trigger 78/78; the new test fails without the release. Ratchets run after the
commit, on this tree (see below in the push receipt).

Co-Authored-By: Claude Opus 5.5 (1M context) noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

joelteply and others added 20 commits November 26, 2026 08:57
…es, prepare/consume/commit/unwind/release, waits that name their shortfall, never-here only past capacity, owner generations; Lease<Q> over typed quantities

Two outliers in the tests: bytes on tiers (the 5090's 5.18 MB-free seat now waits, granted on release) and minds awake as slots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…release, a consume after commit fails, a capacity drop answers waits never-here (Cormac's review of 5ea6e2e)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ats as priors, where SAGE learns what it hand-tunes; unified-memory residency in the Placer's budgets

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…r (kernel ResourceLeaseLedger, ThroughputLeaseRegistry, sage Flow) fold into it before 3a is done

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…s and floors (slice 3a, step 2a)

What ResourceLeaseLedger has that place lacked, before the kernel ledger moves onto it:
- a claim's term: renew(id, until, now), overdue(now); past its term a claim reads nothing and cannot be
  spent, and stays charged until released (Fable's hold: the remainder reads 0 past until)
- shrink(id, place, amount): a committed or retired holding partly given back
- back(place, pool): a place that draws on another's physical memory is charged once on it, its room
  and never-here bound the smaller of its own and its pool's (the M5's unified memory)
- floor(owner, place, amount): a guarantee others are granted around and its owner fills without
  queueing behind anyone (room_for, the one rule for room, in ledger/room.rs)

Measured (IntelMac): place:: 15/15; each of the four new tests fails when its mechanism is broken
(pool charge dropped, floors ignored, lapse ignored, shrink not credited). Ratchets 135/135 vs 78a11b0.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…sless, any number of consumers), each owner's whole table out as keyed state (waiting with shortfall, granted with the claim, committed, retired, terminal), each place's shortfall as state; the first wait in line holds its fitting places (Cormac's multi-place starvation)

Rebased with Cormac's 2a (9bf241b: terms, shrink, pools, floors); floors exempt a need from the hold. An ask whose owner's table cannot be claimed is never prepared. sage 101/101, ratchets 135/135.

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

60 on a place and 60 on the pool of 100 it draws on were each checked alone and granted, 120 prepared.
room.rs's short() is now the one test of an ask: each place against its own room, and each physical
memory against the sum of the ask's needs on it; fits and short_places read it; past_capacity sums
the same way for never-here.

Measured (IntelMac): place:: 16/16; the new test fails when the per-memory sum is disabled.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
… first half)

ResourceLeaseLedger keeps its readings (capacity, physical samples, backing, measured footprints,
reservations) and tells them to one continuum_sage::place::Ledger<ResourceKind, Bytes> after every
change (ledger/told.rs): each kind's budget is its capacity less what is resident beyond our leases
proven landed in the accepted reading (Codex's overlap rule), a backed kind draws on its pool, and each
reservation is a floor net of its holder's unleased residency. acquire is a claim spent whole and
committed, release and shrink return it, and available, available_for and committed read place.
place gains free() and floors() (replace every floor at once).

Still on the old arithmetic: budget_for_replacing (headroom_after_release); it moves onto place in the
second half of 2b, and then remaining_commitment, headroom_after_release and the pool helpers go.

Measured (IntelMac): the kernel ledger's oracle, resources::ledger 29/29 unchanged (one caught a
withdrawn reservation's floor left on place; fixed by telling floors whole); resources:: 252/252
(disk_eviction skipped: its lock test fails only under parallel contention, passes alone); place 21/21;
ratchets 135/135 vs 6e561bd.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…ithmetic is deleted (slice 3a, step 2b, second half)

budget_for_replacing asks place.room_if(owner, kind, freed): what the consumer's release would give back
on its kind and its pool (its measured residency leaving the reading, never below what the others
measure there; its leases up to that residency) is computed from the readings (ledger/told.rs
freed_by_replacing), and place answers the room, repaying an over-budget place first and never past
capacity. Deleted from ResourceLeaseLedger: remaining_commitment, headroom_after_release, pool_kinds,
not_yet_resident, reserved_headroom_excluding. Every free/committed/room answer now comes from place.

Measured (IntelMac): resources::ledger 29/29 unchanged (one, replacing_keeps_pending_peer_grants, caught
an over-budget place read as zero before the add-back; room_if now repays it); resources:: 252/252;
place 22/22 (room_if's own test added); ratchets 135/135 vs dca119b.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
A place backed by a pool after its claims were charged released them off the new pool, taking another
owner's 40. back() now moves the place's held and prepared charges from the pool it drew on to the new
one (or off it, when unbacked), so a release returns what it holds where it was posted.

Measured (IntelMac): place 23/23, the new test (Codex's repro) fails without the move; kernel
resources::ledger 29/29; ratchets 135/135 vs 7e348e8.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…s, and a grant on release (slice 3a, step 3, the trainer's contract)

The 5090 (2026-11-26): a learning seat refused 5.7 GB with 5 MB free, and nothing ever woke it. The
authority now has an ask beside acquire (Codex's contract: kernel leases take everything, a seat's ask
waits, a kernel release grants it, unasked again):
- place gains take(): the foreground's no-wait path, ahead of any wait, never queued (Untaken says
  why not); prepare and take share admissible(). Acquire uses take, so serving never queues behind
  a waiting seat; a wait gets what is free after it, and which waits deserve room is the law's.
- ResourceLeaseLedger::ask/withdraw/take_granted (ledger/asks.rs): a wait on place; every tell()
  grants what now fits and turns it into its lease; withdraw releases a grant never taken.
- ResourceDaemon::ask -> Ask::Granted(LeaseGuard) | Ask::Waiting { ticket, short } (daemon/ask.rs):
  AskTicket::granted() takes the lease once; dropping the ticket withdraws (custody). measured_now()
  is the one 'measure the sources now' step acquire_measured_now and ask share.

Measured (IntelMac): resources:: 255/255 (three new: the ledger's ask and withdrawn-ask tests, the
daemon's ask-on-release test; the grant and the ticket's withdraw each fail when disabled); ratchets
135/135 vs 3ca8949. Not yet: the trainer asking through it (next commit).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
A seat's granted ask is its reserve; each stage (weights, optimizer, workspace) is carved from it:
ResourceLeaseLedger::carve shrinks the reserve and takes exactly those bytes for the stage lease with
nothing told in between, so no wait and no other taker has them first; ResourceDaemon::carve does it
under one governor lock. Never past the reserve or across kinds.

Measured (IntelMac): resources::ledger 32/32 (the carve test fails when place is told between the shrink
and the take: the waiting ask takes the bytes); ratchets 135/135 vs 7e62b2b.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…claim (Codex on 66c1fb4)

Shrinking the reserve then taking the bytes could fail after the shrink and lose them. place gains
split(id, place, amount, owner, generation): a committed claim's holding moves to a new committed claim,
every place's and pool's charge unchanged, nothing freed for a wait. The kernel's carve uses it and tells
place only after the transition.

Measured (IntelMac): place 24/24 (split: charges unchanged on the place and its pool, no wait granted,
never past the holding); resources::ledger 32/32 with the carve-vs-wait test; ratchets 135/135 vs 66c1fb4.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…ified, and nothing is carved from a lapsed reserve (Codex on 07427e2)

07427e2 was pushed with two ratchets red (a five-parameter split; an unjustified expect in its test):
the commit ran after the ratchets with ';' instead of on their exit. split now takes the moved Need.
A reserve past its term stays charged for its fenced release: carve refuses it (ExpiredLease) and
changes nothing, at and after the term.

Measured (IntelMac): resources::ledger 33/33 (the lapsed-reserve test new); place 24/24; ratchets
135/135 vs 66c1fb4, exit 0.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…s grant (Codex's contract, the real trainer)

The 5090 (2026-11-26): a seat short of memory was held watching what is free, and while serving held the
device nothing ever freed it. Now:
- a stage lease short of memory asks the authority for the WHOLE seat of that kind
  (training_admission::ask_training_memory); granted, it is the bucket's reserve; waiting, the bucket is
  HeldOff::Asked { ticket } (HeldOff::Memory and its free-watching short() are gone);
- the hold check, the release wake (on_free) and a let-go seat's Released take a granted ask into the
  bucket's reserve and seat it again;
- each stage is carved from the reserve (seat::lease_memory_within -> training_admission::try_carve under
  the serving gate; a gate refusal leaves the reserve whole; a failed carve is SeatRefusal::Uncarved,
  typed); what is left of the reserve is released once the seat is seated or let go.

Measured (IntelMac): training_trigger 77/77, one new: serving holds 600 MiB of 1 GiB, the seat refused its
optimizer asks for its whole 501 MiB seat; the release grants it at once (a competing 600 MiB taker is
refused), another taker holds everything free beside the reserve, and the seat still loads and seats on
carved stages with no second ask, 0 left free and nothing left over. Ignoring the reserve makes it fail.
genome learner::seat 9/9; kernel resources:: 257/257 three runs (one earlier run had one failure that did
not reproduce; not identified); ratchets 135/135 vs c343b45, exit 0.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
… a wait, and carve keeps place's refusal

(1) A foreground take passes waits by design, so a steady stream of them can starve an ask (the 5090
symptom in a new shape). acquire now probes resources.ask.passed with how many asks wait on its kind and
the oldest's age: the evidence the aging bound (a decide::Policy) is fitted to.
(4) carve's map_err turned every place Refusal into MissingLease. CarveError keeps it: Lease(LeaseError)
or Place(Refusal), through the governor, daemon, try_carve and SeatRefusal::Uncarved.

Measured (IntelMac): kernel resources:: 257/257, training_trigger 77/77, genome learner::seat 9/9,
ratchets 135/135 vs 7d59f56, exit 0. Follow-ups (2) (the kernel's asks/granted maps onto Placer, owner
generations) and (3) (one owner of expiry) are step 3 proper: next.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…h only for a mixed batch (Codex)

The 5090 (2026-11-26 13:51Z) crashed 41 s into a window on 7d59f56 with an unspecified CUDA launch
failure in mul_mat_q, after serving's embedding graph; no trainer act preceded it. Every execution graph on a
mixed-capable arch built the set_rows mixed path even for a pure token batch that supplies no slot indices.
a29e679f7 reserves for the mixed batch but builds the path only when the batch is mixed; allow_reuse
already keeps pure and mixed graphs apart. Codex's 900 s Qwen3.8-27B replay with it ran without the fault;
reviewed (graph reservation vs execution, reuse across the transition) before pinning.

Measured (IntelMac, this head on canary 584a0bf): place 24/24, kernel resources:: 257/257,
training_trigger 77/77, genome learner::seat 9/9, ratchets 135/135 vs origin/canary, exit 0.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…c3e3eb)

4c3e3eb moved the gitlink and left the recorded pin at 7e81db08. My ratchet run passed only because it ran
before the commit, against a HEAD whose gitlink still matched.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
A granted ask became the bucket's reserve and was released only when its seat was seated or let go. A pass
that never measured a seat (nothing pending, decide said not now, a refusal before the measure) kept the
reserve from every other consumer with nothing to spend it on. seat_bucket now releases the reserve
whenever the pass ends with the bucket unseated.

Measured (IntelMac): training_trigger 78/78; the new test fails without the release. Ratchets run after the
commit, on this tree (see below in the push receipt).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
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