Repository navigation
fix(serving): GPU offload is always explicit — all layers for a GPU lane, 0 for CPU, never the backend's default - #3728
Conversation
…ane, 0 for CPU, never the backend's default
`--n-gpu-layers` was pushed only for cpu_only (0); otherwise the launch left offload to the
backend's default, which is every layer on Metal and NONE on CUDA. So every CUDA host ran its
citizens on the CPU: BigMama's Windows 5090 sat at 674 MiB used while a 24B Devstral prefilled
on CPU, prefill could not advance (0 of 1245 prompt tokens at 61 s), the decode heartbeat
correctly declared the lane wedged, and the self-heal relaunched the same flags 13 times in
106 minutes (card 2c33f3f0, half 1). The M5 never saw it.
A placement decision is a number the server is told, never a default it is left to guess.
The flag is now on every launch: ALL_GPU_LAYERS ("999", which llama-server clamps to the
model's layer count) for GPU placement, 0 for CPU. The planner may lower it for a partial
fit; it may never omit it. The test that pinned the flag as absent-by-default encoded the
Metal-only truth; replaced by one that names the CUDA case.
Half 2 (serving from the cold HDD tier) is card 1435c598.
// what this catches: a launch flag whose absence means opposite things on two backends.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
No objection — this is the right fix and the reasoning in the comment is the best kind: a platform default that was true on the machines the readers happened to own, and therefore invisible to exactly the people who could have caught it. Verified rather than assumed, two things:
One finding, and it is the same class this PR is about. The comment immediately above the change is now FALSE and unchanged in the diff: // VRAM a living lane already holds (the Metal decode-time OOM that muted the
// eval). GPU lanes omit the flag — llama-server offloads all it can by default.
// [[ServingTarget::placement]] / #59 / #56."GPU lanes omit the flag" contradicts the code three lines below it, which now always pushes it — and "llama-server offloads all it can by default" is precisely the Metal-only belief this PR exists to kill. It reads as a live justification for the old behaviour, sitting directly above the new behaviour. That matters more here than usual: the next person to read this function is someone debugging placement, and the first thing they will hit is a confident sentence telling them GPU lanes do not pass the flag. Tonight alone we have had a "300s" string outliving its constant, a "within 300s" message for an 1800s bound, and a Fold the old rationale into your new block — it is worth keeping as history ("this used to omit the flag on the belief that…") rather than deleting, since it explains why the bug existed. Nothing else. The test replacing absent-by-default with one that names the 5090 is exactly right: the old test did not merely fail to catch this, it PINNED it, which is worse than no test and worth the sentence you gave it. |
…l over VRAM fails loudly at spawn; partial offload is the follow-up card Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
… it loads, refuses a GPU-less server on a GPU host, and degrades to CPU when device init hangs Three hosts, one seam, 2026-09-05. BigMama's 5090: the installed llama-server printed "E load_backend: failed to load ggml-cuda.dll" and "failed to find ggml_backend_init in ggml-cpu.dll", fell back to its built-in CPU backend, and served a 24B model on the CPU while the GPU sat at 674 MiB — 13 lane kills in 106 minutes before anyone read its log (2c33f3f0 → ce58031a). IntelMac's Intel-GPU Mac: Metal initialisation hangs, so --version and --list-devices never return (cd8f0bc7). #3728 made the offload flag explicit, which turned the first failure from silent to STATED; nothing asked the binary what it loads. Now the launch asks, bounded like the version probe (10 s, `--list-devices`): - a GPU device line (MTL0 / CUDA0 / …) → serve on it; probe serving.backend_receipt names backend + device; - answered with NO GPU device → REFUSED (serving.backend_refused) quoting the server's own load errors and the reinstall instruction — a warning on a CUDA host is the CPU-forever outage; - no answer within the bound → ProbeHung: the lane is pinned to the CPU (--n-gpu-layers 0, last flag wins) and serving.backend_probe_timeout says why — the low-end contract: a box whose GPU cannot initialise still serves, and never pretends it is on the GPU. The core's own contract (gpu::detect_gpu refuses to boot without a GPU) is why the receipt needs only the server's answer. inference/backend_receipt.rs is pure (parse + verdict) with tests pinning the real transcripts: the M5's MTL0 line, BigMama's two E load_backend lines, a silent CPU-only build, and the hung probe. The serving snapshot's backend field is the follow-up on card c0bc4027. // what this catches: a serving binary that cannot use the host's GPU, at the door. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
… it loads, refuses a GPU-less server on a GPU host, and degrades to CPU when device init hangs Three hosts, one seam, 2026-09-05. BigMama's 5090: the installed llama-server printed "E load_backend: failed to load ggml-cuda.dll" and "failed to find ggml_backend_init in ggml-cpu.dll", fell back to its built-in CPU backend, and served a 24B model on the CPU while the GPU sat at 674 MiB — 13 lane kills in 106 minutes before anyone read its log (2c33f3f0 → ce58031a). IntelMac's Intel-GPU Mac: Metal initialisation hangs, so --version and --list-devices never return (cd8f0bc7). #3728 made the offload flag explicit, which turned the first failure from silent to STATED; nothing asked the binary what it loads. Now the launch asks, bounded like the version probe (10 s, `--list-devices`): - a GPU device line (MTL0 / CUDA0 / …) → serve on it; probe serving.backend_receipt names backend + device; - answered with NO GPU device → REFUSED (serving.backend_refused) quoting the server's own load errors and the reinstall instruction — a warning on a CUDA host is the CPU-forever outage; - no answer within the bound → ProbeHung: the lane is pinned to the CPU (--n-gpu-layers 0, last flag wins) and serving.backend_probe_timeout says why — the low-end contract: a box whose GPU cannot initialise still serves, and never pretends it is on the GPU. The core's own contract (gpu::detect_gpu refuses to boot without a GPU) is why the receipt needs only the server's answer. inference/backend_receipt.rs is pure (parse + verdict) with tests pinning the real transcripts: the M5's MTL0 line, BigMama's two E load_backend lines, a silent CPU-only build, and the hung probe. The serving snapshot's backend field is the follow-up on card c0bc4027. // what this catches: a serving binary that cannot use the host's GPU, at the door. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…U host, degrade to CPU when device init hangs (#3730) * feat(serving): the backend receipt — a lane names the compute backend it loads, refuses a GPU-less server on a GPU host, and degrades to CPU when device init hangs Three hosts, one seam, 2026-09-05. BigMama's 5090: the installed llama-server printed "E load_backend: failed to load ggml-cuda.dll" and "failed to find ggml_backend_init in ggml-cpu.dll", fell back to its built-in CPU backend, and served a 24B model on the CPU while the GPU sat at 674 MiB — 13 lane kills in 106 minutes before anyone read its log (2c33f3f0 → ce58031a). IntelMac's Intel-GPU Mac: Metal initialisation hangs, so --version and --list-devices never return (cd8f0bc7). #3728 made the offload flag explicit, which turned the first failure from silent to STATED; nothing asked the binary what it loads. Now the launch asks, bounded like the version probe (10 s, `--list-devices`): - a GPU device line (MTL0 / CUDA0 / …) → serve on it; probe serving.backend_receipt names backend + device; - answered with NO GPU device → REFUSED (serving.backend_refused) quoting the server's own load errors and the reinstall instruction — a warning on a CUDA host is the CPU-forever outage; - no answer within the bound → ProbeHung: the lane is pinned to the CPU (--n-gpu-layers 0, last flag wins) and serving.backend_probe_timeout says why — the low-end contract: a box whose GPU cannot initialise still serves, and never pretends it is on the GPU. The core's own contract (gpu::detect_gpu refuses to boot without a GPU) is why the receipt needs only the server's answer. inference/backend_receipt.rs is pure (parse + verdict) with tests pinning the real transcripts: the M5's MTL0 line, BigMama's two E load_backend lines, a silent CPU-only build, and the hung probe. The serving snapshot's backend field is the follow-up on card c0bc4027. // what this catches: a serving binary that cannot use the host's GPU, at the door. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(serving): the load-error marker is found after llama.cpp's log timestamp — BigMama's exact bytes, review of #3730 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]>
…rits it (#3729) `llama.cpp/ggml/CMakeLists.txt:94` does: if (APPLE) set(GGML_METAL_DEFAULT ON) `APPLE` is true for EVERY macOS, Intel included. This script set `-DGGML_METAL=ON` only for `Darwin && arm64` and never set it OFF anywhere — so the arm64 guard READ as "Metal only on Apple Silicon" while an Intel Mac silently inherited a Metal build from upstream's default. Not setting a flag is not the same as setting it off. MEASURED, card cd8f0bc7. On a dual-GPU Intel Mac (UHD 630 + Radeon Pro 560X) that binary HANGS inside Metal initialisation and never returns: - `--version` prints nothing and does not exit - the process sits in uninterruptible wait (state U) at 0.0% CPU - SIGKILL does not reap it - `DYLD_PRINT_LIBRARIES` shows every llama dylib loading cleanly, then stopping dead on libggml-metal → AppleIntelKBLGraphicsMTLDriver → AMDMTLBronzeDriver The install script's own verify runs that exact command, unbounded, so the deploy hung on it: fifty minutes of downtime, a whole evening with zero hosted citizens, and five falsified hypotheses (quarantine, executable signature, unsigned dylibs, corrupt artifact, load pressure) before anyone looked at what the process LOADS rather than why it might be slow. VERIFIED AFTER THE FIX, not assumed: rebuilt with `-DGGML_METAL=OFF`, `otool` reports zero Metal dylibs linked, and `--version` exits 0 immediately — including the installer's own verify step, which now completes first instead of never. The Rust side already knew this machine's tier: it builds with `--features llama/mac-cpu-only`. Only the llama install was guessing, and it guessed by omission. Accelerate BLAS is added because it is the right CPU backend on this hardware and upstream defaults it ON for APPLE anyway — stating it makes the choice ours rather than inherited, which is the whole point of this change. THE GENERAL LESSON, and it is M5's from #3728 one layer down: "leaving --n-gpu-layers to the backend's default was a Metal-only truth". Leaving GGML_METAL to the default is an arm64-only truth. A placement decision must be a value we PASS, never a default we LEAVE — because a default is written by someone who did not know which machine you are. Sibling: ce58031a, where a Windows/CUDA host gets a server whose CUDA backend will not load and silently runs CPU-only. Same seam, opposite symptom, each invisible to the other platform's owner. M5's backend-receipt card (c0bc4027) is the general fix that would have caught both at install time. Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
What
The launch pushed
--n-gpu-layersonly forcpu_onlyand otherwise left offload to the backend's default: every layer on Metal, none on CUDA. Every CUDA host ran its citizens on the CPU. BigMama's 5090 (card 2c33f3f0): 674 MiB VRAM used, a 24B model prefilling on CPU from an HDD, prefill 0 of 1245 tokens at 61 s, lane wedged and relaunched with the same flags 13 times in 106 minutes.Fix
The flag is on every launch:
ALL_GPU_LAYERS("999", clamped by llama-server to the model's layer count) for GPU placement,0for CPU placement. A placement decision is a number the server is told, never a default it is left to guess.Tests
cargo test -p continuum-core --lib --features metal,accelerate inference::lane_args— whole mod, 13 passed. The old test that pinned the flag as absent-by-default (a Metal-only truth) is replaced bygpu_offload_is_always_explicit_all_for_gpu_zero_for_cpu.Verification owed
BigMama's box is the reproducer: after pulling this,
nvidia-smishows the model resident,/slotsprefill advances, andserving.healthwedge count stays 0 for 30 min. Half 2 (cold-tier artifact) is card 1435c598 and still bites her until the GGUF is on a hot mount.Review requested; no auto-merge.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo