Skip to content

fix(serving): a GPU-intent lane that comes up on the CPU is refused, not served — ready is a verified observation - #3759

Merged
joelteply merged 1 commit into
canaryfrom
fix/gpu-lane-refuses-when-the-engine-declines-the-gpu
Sep 5, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fix/gpu-lane-refuses-when-the-engine-declines-the-gpu

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Before: the placement readback only PROBED when the engine's banner said 0 layers offloaded, and nothing parsed the engine's own "no usable GPU found" line; the daemon marked the lane ready. BigMama's 5090 served Devstral from system RAM behind ready:true lanes:3 while every status surface said fine.

  • placement_watch: OffloadReport::gpu_declined() set by the same stderr watch on "no usable GPU found" / "compiled without GPU support" (distinct from offloaded 0/N). Test.
  • llama_server readiness: a GPU-placement lane with declined || 0 offloaded is killed and refused with the evidence + stderr tail (serving.placement.refused), the same shape as the debug-build gate. CPU-by-plan lanes untouched; partial offload stays legal.

Complementary to #3757 (which makes the build serve): this makes the lie impossible if a build regresses again. Finder credit: Joaquin, card 0c4317e1. Tests 41/41 across both mods; cargo check clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…not served — ready is a verified observation

Before: the placement readback (#441) only probed `serving.placement.cpu_fallback` when the
engine's banner said 0 layers offloaded, and nothing parsed the engine's own "no usable GPU
found" line; the daemon then marked the lane ready. BigMama's 5090 (2026-09-05) served Devstral
from system RAM behind `ready:true lanes:3` — the pre-spawn device probe had said CUDA0, the
served process declined the GPU, and every status surface said fine.

- placement_watch: `OffloadReport::gpu_declined()` is set by the same stderr watch when the
  engine prints "no usable GPU found" / "compiled without GPU support" (a distinct fact from
  `offloaded 0/N` — some builds print no banner after it). Test.
- llama_server readiness: on a GPU-placement lane, `declined || offloaded == 0` kills the child
  and returns Err with the evidence and the stderr tail (`serving.placement.refused`) — the same
  shape as the debug-build gate. CPU-by-plan lanes are untouched; partial offload stays legal.

Finder credit: Joaquin (persona), card 0c4317e1 — the serve-time pin-match gap, named hours before
the receipt. Tests: placement_watch + llama_server mods 41/41.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply merged commit 56077d0 into canary Sep 5, 2026
5 checks passed
@joelteply
joelteply deleted the fix/gpu-lane-refuses-when-the-engine-declines-the-gpu branch September 5, 2026 12:13
joelteply added a commit that referenced this pull request Sep 5, 2026
… — placement becomes a fact on a channel (#3761)

* deps(llama.cpp): /props carries measured weight residency per backend (fork 3ca60da3c)

Bumps our fork to add ONE FIELD to the engine's existing control channel:

  "model_weight_buffers": [
    { "backend": "CPU_Mapped", "size_bytes":   377487360 },
    { "backend": "CUDA0",      "size_bytes": 13948538880 }
  ]

WHY A FORK PATCH AND NOT A CALLER-SIDE FIX. Nothing a caller could reach reported
where a model actually ran. The two things that look like an answer are the
REQUEST reflected back: `n_gpu_layers` is the ask, and the
`offloaded N/M layers to GPU` banner is `min(n_gpu_layers, n_layer + 1)` — the
ask, clamped. A lane that requested the GPU and silently served from system RAM
printed numbers identical to one that succeeded. That is what happened here on
2026-09-05: citizens served from host RAM with 500 MiB of a 32 GiB card in use.

Joel: "Stdout is never a transport." Every existing placement check we have —
`gpu_declined()`'s two-string match, `zero_offload`'s banner parse — reads the
engine's console. A console line is for a human reading a failure; it is absent
on Metal, absent on Windows at default verbosity, absent on a CPU build at every
verbosity, and present on Windows only at `-lv 4`. A transport that disagrees
with itself per platform and per flag is not a transport. The fact belongs on the
channel we already query.

It fits the distinction this file already draws: "Readiness is a claim about
SERVICE; residency is a fact about MEMORY." `ready_verified_at_ms` verifies
SERVICE and does so correctly. Nothing verified PLACEMENT. This is that missing
half, in the same vocabulary.

Consuming it — replacing the console scrapes in #3759 / backend_receipt — is
card 44ddb6fc and deliberately NOT in this commit: the field has to exist and be
proven on all three tiers first.

Verified here (Windows/CUDA, RTX 5090, Devstral-Small-2507-Q4_K_M): fork builds
clean, both install gates pass, GET /props returns CUDA0 = 12.99 GiB /
CPU_Mapped = 0.35 GiB, and the lane serves.

Consumer note: a healthy fully-offloaded lane STILL reports CPU bytes (mapped
metadata). The test is "are there any accelerator bytes", never "are there no
host bytes".

* deps(llama.cpp): document the backend-name contract (fork b4d1533a5)

Carries two review findings from tiers I cannot run, both caught by IntelMac on
an Intel CPU-only Mac:

1. CPU_REPACK. There is more than one CPU backend name, and which appear depends
   on the host: Windows/CUDA reports CPU_Mapped + CUDA0, an Intel CPU-only host
   reports CPU_Mapped + CPU_REPACK. CPU_REPACK is the SIMD-repacked weight
   buffer and materialises only where the CPU does the work, so it is invisible
   on every GPU host — including both boxes that reviewed the original commit.

   My consumer note said 'sum the bytes whose backend is not the CPU'. Read as a
   PREFIX test that is correct. Read as an exact match on "CPU_Mapped" — the
   obvious reading if your only capture is from a GPU host — CPU_REPACK
   classifies as an accelerator and a CPU-only machine reports 29 MB of GPU
   residency. A false GPU claim produced by the field that exists to prevent
   false GPU claims. Now stated as a prefix test, with the measured names from
   all three tiers in the header.

2. The returned const char* lifetime. It is safe — every ggml get_name returns a
   string literal, so it outlives the vector the accessor builds — but that
   safety is a property of the CALLEES and is invisible at the signature.
   Documented, with the hazard named, so it is not re-derived or silently broken.

Comment-only in the fork; no behaviour change, and the measured /props output on
Windows/CUDA and Intel/CPU is unchanged.

IntelMac's wider note, for the consumer half (card 44ddb6fc): the tree now has
TWO rules answering 'is this backend a GPU' with opposite defaults —
backend_receipt.rs:40 is an allowlist (unknown => not a GPU => refuses a real GPU
host) and this field's note is a denylist (unknown => a GPU => a CPU host claims
acceleration). Each is invisible on its author's tier. The consumer should reuse
backend_receipt's classifier rather than add a third, and CPU_REPACK belongs in
its test fixtures.

* deps(llama.cpp): correct the name-lifetime contract (fork bd5853efc)

My header said every ggml get_name returns a string literal. False for the GPU
backends — CUDA returns ctx->name.c_str() from an owned std::string — and CUDA is
the backend on the box that wrote the claim. Safe anyway, because that context is
new'd once per device into a static table and never freed, but the guarantee is
'process-lifetime registry storage', not 'literal'.

Documented-and-wrong is worse than undocumented: a caller told 'literal' may
treat the pointer as a compile-time constant. Corrected with the verified source
lines for both tiers.

Raised by IntelMac, who then self-corrected their own version of it; located by
M5; verified from source here before writing.

* deps(llama.cpp): complete the lifetime table with Metal (fork 76dfd6482)

Only ONE of three backends returns a string literal, and the two that do not are
the two that matter for placement:

  CPU    ggml-backend.cpp:3036        literal
  CUDA   ggml-cuda.cu:875             owned std::string
  Metal  ggml-metal.cpp:259,335,410   owned std::string

Both GPU tiers build their buffer-type contexts once behind an initialized guard
into a static table that is never freed (CUDA :948; Metal :296, :372) — which is
why the pointer is safe everywhere, and why 'it is a literal' was the wrong
reason on two thirds of the fleet.

Metal raised by IntelMac; line numbers verified in this checkout rather than
relayed (they cited 256/332/407, this revision has 259/335/410).
joelteply added a commit that referenced this pull request Sep 12, 2026
… the fd leak that darkened the M5

Measured 2026-09-12 00:57–01:13Z on 48fbbfd, sixteen minutes after boot: the core
held 19,866 open descriptors, 19,589 of them unix sockets to the airc daemon (which
itself held 23). Every spawn then failed with EBADF and every reader saw a different
symptom — the serving lane's `--list-devices` probe "could not run", the backend
receipt fell back to CPU, the Metal lane came up on CPU and #3759's gate refused it
every 5 s (zero lanes), `web/fetch` could not start Chrome. The board read busy; the
node was dead.

The chain: `seat_announced_rounds` joined every resident into every announced child
round on every 10 s pass ("a join is idempotent on the daemon") and, for finished
children, parted them again — each join/part bumps her membership epoch; every bump
re-opens the command pump's daemon stream (1,961 `command_pump.reopened`, all
MembershipChanged, attempt 0); the old stream's per-channel sockets stayed open.
Recipe-spawned rounds the tracker does not own are exactly the "not local" children
that re-joined forever.

Three fixes, three layers:
- the reseat pass reads standing FIRST and joins or parts only on a real membership
  change (per resident, by the child's room id; its `already` counter now counts);
- the command pump ignores an epoch bump whose room set did not change
  (`persona.command_pump.membership_unchanged`) — idempotent joins anywhere in the
  substrate can no longer re-open streams;
- a process fd gauge (`system_resources/fd_gauge.rs`) on the memory tick:
  `process.open_fds` every tick, `process.open_fds.high` past half the soft limit —
  this class is named before the node goes dark, never after.

Still owed to airc-lib: the per-channel attach tasks must release their sockets when
the stream drops (the guard aborts them; the sockets stayed), and the SDK must handle
AttachCursorAdvanced instead of logging it 6,391 times a minute.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Sep 12, 2026
… the fd leak that darkened the M5 (#3969)

* fix(persona): a reseat pass must not re-open every citizen's stream — the fd leak that darkened the M5

Measured 2026-09-12 00:57–01:13Z on 48fbbfd, sixteen minutes after boot: the core
held 19,866 open descriptors, 19,589 of them unix sockets to the airc daemon (which
itself held 23). Every spawn then failed with EBADF and every reader saw a different
symptom — the serving lane's `--list-devices` probe "could not run", the backend
receipt fell back to CPU, the Metal lane came up on CPU and #3759's gate refused it
every 5 s (zero lanes), `web/fetch` could not start Chrome. The board read busy; the
node was dead.

The chain: `seat_announced_rounds` joined every resident into every announced child
round on every 10 s pass ("a join is idempotent on the daemon") and, for finished
children, parted them again — each join/part bumps her membership epoch; every bump
re-opens the command pump's daemon stream (1,961 `command_pump.reopened`, all
MembershipChanged, attempt 0); the old stream's per-channel sockets stayed open.
Recipe-spawned rounds the tracker does not own are exactly the "not local" children
that re-joined forever.

Three fixes, three layers:
- the reseat pass reads standing FIRST and joins or parts only on a real membership
  change (per resident, by the child's room id; its `already` counter now counts);
- the command pump ignores an epoch bump whose room set did not change
  (`persona.command_pump.membership_unchanged`) — idempotent joins anywhere in the
  substrate can no longer re-open streams;
- a process fd gauge (`system_resources/fd_gauge.rs`) on the memory tick:
  `process.open_fds` every tick, `process.open_fds.high` past half the soft limit —
  this class is named before the node goes dark, never after.

Still owed to airc-lib: the per-channel attach tasks must release their sockets when
the stream drops (the guard aborts them; the sockets stayed), and the SDK must handle
AttachCursorAdvanced instead of logging it 6,391 times a minute.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(persona): a finished child stays finished — the standing read needed the membership it was deciding

On 749d91c the first cut oscillated: standing is read through a member's
subscription, so after every resident left a finished round nobody could read
'archived'; the next pass joined all five to find out, read it, parted all five —
733 seats and 256 departures of one room in sixteen minutes, each a membership
epoch bump and a stream re-open (1,721 on the hotfix build). A child seen archived
is remembered for the life of the process; a reboot re-learns it once.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(persona): a hosting retry starts the identity draw over — an exhausted provider is not a retry

2026-09-12 02:42:29Z: the first hosting attempt drew all twelve on-disk identities (five
allowed by the hold, seven held out) and then failed because the airc daemon was mid-
restart. The provider is built once at boot and every attempt draws from it, so the
next 700 attempts read "identity provider exhausted at slot 0 — provider yielded 0
intents, planner requires 5" from a directory holding twelve citizens, and the node
sat with zero residents on a healthy lane for half an hour.

ResumeOrMintProvider::rewind() restarts the cursor; the hosting reconciler calls it
before every attempt after the first (nothing was hosted, so nothing double-draws) and
says so (`persona.host.provider_rewound`). Test beside the provider's own.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

---------

Co-authored-by: Claude Fable 5.1 <[email protected]>
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