Repository navigation
fix(install): turn Metal OFF explicitly on Intel Macs — omission inherits it - #3729
Merged
Merged
Conversation
…rits it
`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.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
This was referenced Sep 5, 2026
joelteply
added a commit
that referenced
this pull request
Sep 5, 2026
…nd hangs the whole boot (#3733) `GpuMemoryManager::detect()` runs in `ipc/mod.rs::start_server` six lines after the `boot.registry_init` probe and BEFORE the first `runtime.register` — i.e. pre-bind, before the IPC socket exists and before the module loop. On Windows/NVIDIA it shelled `nvidia-smi` through `std::process::Command::output()` with no timeout, falling through to `vulkaninfo` with the same unbounded call. Grep of that file: zero `timeout`, zero `probe!`. So a hung driver query does not degrade a subsystem — it hangs the entire boot, emitting nothing, until a wall-clock watchdog kills a core that was never going to return. A hung `nvidia-smi` is ordinary on Windows: driver mid-recovery, a WDDM/TCC transition, another process holding the driver, an ECC query on a busy card. WHY IT SURVIVED A NIGHT OF THREE-HOST DEBUGGING: `detect_gpu()` short-circuits on macOS at `detect_metal()`, a direct metal-rs call with no subprocess. Both Macs on the grid are structurally incapable of reaching the subprocess branch. FOURTH SITE OF ONE DEFECT (2026-09-04/05): 1. install-llama-server.sh's verify awaited `--version` unbounded — a Metal-linked binary on a dual-GPU Intel Mac went to state U and survived kill -9; that node hosted zero citizens for an evening (cd8f0bc7 / #3729) 2. the serving debug-build gate awaited the same `--version` unbounded (#3719) 3. deploy-verify's ping, unbounded (#3718) 4. this one — the only one whose blast radius is the whole boot The first three were patched individually. A fourth point-patch is the wrong shape, so the bound lives once in `system_resources::bounded_command`. WHAT THE HELPER ADDS BEYOND A TIMEOUT: four receipts where `.output().ok()?` had two. `ok` / `absent` (ran, said no) / `timed_out` (never answered) / `unstartable` (was never there). "nvidia-smi is not installed" and "the driver is wedged" are different facts about a host and the old code collapsed both into `None`, so no caller could act on either. Each site now emits `boot.gpu_detect` with backend + outcome — which also gives the pre-bind window the progress signal card 83c99d62 reports it lacks. SYNCHRONOUS ON PURPOSE. #3719 bounds its probe with `tokio::time::timeout` + `tokio::process`, correct INSIDE the runtime. `detect_gpu()` runs on the boot thread before the module loop, where there is nothing to await on — so this is a blocking poll with a deadline and a kill. Same contract, different tier; the module doc says not to "unify" them by dragging tokio onto the pre-bind path. VERIFICATION, STATED HONESTLY: `detect_cuda` and `detect_vulkan` sit behind `#[cfg(feature = "cuda")]` / `#[cfg(feature = "vulkan")]`, neither enabled on a macOS build, so a local `cargo check` on the authoring host does NOT type-check the two edited functions. CI and a peer's box are the first real check on them. The helper and its four tests are not feature-gated. Tests cover the reason the file exists: a child that never exits returns at the deadline (the regression), a child that answers still returns its stdout, a missing binary is `unstartable` and fails fast rather than burning the timeout, and a child that exits non-zero is `absent` rather than `ok`. Closes #3732. Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
joelteply
added a commit
that referenced
this pull request
Sep 5, 2026
…ided — CONTINUUM_SERVING_PLACEMENT=cpu|gpu into config.env, replace-or-append BigMama's review of #3740: the Rust was right and the wire did not exist — the key the core reads had to be written by a human, and the reviewer best placed to notice (IntelMac) had written it by hand an hour earlier. Now install-llama-server.sh records the decision next to the build that implements it: BACKEND=cpu (an Intel Mac with Metal OFF, #3729; any host without Metal or CUDA) → cpu; otherwise gpu. config_env_upsert is idempotent (dry-run: three calls leave one key line and the other keys intact). The lib's _cold_export still overwrites config.env wholesale — card 1aa897b0. 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 5, 2026
…s server on a CPU-plan host is by plan, never a mis-install (#3740) * fix(serving): the backend receipt honours a CPU placement — a GPU-less server on a host whose plan says CPU is by plan, never a mis-install IntelMac's Intel-GPU Mac serves with Metal OFF on purpose (#3729); the first #3730 refused its lane because the receipt carried no host fact at all (BigMama's read) and treated every answered-no-GPU server as a mis-install. Joel's ruling already in tree (persona/response.rs: CPU-only adapters serve their own personas) settles the direction. Now placement decides: main lanes read CONTINUUM_SERVING_PLACEMENT=cpu from config.env — the layer the installer writes, so #3729's Intel arm records the decision beside the Metal-OFF build — into LanePlacement::Cpu; the receipt gets the lane's placement and returns CpuByPlan (backend=cpu, no refusal) for a CPU lane, while a GPU lane keeps refusing a server that loads no GPU backend (BigMama's case). Tests: a CPU placement accepts the GPU-less transcript; the config key parses one way and defaults to the GPU. // what this catches: the receipt refusing the tier it was meant to protect. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(install): the llama-server installer records the placement it decided — CONTINUUM_SERVING_PLACEMENT=cpu|gpu into config.env, replace-or-append BigMama's review of #3740: the Rust was right and the wire did not exist — the key the core reads had to be written by a human, and the reviewer best placed to notice (IntelMac) had written it by hand an hour earlier. Now install-llama-server.sh records the decision next to the build that implements it: BACKEND=cpu (an Intel Mac with Metal OFF, #3729; any host without Metal or CUDA) → cpu; otherwise gpu. config_env_upsert is idempotent (dry-run: three calls leave one key line and the other keys intact). The lib's _cold_export still overwrites config.env wholesale — card 1aa897b0. 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]>
joelteply
added a commit
that referenced
this pull request
Sep 5, 2026
…he one (#3748) * ci(install): assert host detection on all three platforms, not just the one `carl-install-smoke` is our only install check and it is `runs-on: ubuntu-latest` with no matrix. So the install path is verified on exactly one platform — and in one night every detect_host bug found on the other two was invisible to it: - Windows 11 24H2 REMOVED `wmic`, so the RAM arm fell through to its else branch and recorded IC_RAM_MIB=0 on a machine with 64914 MiB. Every downstream tier decision then ran on that zero, silently (#3739). - The Intel-Mac arm builds llama-server CPU-only because a Metal build hangs that hardware uninterruptibly — and nothing recorded that as the host's serving PLAN, so the backend receipt refused a healthy node and advised reinstalling with Metal, which would have hung it again (#3729 → #3740). - The Linux/WSL RAM arm still turns an unreadable /proc/meminfo into 0 with no warning: the same defect as the Windows one, on the platform CI DOES run, unnoticed because nothing asserted the value. Each was a detect_host fact being WRONG rather than missing, on a platform its author could not run. Three operators, three boxes, and the shared CI checking the tier none of them installs on. NOT A MATRIX ON carl-install-smoke: that job is Docker-based and ~30 minutes. `install-common.sh` is sourceable and `ic_detect_hardware` is a pure probe of the machine it runs on, so a per-platform leg needs no Docker, no images and no registry auth — seconds, not half an hour. The Docker smoke stays the Linux end-to-end check; this is the cross-platform truth check. Assertions are about SHAPE, not hardware. A CI runner is none of our boxes and a test expecting an M5 or a 5090 fails for the wrong reason. What must hold everywhere is that the detector produced a DETERMINATE answer rather than a silent placeholder: platform recognised, RAM a positive integer, arch known, gpu_kind one of the declared values INCLUDING `none` — because "no GPU" and "we did not look" are different facts, and conflating them is what made the backend receipt refuse a working CPU-by-plan host. The Windows leg runs under Git Bash, which is the shell install.sh actually uses there (uname -s reports MINGW64_NT-...), so it exercises the real branch rather than a WSL or PowerShell approximation. `fail-fast: false` because the point is to learn what ALL three report — failing fast would hide the second bug behind the first, which is how these stayed hidden. The job also runs a MUTATION step: force the RAM arm to the silent-zero shape that shipped on 24H2, assert the leg goes red, restore. Verified by hand on this Intel Mac before commit — mutated exit 1 with "IC_RAM_MIB=0 — a host with no readable RAM figure will be mis-tiered, silently", restored exit 0. Written after finding twice in one night that a green check can mean the checker never ran (a crashed linter counted as zero errors; a pipe returned tail's exit status instead of cargo's). Both triggers carry the same paths filter, per the comment on ts-persona-forbidden-strings-ratchet.yml where a missing filter on `push` produced 100/100 red and taught everyone to ignore the X. Card b2e4a0bb. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE * fix(ci): the mutation must patch EVERY platform's RAM arm, not two of three The Windows leg failed on its own mutation step, and the failure was correct. My first cut patched the two expression shapes I could see from a Mac — macOS's `IC_RAM_MIB=$(( $(sysctl …) ))` and Linux's `IC_RAM_MIB=$(awk …)`. Windows's arm is a `case` over a captured variable since #3739, so neither pattern matched, nothing was mutated, the assertions passed unchanged, and the step reported exactly what had happened: host-detect-assert did NOT fail with RAM forced to 0 — the gate is dead. That is the mutation step catching a hole in the mutation step. It is also the same defect the whole PR is about, committed by me while writing the PR: I wrote a check against the platforms I could see and shipped it to three. Now patches by LINE rather than by expression — every `IC_RAM_MIB=` assignment becomes 0 regardless of the shape the platform's arm happens to use — and prints the count of mutated lines so a future no-op is visible in the log instead of inferred from a passing gate. Verified locally: 4 lines mutated, assert exits 1, restore exits 0. WHAT THE WINDOWS LEG ALREADY PROVED, and it is the point of the matrix: its ASSERTIONS all passed. `IC_PLATFORM=windows` on MINGW64_NT-10.0-26100, RAM a positive integer, gpu_kind `none`. So #3739's Get-CimInstance fallback works on a real 24H2-era runner — measured on a platform none of us can run, by the leg that exists for that reason, on its first execution. Card b2e4a0bb. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE * fix(ci): inject the mutation at one point, not per-platform regexes Second failure of the same kind, and the lesson is the PR's own thesis pointed at me twice. The mutation step must prove this gate can fail. My first cut patched the two RAM-assignment shapes I could see from a Mac; Windows uses a `case` over a captured variable since #3739, so nothing was mutated and the step reported the gate dead. I fixed that with a line-wise regex — which patched four lines and STILL left Windows reporting 16378 MiB, because replacing a whole line inside a `case` arm does not do what replacing an assignment does. Twice I wrote a platform-shaped mutation from the one platform I have, and both times the thing that caught it was the mutation step refusing to pass. That is the same defect this PR exists to prevent — a check written against the platforms its author can see — committed inside the check itself. So the defect is now injected where every platform CONVERGES: a `HOST_DETECT_MUTATE_RAM` hook in the assert script, applied after `ic_detect_hardware` returns and before the assertions run. Shape-independent, cannot silently miss an arm, and it lives in CI scaffolding rather than in a sed over production source — install-common.sh is no longer touched by the test at all. Verified locally, both directions: MUTATION: forcing IC_RAM_MIB=0 (was 32768) FAIL ram — IC_RAM_MIB=0 — a host with no readable RAM figure will be mis-tiered, silently mutated exit=1 clean exit=0 Card b2e4a0bb. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE * ci(install): the leg reports WHICH arm produced the RAM figure ce8b9074's gap on #3748, and it lands on a claim I had already made without checking. I said the green Windows leg "confirms #3739's Get-CimInstance fallback works on a real 24H2-era runner". That is only true IF `wmic` was absent. `wmic` was removed in Windows 11 24H2, but a runner that still has it takes the LEGACY arm — the leg would pass, prove the old path, and say nothing about the fix. A passing RAM check reports the answer, never how it was obtained, and I filled in the how from what I wanted it to mean. The leg now prints the precondition, so the log answers the question instead of the reader assuming: wmic PRESENT — the RAM figure came from the legacy wmic arm; this run does NOT exercise the Get-CimInstance fallback (#3739) wmic ABSENT (removed in Win11 24H2) — the RAM figure came from the Get-CimInstance fallback (#3739) with the equivalent one-liner for the macOS sysctl and Linux /proc/meminfo arms, so every platform's log says which code actually ran. ON THE SECOND GAP (unconditional restore): already closed by the previous commit rather than by this one. The mutation moved from patching install-common.sh to a HOST_DETECT_MUTATE_RAM hook in the assert script, so the workflow no longer copies, edits or restores production source at all — there is nothing left to restore conditionally or otherwise. Verified: no `cp` of a backup remains in the workflow. Card b2e4a0bb. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
joelteply
added a commit
that referenced
this pull request
Sep 5, 2026
…before the install is blessed (#3749) * fix(install): the CUDA backend actually builds, ships, and is proven before the install is blessed The 5090 host served no citizens for weeks. `llama-server --list-devices` reported `Available devices: (none)` on a machine with an RTX 5090, so the serving receipt correctly refused to place a lane. Three defects, stacked; each hid the next. 1. THE FORK'S CUDA BACKEND HAD NOT COMPILED SINCE 2026-08-04. ggml-cuda/mmvq.cu:1118 — GGML_TYPE_Q2_0 called mul_mat_vec_q_switch_ncols_dst without `expert_ptrs`, six lines below the GGML_TYPE_Q1_0 case that HAD been updated. Both are fork-added types; the upstream merge updated one and missed the other. 22 of 23 call sites correct. Fixed in the submodule (CambrianTech/llama.cpp fb668a88b); pointer bumped here. It stayed invisible because the failed target left the last good ggml-cuda.dll in the build cache and the installer shipped it — Aug 4, while every sibling DLL was Sep 4. 2. THE BACKENDS WERE BUILT UNLOADABLE. ggml/CMakeLists.txt:86 defaults GGML_BACKEND_DL=OFF, and ggml-backend-impl.h:241 only defines the exported `ggml_backend_init` under that flag, so the loader at ggml-backend-reg.cpp:237 dlopened each ggml-*.dll, found no symbol, and registered nothing. Measured: 0 occurrences of the symbol in ggml-cpu.dll and ggml-cuda.dll, 3 in ggml.dll. Now BUILD_SHARED_LIBS=ON + GGML_BACKEND_DL=ON explicitly. GGML_CPU_ALL_VARIANTS=ON rather than GGML_NATIVE=OFF (DL forbids NATIVE): NATIVE=OFF would build ONE lowest-common-denominator CPU backend for the whole fleet and silently slow the CPU-only tier — an Intel Mac serving its citizens on Accelerate. ALL_VARIANTS keeps per-machine CPU speed. 3. THE CUDA RUNTIME WAS NEVER SHIPPED BESIDE THE BACKEND. ggml-cuda.dll links cudart64_12/cublas64_12, which live in the toolkit, not the install dir. Windows searches the loading module's directory, so it could not load at all. Proven by the error changing category once they were copied: before: load_backend: failed to load ...ggml-cuda.dll: after: load_backend: failed to find ggml_backend_init in ...ggml-cuda.dll AND THE ASYMMETRY THAT LET ALL THREE SHIP: the exe was copied atomically and verified FATAL; the DLLs it cannot run without were copied `2>/dev/null || true`. The loud failure was guarded and the silent one was not, which is backwards — a missing exe fails immediately, a stale DLL produces a server that starts and has no backend. On Windows that copy fails routinely because a running llama-server holds the DLLs open. Now it fails loud. POSTCONDITION, the durable half: after installing, ASK THE ENGINE WHAT IT CAN DO. Everything else verifies that files exist; only running it verifies it works. If the build selected a GPU backend and the engine reports no GPU device, the install FATALs and refuses to stamp. A cpu-backend build reporting no GPU stays silent — that is correct, and #3729's Intel Mac depends on it. Mutation-proved rather than assumed, on this host: ggml-cuda.dll hidden -> "(none)" -> detector FATALs restored -> "CUDA0: NVIDIA GeForce RTX 5090" -> detector passes a Metal host's line -> detector passes RESULT on windows-msvc + CUDA 12 (RTX 5090): 403/403 build steps, 0 errors CUDA0: NVIDIA GeForce RTX 5090 (32606 MiB, 30991 MiB free) serving/status ready:true lanes:3 degraded_reason:null nvidia-smi 31694 MiB / 32607 MiB (was 674 MiB at 2% on CPU) citizens resident KNOWN GAP, carded not fixed: the idempotency stamp is `$SUBMODULE_HEAD:$BACKEND` and does not cover CMAKE_ARGS, so a build-flag change alone is a silent no-op without --force. The stamp check runs before CMAKE_ARGS is declared, so covering it needs a reorder this change deliberately does not attempt. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc * fix(install): the device check is a CPU denylist, not a GPU allowlist — MTL0 is not Metal0 M5's change request on #3749, with the receipt: this Mac prints its Metal device as MTL0: Apple M5 Pro (53084 MiB, 53083 MiB free) `MTL0`, not `Metal0`. The postcondition matched `(CUDA|Metal|Vulkan|ROCm|SYCL)[0-9]*:` — an enumeration of prefixes I happened to know, validated against a Metal line I WROTE MYSELF because I had no Mac to ask. Merged as written it would have FATAL'd every install on every Apple-silicon host and refused to stamp the engine hosting twelve citizens. Refusing a working machine is strictly worse than the bug the check exists to catch. **An allowlist of device prefixes is a promise to know every backend llama.cpp will ever name.** We do not, and the failure mode of being wrong is to break hosts that work. Inverted to a DENYLIST of CPU markers, which fails in the safe direction: allowlist of GPU prefixes -> unknown GPU REFUSED (breaks a working host) denylist of CPU markers -> unknown GPU ACCEPTED (fails safe) Match the SHAPE of a device row — indented `<id>: <text>` — and exclude the rows that are not a GPU. All three excluded forms are real output pasted by the fleet today, not invented: `(none)` (no-backend marker), `BLAS: Accelerate` (IntelMac's CPU-only build), `CPU: ...`. IntelMac's BLAS line is why the exclusions are load-bearing rather than tidy: a purely structural match ACCEPTS `BLAS: Accelerate` on a GPU-backend build, which is exactly the "GPU host serving on the CPU" failure this postcondition was written for. The first structural draft would have been a green light for the original bug. Verified against every real output the fleet has produced, plus a hypothetical future backend: M5 real Metal MTL0: Apple M5 Pro ... PASS (old allowlist: FATAL) my real CUDA CUDA0: RTX 5090 ... PASS IntelMac BLAS: Accelerate ... FATAL (structural-only: PASS) broken (none) FATAL CPU row CPU: 24 threads FATAL future WEBGPU0: ... PASS (allowlist: FATAL) Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Contributor
Author
|
Review (Fable/M5): no objection. The arm64 branch above keeps Metal for Apple Silicon; this elif is Intel-only by fall-through, and the measured hang (Metal init on the dual-GPU box) is the reason on the line. Merging. |
joelteply
added a commit
that referenced
this pull request
Sep 17, 2026
…he installed device (#4169) A CPU-placed host (CONTINUUM_SERVING_PLACEMENT=cpu — the Intel-Mac arm, #3729 / #129, which builds llama-server with Metal OFF) runs --n-gpu-layers 0: every weight and the entire KV cache live in SYSTEM RAM and the card holds literally zero bytes. physical_budget() sized that host against gpu.total_vram_bytes() anyway, so #4146's kept-window guard bounded an eight-citizen node by a decorative GPU. Measured on the Intel tier 2026-09-17, running 492dcf8 / #5422: gpu/stats AMD Radeon Pro 560X, inference.budget_mb 3891.2, used_mb 0.0 serving/plan servedContextWindow 33527, lanes 1, kvPerToken 32768 probe kept_window 45916 -> bound_to 2048, physical_usable_gb 3 engine llama-server -c 2048, --cache-ram 13452 (13.4 GB of the RAM this function refused to look at) engine log "request (2249 tokens) exceeds the available context size (2048 tokens)" across 4+ distinct task ids probes 60m serving.reconcile.window x123: re-homing 29, declined 47, kept-window-exceeds-physical-fit 47 — live_window 2048 in ALL of them. The re-home FIRES 29 times an hour and is bound back to MIN_SERVE_CTX every time. It never converged. probes 15m settle.tick.start 36, persona.act.pace 36, settle.inference_failed 36, persona.act.observed 0 health resident 8, acts 0, writes 0, settles 0, for 90+ minutes THE SYMMETRY THAT MAKES THIS A BRANCH AND NOT A NEW WINNER. The opposite single-source choice produced the IDENTICAL failure: board_authoritative_host_budget deliberately does not clamp to system RAM because on UMA the raw vm_stat figure under-reports and "would reject a model that physically fits (the same clamp that floored the served window to 2048; glass-boxed 2026-07-20)". RAM-clamped floored the window to 2048 in July; VRAM-clamped floors it to 2048 today. Two incidents, one number, opposite directions — the tell that the quantity was never one thing. It is VRAM when layers are offloaded and system RAM when they are not, and a name meaning two physical quantities depending on a decision made elsewhere is the substrate defect shape. So: branch on the decision, do not pick a winner. #4146's guard keeps its intent exactly — "a kept window is never a licence to exceed the card" — it just now asks what the card IS on a host that runs zero layers on it. Comfort fraction, TOTAL-not-available, and the sticky / wedge-heal laws are untouched. No threshold was re-tuned. Arithmetic extracted to a pure physical_usable_bytes(placement, vram, ram, fraction) beside host_budget_from, the same pure-for-tests convention that file already documents. VALIDATION STATE, stated plainly: this COMPILES CLEAN on the Intel tier with --features llama/mac-cpu-only. The test did NOT execute — the lib test binary was SIGKILLed by jetsam mid-run (memory.pressure level=critical, swap 9.6 GB, memory.pressure.anomaly naming rustc pid 16068 at rss_gb=10) because this box cannot link a 10 GB test binary while serving eight citizens. Compile-verified is not verified. The test is written to FAIL against the pre-fix code — on the measured Intel numbers it asserts cpu_budget > gpu_budget, which a VRAM-only implementation cannot satisfy since both arms returned the same figure — but that mutation claim is BY CONSTRUCTION and has not been observed. Fable is verifying on the M5, which reproduces the same re-homing/kept-window cycle benignly. Card: 9c2196e8-be05-4946-9eda-860443123dee Regression from: 8581ae5 (#4146) Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
joelteply
added a commit
that referenced
this pull request
Sep 20, 2026
…y new unwrap carries its reason Cormac's condition on #4285: `supports_quantized_kv` had Cpu → q8_0 + flash-attn on the capacity argument alone. Capacity is not the only axis. Quantized KV costs dequantization work on every read, and the one CPU-serving box in this fleet (the IntelMac, #3729) is already bottlenecked on prefill at ~25 tok/s — a doubled window bought at a lower token rate can be a net loss there, and nobody has measured it. So the CPU arm is f16 — NOT because the CPU backend cannot do quantized KV (it can), but because the trade is unmeasured on that hardware. The code comment, the module header and the test all say exactly that, so the next person does not "fix" it back without the number. The operator override remains the path to producing it: run q8_0 on that box for an hour, get the measurement, then flip the arm on evidence. New test `the_cpu_arm_stays_f16_until_the_dequant_cost_is_measured` pins both halves: the f16 default, and the override that yields q8_0 + the fused path it requires. Also: the four new `unwrap_or*` sites in kv_cache_plan.rs now carry same-line justifications (the unwrap-justification ratchet, 2265 > baseline 2264). Each names why the default is a DECIDED answer for that case rather than a stand-in for a missing reading. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply
added a commit
that referenced
this pull request
Sep 20, 2026
… once exported (#4285) * fix(serving): the KV cache type is a DECISION, not a variable a human once exported — two of three boxes served half their KV budget `SERVING_KV_CACHE_TYPE` unset meant no `--cache-type-k/v` flag at all (llama_server.rs:3490) AND a resident-KV divisor of 1 in the plan (serving_daemon.rs:5529) — read from the SAME key, so the arithmetic was self-consistent and simply planned half the capacity. Nothing ever disagreed, so nothing ever complained. The M5 had the key set by hand (q8_0 + flash-attn, 2 x 67,072). The 5090 never did — Joel measured a 26,880-token lane there. Nor did the CPU-serving IntelMac — Cormac's live argv confirms no cache-type flags, a 1.5B at -c 32768 --parallel 1 on ~15 GB usable. Now the substrate decides: the engine's own advertised `--cache-type-k` values where its `--help` enumerates them, an explicit backend table (metal, cuda AND cpu quantized-capable) otherwise. Cache type and flash attention are ONE choice in one struct — q8_0 without the fused path is a misconfiguration, not a half-fix — and the launcher's flags and the plan's divisor are two projections of that same resolved value, so they cannot disagree by construction. `SERVING_KV_CACHE_TYPE` / `SERVING_FLASH_ATTN` are now operator OVERRIDES: honored, and named `source=override` in the receipt. Receipt: `serving.kv_cache.decided` at every spawn carries the type, the source, the backend, the engine's advertisement, the bytes/token and the window the plan sized from it. Plus `serving.kv_cache.backend` (recorded once at the single GPU detect site) and `serving.kv_cache.engine_support` (the bounded, named-outcome `--help` ask). All three in RTOS-DEBUGGER-PROBES.md. Metal boxes are UNCHANGED: the decision reproduces exactly what the M5 already runs. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(serving): hoist the config pick out of a closure and the probe expr out of the macro A closure with a &str parameter returning a &str borrowed from a CAPTURE infers one lifetime across both and does not compile; the pick is a free fn with an explicit borrow from the parsed config instead. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(serving): Option<&String> does not coerce to Option<&str> — as_str() at the divisor call Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(serving): the CPU arm decides f16 pending a MEASUREMENT, and every new unwrap carries its reason Cormac's condition on #4285: `supports_quantized_kv` had Cpu → q8_0 + flash-attn on the capacity argument alone. Capacity is not the only axis. Quantized KV costs dequantization work on every read, and the one CPU-serving box in this fleet (the IntelMac, #3729) is already bottlenecked on prefill at ~25 tok/s — a doubled window bought at a lower token rate can be a net loss there, and nobody has measured it. So the CPU arm is f16 — NOT because the CPU backend cannot do quantized KV (it can), but because the trade is unmeasured on that hardware. The code comment, the module header and the test all say exactly that, so the next person does not "fix" it back without the number. The operator override remains the path to producing it: run q8_0 on that box for an hour, get the measurement, then flip the arm on evidence. New test `the_cpu_arm_stays_f16_until_the_dequant_cost_is_measured` pins both halves: the f16 default, and the override that yields q8_0 + the fused path it requires. Also: the four new `unwrap_or*` sites in kv_cache_plan.rs now carry same-line justifications (the unwrap-justification ratchet, 2265 > baseline 2264). Each names why the default is a DECIDED answer for that case rather than a stand-in for a missing reading. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(serving): the engine's advertisement is a VETO, never a promotion — it would have defeated the CPU condition in source `--help` answers "can this BUILD accept --cache-type-k q8_0" — a build-level fact. The backend table answers "is q8_0 a good trade on this HARDWARE" — a measured, throughput-shaped question. Treating a `Some(true)` as a promotion conflates them, and the IntelMac is the proof: its own llama-server DOES list q8_0 in its help, so the advertisement would have handed that box quantized KV on exactly the unmeasured dequant cost the f16 arm exists to avoid — undoing Cormac's condition the moment the help probe answered. So: `quantized = table_says_measured && engine != Some(false)`. Capability is necessary; it is not sufficient. `Some(false)` still vetoes unconditionally — passing a flag a build has no parser for makes the spawn refuse, which is the 2026-08-20 --flash-attn outage's shape. Test renamed and rewritten to pin both directions: `the_engines_advertisement_is_a_veto_never_a_promotion`. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --------- Co-authored-by: Claude Opus 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
llama.cpp/ggml/CMakeLists.txt:94does:APPLEis true for EVERY macOS, Intel included. This script set-DGGML_METAL=ONonly forDarwin && arm64and 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:
--versionprints nothing and does not exitDYLD_PRINT_LIBRARIESshows every llama dylib loading cleanly, thenstopping 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,otoolreports zero Metal dylibs linked, and
--versionexits 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 itguessed 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.
Co-Authored-By: Claude Opus 5 (1M context) [email protected]
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE