Skip to content

docs: IQ4_NL / IQ4_XS on the Loom path, re-verified (engine#559) - #567

Merged
bong-water-water-bong merged 2 commits into
mainfrom
1bit/docs-iq4nl-verified
Oct 25, 2026
Merged

bong-water-water-bong merged 2 commits into
mainfrom
1bit/docs-iq4nl-verified

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Closes engine#559 as already fixed, now verified — the dequant was corrected by fork #41, and a fresh check on the Loom-only path shows the codebook is right. This PR updates the docs bullet, which still read as an open gap; it changes no code because there is nothing left to change.

What the corpus does today

ggml/src/ggml-hrx/kernel-corpus/kernels/loom-libs/motifs/dequant.loom builds the value table -127, -104, -83, -65, -49, -35, -22, -10, 1, 13, 25, 38, 53, 69, 89, 113 — exactly ggml's kvalues_iq4nl — and indexes it with vector.table.lookup. There is no XOR-12 on the IQ4_NL path anywhere in the corpus (grep xori finds only K-quant sign unpacking, the RmsNorm pair loop and the Hadamard butterfly). The fork tip is not special: the engine's own pinned source has the same code.

Verification (strixhalo, HRX0, 2026-10-25)

Built test-backend-ops from the engine's pinned fork source with -DGGML_HRX=ON and no HIP add-on, so every case below goes through the Loom corpus:

op result
MUL_MAT iq4_nl, n=1..9, k=256 OK (vs the CPU double reference)
MUL_MAT iq4_xs, n=1..9, k=256 OK
GET_ROWS iq4_nl, be1=1 OK
MUL_MAT_ID iq4_nl / iq4_xs not supported — the Loom corpus does not claim it, so the node takes the CPU; it never decodes garbage
totals 0 FAIL, 2/2 backends passed in both runs

So the issue's premise — garbage mul_mat_id on the Loom-only path — does not reproduce: what runs is numerically correct, and what does not run is declined, not wrong. With the HIP add-on (the engine's normal build) the routed-expert kernels handle IQ4_NL on HRX anyway.

What stays open, and is not this bug

  • k=32 projections (MUL_MAT iq4_nl …,k=32): shape coverage, not the codebook.
  • GET_ROWS on a view (v=1) and the batched gather (be1=7) — the batched-gather gap engine#390 already reported, where q8_0 fails the identical case, so the quant is not the variable.

Docs

docs/hrx.md, the IQ4_NL / IQ4_XS bullet moves from "Not yet" to done: it names fork #41, says what the dequant does now, and records the table above, including that MUL_MAT_ID is declined on a Loom-only build rather than wrong.

python3 tools/copyright.py --check → rc 0. No numbers beyond the runs above; nothing measured beyond test-backend-ops.

🤖 Generated with Claude Code

The "Not yet" bullet for IQ4_NL/IQ4_XS still read as an open gap. It was closed by fork #41 - the shared
dequant reads the real `kvalues_iq4nl` table through a table lookup and the corpus has no XOR-12 on that
path - so the bullet now says so and records a fresh check on the Loom-only path (a build with no HIP
add-on, so every case runs through the Loom corpus), 2026-10-25:

  test-backend-ops -b HRX0
    MUL_MAT iq4_nl  OK for n=1..9 at k=256; iq4_xs the same
    GET_ROWS iq4_nl OK at be1=1
    0 FAIL, 2/2 backends passed

Two groups stay declined rather than wrong, both shape coverage and not the codebook: k=32 projections
and GET_ROWS on a view or with a batched gather (v=1, be1=7), where q8_0 fails identically - the quant is
not the variable, which is what #390 established. And MUL_MAT_ID for iq4_nl/iq4_xs is not claimed by the
Loom corpus at all, so routed experts of those types take the CPU on a Loom-only build instead of
decoding garbage; the build the engine ships carries the HIP add-on, whose routed-expert kernels handle
them on HRX.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

PR Reviewer Guide 🔍

(Review updated until commit 3002740)

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

559 - Partially compliant

Compliant requirements:

  • The IQ4_NL nibble remap in the Loom dequant motif now correctly uses kvalues_iq4nl
  • The Loom mul_mat_id behavior is verified to match the CPU reference on a Loom-only build
  • The documentation is updated to reflect that the issue is fixed

Non-compliant requirements:

  • The PR does not include any code changes, only documentation updates

Requires further human verification:

  • The verification of the Loom-only path behavior should be confirmed by running the tests on the actual hardware
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Documentation Update

The documentation update correctly reflects that the IQ4_NL / IQ4_XS issue has been resolved. However, it's important to ensure that all claims made in the documentation are verified on the actual hardware, especially the performance improvements and correctness of the fix.

- **IQ4_NL / IQ4_XS on HRX ([llama.cpp #41](https://github.com/1bit-MONSTER/llama.cpp/pull/41), done).**
  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: the shared
  dequant now reads the real `kvalues_iq4nl` table through a table lookup, and the corpus contains no
  XOR-12 on that path at all. 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).

  Re-verified on the **Loom-only** path on 2026-10-25 (a build with no HIP add-on at all, so every case
  below runs through the Loom corpus). `test-backend-ops -b HRX0`: `MUL_MAT` iq4_nl **OK** for n=1..9 at
  k=256, iq4_xs the same, `GET_ROWS` iq4_nl **OK** at `be1=1`; **0 FAIL, 2/2 backends passed**. Two
  groups stay *declined* rather than wrong, and both are shape coverage, not the codebook: `k=32`
  projections and `GET_ROWS` on a view or with a batched gather (`v=1`, `be1=7` — the same gap
  [390](https://github.com/1bit-MONSTER/engine/issues/390) found, where `q8_0` fails identically, so the
  quant is not the variable); and **`MUL_MAT_ID` for iq4_nl / iq4_xs**, which the Loom corpus does not
  claim at all, so routed experts of those types take the CPU on a Loom-only build instead of decoding
  garbage. The build the engine ships carries the HIP add-on, whose routed-expert kernels handle those
  types on HRX.

@bong-water-water-bong
bong-water-water-bong enabled auto-merge (squash) October 25, 2026 12:57
@bong-water-water-bong
bong-water-water-bong merged commit 99040ce into main Oct 25, 2026
8 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the 1bit/docs-iq4nl-verified branch October 25, 2026 13:02
@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit 3002740

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