Skip to content

Pin llama.cpp 8c71384: IQ4_NL / IQ4_XS on HRX (Qwen3.8-27B UD: 58% -> 72% of Vulkan) - #234

Merged
bong-water-water-bong merged 2 commits into
mainfrom
pin-hrx-iq4
Sep 29, 2026
Merged

bong-water-water-bong merged 2 commits into
mainfrom
pin-hrx-iq4

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Moves third_party/llama.cpp c9283cf -> 8c71384 (fork #41). Regenerates the registry and updates docs/hrx.md.

HRX declined IQ4_NL / IQ4_XS because AMD's nibble packers remapped every table index (XOR 12) for a lowering that doesn't apply on gfx1151. So every Unsloth UD GGUF ran its IQ4 matmuls on the CPU. Fork #41:

  • picks the other session's fix for the shared packers;
  • fixes a second copy of the remap in the Q5_K/IQ4_XS prefill kernel;
  • fixes the q8-plane SwiGLU placeholder binding that IQ4 on HRX exposed.

Qwen3.8-27B UD-Q4_K_XL on strixhalo, HRX0:

  • graph splits 91 -> 1;
  • wikitext 4×512 PPL 5.8294 (CPU 5.8288);
  • decode 7.25 -> 9.0 tok/s at 130 W (Vulkan 12.5), flat over a 2.5-minute sustained run;
  • ZAYA1-8B unchanged (90 tok/s).

RFC #213: the 27B is the one model still under the decode gate (72%). The remaining gap is the Q5_K/IQ4_XS decode kernels' memory bandwidth.

🤖 Generated with Claude Code

bong-water-water-bong and others added 2 commits September 29, 2026 16:04
@context7

context7 Bot commented Sep 29, 2026

Copy link
Copy Markdown

Docs7 for 1bit-monster/engine

Result Status Action
Deployment ➖ Not used —
Content review ➖ Did not run. This site has no agent runs available this month. Wait for the monthly reset or check your Docs7 plan. —

Commit 4cea856

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Outdated Documentation

The documentation in docs/hrx.md still refers to the old llama.cpp commit and mentions that IQ4_NL and IQ4_XS matmul kernels give wrong values and are left to the CPU. However, the PR updates the llama.cpp commit to 8c71384 which includes fixes for these issues. The documentation should be updated to reflect that these kernels are now correctly supported on HRX.

views), which cannot move. Leaf (`NONE`) nodes count as covered. GET_ROWS for batched IQ3_S
gives wrong values, so those nodes are left to the CPU. IQ4_NL and IQ4_XS were left to the CPU too
until [llama.cpp #41](https://github.com/1bit-MONSTER/llama.cpp/pull/41) (below).
Incomplete Feature Description

The documentation in docs/hrx.md describes IQ4_NL / IQ4_XS on HRX as fixed, but does not fully capture the performance improvements mentioned in the PR description. Specifically, the PR mentions a 72% decode performance improvement for Qwen3.8-27B UD-Q4_K_XL, which is not reflected in the documentation update.

- **IQ4_NL / IQ4_XS on HRX ([llama.cpp #41](https://github.com/1bit-MONSTER/llama.cpp/pull/41)).**
  AMD's IQ4 nibble packers remapped every table index (XOR 12) for a lowering that does not apply on
  gfx1151, in `motifs/dequant.loom` and again in the Q5_K/IQ4_XS prefill kernel, so IQ4 was declined
  and ran on the CPU. #41 fixes both copies and the q8-plane SwiGLU path they exposed. Qwen3.8-27B
  UD-Q4_K_XL: 91 graph splits -> 1, wikitext PPL 5.8294 (CPU 5.8288), decode 7.25 -> 9.0 tok/s
  (Vulkan 12.5); `test-backend-ops -b HRX0` passes the IQ4 MUL_MAT and GET_ROWS cases. The rest of
  the 27B gap is Q5_K / IQ4_XS decode kernels reading at ~105-176 GB/s against Vulkan's ~220.

@bong-water-water-bong
bong-water-water-bong merged commit 8b33745 into main Sep 29, 2026
11 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the pin-hrx-iq4 branch September 29, 2026 19:08
bong-water-water-bong pushed a commit that referenced this pull request Nov 7, 2026
…h (fork #234 removed it)

#1351 (merged) pins llama.cpp ed43da0b4, which **removes** GGML_HRX_WEIGHT_HOST_PLACEMENT (git grep at that pin: 0 hits)
and replaces the weight-mapping import with read() + posix_fadvise(DONTNEED). On such a build the row's env var is
ignored, both arms take the same path, their own-GTT readings are identical, and the verdict would return FAIL - a red
release-check row caused by a row measuring a mechanism that no longer exists. A gate that fails a correct build is its
own defect.

So the row now asks the shipped code which mechanism it has: hrxp_has_switch() looks for GGML_HRX_WEIGHT_HOST_PLACEMENT in
the shipped libggml-hrx (the string the code reads), and when it is absent the row SKIPs with the reason - naming fork
#234 / engine #1351 and saying both arms would be identical - instead of failing. On a build that has the switch (which is
what c32 carries: llama.cpp 67d8c42ec, 3 hits) it measures exactly as before.

Not rewritten to the new mechanism yet, on purpose: #1351's own arm is page-cache residency (16.5 GiB -> nothing), peak RSS
(16.4 -> 2.9 GiB) and load time (14.3 -> 18.6 s), and a row for it has to be built and measured on a pin that has #234
before it may gate one - writing an unmeasured branch into a release gate is the failure this lane refuses. That is the
next roll's work; the shape (pure verdict function, --self-test, two arms, skip-not-fail, process-group cleanup) is kept.

Measured: --self-test 82 cases PASS; the release lane's harness now 23/23 - the new cases prove a no-switch build SKIPs
with that reason and starts no arms, while a -switch build still PASSes, FAILs on equal arms, and names a dead arm.
bong-water-water-bong added a commit that referenced this pull request Nov 8, 2026
…he switch's docs (#1350)

* release-check: measure the HRX weight placement (engine #1339's mitigation), not the switch's docs

#1339: importing the loader's weight mapping instead of copying it to the device (fork #226) saves GTT - the 4B goes
from 3925 to 1243 MiB of the process's own GTT - but on large files the import never finishes: a dense 16.4 GiB 27B and
a 76.3 GiB Flash-Next sat in it for 72 minutes with no error, while the device copy loads in 20-75 s. Fork #231 (pinned
since #1343) makes the import OPT-IN: `GGML_HRX_WEIGHT_HOST_PLACEMENT=1` asks for it, unset or 0 keeps the device copy.

Nothing prints that switch: `llama-server --list-devices` prints name/description/size only (common/arg.cpp:1064-1088 at
the pin), the backend logs nothing at the decision (`device_buffer_from_host_ptr`, ggml-hrx.cpp:915), and
`1bit serve --print-backend-env` has no placement variable. So this row measures the thing itself, the way the issue did:

  * load one NAMED model twice with the shipped engine (`1bit serve --device hrx --ctx-size 512`), once default and once
    with the switch on, and weigh each serve process's own `drm-total-gtt` out of /proc/<pid>/fdinfo;
  * PASS when the default arm costs materially more GTT than the opt-in arm (relative, 15 % floor - the issue's own arms
    are 1.89x and 3.16x, so no absolute MiB threshold can drift with ctx or slots), with both arms up;
  * FAIL naming which arm did not come up when one never answers /health.

The model is named because it must be UNTIED: fork #233 (#1316) moves a tied embedding's placement, so a tied model would
differ between the arms for a second reason. The row uses the staged Qwen3-4B-Instruct-2507-Q4_K_M (token_embd.weight and
output.weight both present, no tie_word_embeddings), SKIPs when that model is not staged rather than substituting another,
and sits before the chat rows so the two arms load into a quiet device.

Outcome evidence for a >16 GiB load cannot live on a stick whose largest staged model is 2.4 GB; the row says so and
cites #1339.

Measured: `--self-test` 82 cases (9 new), PASS. Proof harness in the release lane drives the row's own bytes with a
stub serve: issue arms PASS, equal arms FAIL, reversed FAIL, either arm dead FAIL naming it, no /dev/kfd SKIP, no staged
model SKIP - 19/19.

* release-check: hrx-placement skips when the build has no import switch (fork #234 removed it)

#1351 (merged) pins llama.cpp ed43da0b4, which **removes** GGML_HRX_WEIGHT_HOST_PLACEMENT (git grep at that pin: 0 hits)
and replaces the weight-mapping import with read() + posix_fadvise(DONTNEED). On such a build the row's env var is
ignored, both arms take the same path, their own-GTT readings are identical, and the verdict would return FAIL - a red
release-check row caused by a row measuring a mechanism that no longer exists. A gate that fails a correct build is its
own defect.

So the row now asks the shipped code which mechanism it has: hrxp_has_switch() looks for GGML_HRX_WEIGHT_HOST_PLACEMENT in
the shipped libggml-hrx (the string the code reads), and when it is absent the row SKIPs with the reason - naming fork
#234 / engine #1351 and saying both arms would be identical - instead of failing. On a build that has the switch (which is
what c32 carries: llama.cpp 67d8c42ec, 3 hits) it measures exactly as before.

Not rewritten to the new mechanism yet, on purpose: #1351's own arm is page-cache residency (16.5 GiB -> nothing), peak RSS
(16.4 -> 2.9 GiB) and load time (14.3 -> 18.6 s), and a row for it has to be built and measured on a pin that has #234
before it may gate one - writing an unmeasured branch into a release gate is the failure this lane refuses. That is the
next roll's work; the shape (pure verdict function, --self-test, two arms, skip-not-fail, process-group cleanup) is kept.

Measured: --self-test 82 cases PASS; the release lane's harness now 23/23 - the new cases prove a no-switch build SKIPs
with that reason and starts no arms, while a -switch build still PASSes, FAILs on equal arms, and names a dead arm.

---------

Co-authored-by: pi-release <[email protected]>
bong-water-water-bong pushed a commit that referenced this pull request Nov 8, 2026
…ce (Refs #1339)

The paragraph in docs/zyphra-models.md that cleared up the CPU-side input GET_ROWS ended with "it is not the #856
host-pointer import, which GGML_HRX_WEIGHT_HOST_PLACEMENT=0 shows changes nothing here". That was true when
written and is stale at this pin: the import was replaced (#234, pin ed43da0b4) and the variable no longer
exists - docs/hrx.md already records "GGML_HRX_WEIGHT_HOST_PLACEMENT does nothing". A reader following the
citation would look for a knob that is not in the tree.

The claim itself still holds and is now stated so it survives the removal: while the import existed, the
variable reproduced the placement identically, and the import is no longer in the tree at all, with hrx.md as
the record. This is the qualifier the #1356 review asked for, taken as a rewrite rather than a "(at pin X)"
footnote because the honest reading at this pin is that there is nothing left to toggle.

Refs #1339
bong-water-water-bong added a commit that referenced this pull request Nov 8, 2026
…ce (Refs #1339) (#1390)

The paragraph in docs/zyphra-models.md that cleared up the CPU-side input GET_ROWS ended with "it is not the #856
host-pointer import, which GGML_HRX_WEIGHT_HOST_PLACEMENT=0 shows changes nothing here". That was true when
written and is stale at this pin: the import was replaced (#234, pin ed43da0b4) and the variable no longer
exists - docs/hrx.md already records "GGML_HRX_WEIGHT_HOST_PLACEMENT does nothing". A reader following the
citation would look for a knob that is not in the tree.

The claim itself still holds and is now stated so it survives the removal: while the import existed, the
variable reproduced the placement identically, and the import is no longer in the tree at all, with hrx.md as
the record. This is the qualifier the #1356 review asked for, taken as a rewrite rather than a "(at pin X)"
footnote because the honest reading at this pin is that there is nothing left to toggle.

Refs #1339

Co-authored-by: agent <agent@local>
bong-water-water-bong added a commit that referenced this pull request Nov 23, 2026
…nd measures it right (engine#3353) (#3368)

* release-check: hrx-placement measures the mechanism the engine has, and measures it right (engine#3353)

The row compared GGML_HRX_WEIGHT_HOST_PLACEMENT, the weight-mapping import fork #234 removed, so it skipped on every
build. It now compares the shipped default (the loader's file mapping as a host buffer, llama.cpp #304 / engine#856)
with GGML_HRX_MODEL_BUFFER_COPY=1 (the upload), and PASSes when the upload costs >= 15% more of its own GTT.

Three measurement bugs found on the board on the way (each reported 3-4 MiB):
- hrxp_gtt divided drm-total-gtt, a KiB value on 7.4, by 1024*1024: GiB printed as MiB. Now unit-aware.
- 1bit serve answers /health while its llama-server still loads; the arm's short question (needed: #304 makes the
  device copies at the first prompt) now retries until it is answered.
- the arm is weighed as its whole process tree; and a verdict floor fails an arm below half the model file.
Self-tests: the verdict cases rewritten, a long-prompt FAIL case (1.04x), the 3/4 MiB case, and hrxp_gtt over fake
fdinfo (KiB + MiB = 3206 MiB).

Measured on strixhalo (v2026.48, Qwen3-4B-Instruct-2507 Q4_K_M from $HF_HOME/hub, box-hold gpu): default 3204 MiB,
upload 4506 MiB -> PASS.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* release-check: keep the hrx-placement floor comment's wording (guard_loss_check)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: bong-water-water-bong <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant