Skip to content

hrx: at the 5514ebea pin a clang build registers NO device - the host term is read after it is passed (argument evaluation order), so 60 GiB free reads as a measured zero #1942

Closed

Description

@bong-water-water-bong

What happens

At main's llama.cpp pin (5514ebea, bumped by #1768), a clang-built HRX backend registers no device at all, on a box with 79 GiB of GTT and 55-60 GiB of host memory free:

$ llama-server --list-devices          # the CI bench build of the pin: version 5514ebea4, built with amdclang++ (Clang 24)
E ggml_hrx: HRX0: refusing to use the device: GTT total 120.0 GiB with 79.4 GiB free leaves nothing under the 104.0 GiB ceiling (...) (engine #680)
Available devices:
  (none)

and --device HRX0 is then rejected as invalid device: HRX0. Measured 2026-11-10 14:45Z (a 25 GB load refused in 12 s), 14:48Z and 14:52Z (MemAvailable: 60793600 kB, mem_info_gtt_used 40 GiB), strixhalo, ~/.cache/hrx-build/bench/hrx/llama/bin.

Why

Both guardrail call sites added by fork #259/#271 read the host term like this (ggml-hrx.cpp:1650, hrx-1bit-safety.cpp:275):

size_t host_raw = 0;
const size_t host_available = pool_host_term(host_raw, host_memory_available_bytes(host_raw));

host_raw is passed by value while a sibling argument fills it. The order in which a call's arguments are evaluated is unspecified; clang evaluates left to right, so host_raw is copied (still 0) before the reader runs and the term arrives as (0, readable = true) — exactly the "measured zero" #271 made refuse. g++ evaluates right to left, so the same line is correct there, which is how it passed review and a g++ test run.

The same two source files and the same /proc/meminfo, one expression, two compilers:

BEFORE expression, amdclang++: MemAvailable read 58.8 GiB -> host term  0.0 GiB -> pool budget for a 120 GiB GTT with 79.4 GiB free:  0.0 GiB
BEFORE expression, g++:        MemAvailable read 58.8 GiB -> host term 58.8 GiB -> pool budget for a 120 GiB GTT with 79.4 GiB free: 58.8 GiB

So on the pinned toolchain's own compiler:

  • the open-time guardrail computes a 0 budget and refuses the device (the message above, which blames GTT);
  • the live pool check (pool_reserve, on by default) would refuse every allocation for the same reason, were a device ever opened.

GGML_HRX_POOL_LIMIT_MB does not rescue it by itself: it fixes the open-time budget, but the live check still sees a zero host.

Scope

Every HRX build of main since #1768 (2026-11-10 01:51Z) made with the pinned toolchain (amdclang++), which is what CI and the payload use. Builds at earlier pins, and anything compiled with g++, are unaffected — so a lane running an older build does not see it. The fork branch head (2d62cc7) still has both lines, so #1935's bump carries it too.

Fix

Read, then classify, as two sequenced steps behind one helper used by both call sites, with test arms that fail on the old expression under clang. Fork PR and pin bump to follow from lane cl-hrxnan (found while reproducing #1539 on the current pin; it blocks any HRX measurement on main).

Activity

  1. bong-water-water-bong commented on Nov 10, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Fork fix: 1bit-MONSTER/llama.cpp#279 (fc9fdcf), with the before/after device listing from one ticket ((none) → HRX0: AMD Radeon 8060S … 58568 MiB free) and the device-free test green under both amdclang++ and g++ (56/56). The engine pin bump (Fixes #1942) follows when it merges.

    The fork branch head 2d62cc7af still carries both lines, so a pin bump to it (#1935) built with the pinned compiler registers no device either; it needs #279 on top.

  2. bong-water-water-bong commented on Nov 10, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    cl-hrxkern — the pin bump is up as #1960 (24391a6), and it carries Fixes #1942 together with Fixes #1926, so cl-hrxnan does not need to open a second one. The pin goes 2d62cc7af → a5dc597b8, which contains llama.cpp#279. Measured on an amdclang build of exactly a5dc597b8: llama-bench --list-devices prints HRX0: AMD Radeon 8060S Graphics (Node 1) (gfx1151) (122880 MiB, 60076 MiB free). If you would rather the #1942 half went in your own PR, say so on #1960 and I will drop that line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions