Skip to content

docs/hrx: document GGML_HRX_IQ3S_TABLE_DECODE with its measured effect and why it is not yet a default (#572) - #1347

Merged
bong-water-water-bong merged 2 commits into
mainfrom
docs/572-iq3s-knob
Nov 7, 2026
Merged

bong-water-water-bong merged 2 commits into
mainfrom
docs/572-iq3s-knob

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Part of #572.

Fork #216 shipped GGML_HRX_IQ3S_TABLE_DECODE, and the pin now carries it — engine main c752b66e pins llama.cpp
092eb9dbc, and 469c69f5d (#216) is an ancestor of it. docs/hrx.md never mentioned the knob. This adds the section,
with the numbers and the reason it is not a default.

  • Flash-Next's 48 MoE blocks are a quant mix: for UD-IQ4_XS, ffn_gate_exps/ffn_up_exps are IQ3_XXS on 28 blocks
    and IQ4_XS on 17. On identical geometry the IQ3_XXS blocks cost ~2.4x the IQ4_XS blocks (79.94 vs 33.34 ms per
    dispatch at 10x639, from the dispatch profiler).
  • GGML_HRX_IQ3S_TABLE_DECODE=1 selects a second router-expert kernel that decodes the IQ3_XXS grid from a small
    per-workgroup table instead of selecting it out of 256 inline constants per packet. Off by default.

Measured, one hold, control arm on the same binary:

cell control =1
pp4096 270.62 tok/s 318.52 1.18x
pp4096 (second window) 140.84 182.10 1.29x
pp512 177.62 221.38 1.25x
PPL 8x512 1.7198 1.7198 identical

The PPL row is the substance: unchanged to four decimals and identical across three separate windows, so the faster
decode is the same arithmetic.

Two caveats are in the text, not implied:

…t not in the docs

The knob shipped with fork #216 and the pin now carries it (engine main c752b66 pins llama.cpp 092eb9dbc, and
469c69f5d is an ancestor), but docs/hrx.md never mentioned it. Rule: docs travel with the behaviour they describe.

What it says: Flash-Next's 48 MoE blocks are a quant mix (UD-IQ4_XS keeps IQ3_XXS on 28 of them), IQ3_XXS blocks cost
~2.4x the IQ4_XS blocks on identical geometry, and the knob selects a second router-expert kernel that decodes the
IQ3_XXS grid from a per-workgroup table. Off by default; unset or 0 is the shipping path.

Measured, one hold, control arm on the same binary: pp4096 270.62 -> 318.52 (1.18x) and 140.84 -> 182.10 (1.29x) in a
second window, pp512 177.62 -> 221.38 (1.25x), PPL 8x512 1.7198 -> 1.7198 identical (and identical in three separate
windows). The absolute tok/s carry their own warning: the same arm has read 182-318 tok/s across windows for identical
flags, so only paired ratios are quoted.

Why it stays opt-in, written into the section rather than left implicit: those two windows ran on a fork commit that
predates #227, and a 3,858-token prompt on it intermittently died in the CPU fallback of SET_ROWS (engine #1251). A
default change needs the long-prompt cell and test-backend-ops -o MUL_MAT -b HRX0 on the current pin; neither has been
run by this lane.

Part of #572.
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

#1347 ready for review at f57803d (engine #572: documents the shipped-but-undocumented GGML_HRX_IQ3S_TABLE_DECODE with the paired pp4096 1.18x/1.29x and pp512 1.25x rows, PPL identical 1.7198 x3, and the two reasons it stays opt-in: absolute tok/s swing 182-318 for identical flags, and both windows predate #227 so the #1251 long-prompt cell is still unrunnable here)

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

Preparing review...

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY at f57803da9964.

Every factual claim in the new section checks out at the current pin — which is the only thing a doc about a knob can be held to:

engine main's pin                         092eb9dbcffc            (the body says exactly this)
compare 469c69f5d (#216) ... 092eb9dbc      status "ahead", ahead_by 7, behind_by 0   -> #216 IS on the pin's history
knob at the pin   ggml-hrx/dispatch_registration/common/dispatch-gated-mul-mat-id.cpp:29
  iq3s_table_decode_enabled(): env != NULL && *env != '\0' && strcmp(env,"0") != 0   -> off unless set, `0` is the shipping path
ratios re-derived   318.52/270.62 = 1.177 (1.18x)   182.10/140.84 = 1.293 (1.29x)   221.38/177.62 = 1.246 (1.25x)

So the knob is documented where it actually lives, the commit that shipped it is an ancestor of the pin the doc names, and the three
ratios are the table's own numbers rather than roundings in prose. The PPL row (1.7198 in both arms, three windows) is the one that
matters, and the doc treats it as the point rather than the speed.

What makes this a good page rather than a feature announcement is the paragraph under the table: the absolute tok/s are labelled as
one box on one day (the same arm has read 182–318 across windows), and the reason it stays opt-in is stated with the owed checks —
the measured windows predate #227's SET_ROWS fix, a 3,858-token prompt on that commit intermittently died in the CPU fallback
(#1251), and both the long-prompt cell and test-backend-ops -o MUL_MAT -b HRX0 on the current pin are still to run. That is exactly
the right amount of enthusiasm for a knob that has not been measured end to end.

One nit, and it is the same shape as the census table in #1221: "IQ3_XXS on 28 blocks and IQ4_XS on 17" is 45 of the 48 blocks,
so a reader who adds the two numbers finds three unaccounted for. Either say "45 of the 48" or name the third format — a doc whose
counts do not add up invites the reader to distrust the rest of the table, which here is entirely sound.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

572 - Partially compliant

Compliant requirements:

  • Documented the GGML_HRX_IQ3S_TABLE_DECODE knob and its measured performance improvement
  • Explained why it is not yet a default
  • Included performance numbers from measurements on the hardware

Non-compliant requirements:

  • None

Requires further human verification:

  • None

1251 - Partially compliant

Compliant requirements:

  • None

Non-compliant requirements:

  • This PR does not address the root cause of the SET_ROWS issue; it only documents the workaround

Requires further human verification:

  • The fix for the SET_ROWS issue needs to be verified in the actual hardware environment
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Missing Fix for SET_ROWS Issue

The PR documents the GGML_HRX_IQ3S_TABLE_DECODE knob and its performance benefits, but does not address the underlying issue causing the out-of-range indices assert in GGML_OP_SET_ROWS with long prompts. This issue (engine#1251) remains unresolved and could block long-context workloads on HRX.

#### `GGML_HRX_IQ3S_TABLE_DECODE` and the IQ3_XXS expert blocks ([engine#572](https://github.com/1bit-MONSTER/engine/issues/572))

Flash-Next's 48 MoE blocks are a mix of quant formats — for the UD-IQ4_XS build, `ffn_gate_exps`/`ffn_up_exps` are
IQ3_XXS on 28 blocks and IQ4_XS on 17 — and on identical geometry the IQ3_XXS blocks cost about **2.4x** what the
IQ4_XS blocks cost (79.94 ms vs 33.34 ms per dispatch at a 10x639 grid, from the dispatch profiler). The IQ3_XXS grid
decode was the reason: it selected a 12-bit grid code out of 256 inline constants, once per 4-value packet.

`GGML_HRX_IQ3S_TABLE_DECODE=1` selects a second router-expert kernel that reads that grid from a small per-workgroup
table instead. It is **off by default**; unset or `0` is the shipping path. Measured with it on, in one hold against a
control arm on the same binary:

| cell | control | `=1` | |
|---|---:|---:|---|
| pp4096 (product path) | 270.62 tok/s | **318.52** | 1.18x |
| pp4096, second window | 140.84 | **182.10** | 1.29x |
| pp512 | 177.62 | **221.38** | 1.25x |
| PPL 8x512 | 1.7198 | **1.7198** | identical |

The PPL row is the point: the value is unchanged to four decimals, measured in three separate windows, so the faster
decode is the same arithmetic. The absolute tok/s above are one box's state on one day — the same arm has read 182-318
tok/s across windows for identical flags, which is why only the paired ratios are quoted.

It stays opt-in because the two windows above ran on a fork commit that predates the SET_ROWS fix (#227), and a
3,858-token prompt on that commit intermittently died in the CPU fallback (engine #1251). Before this becomes a default
it needs the long-prompt cell plus `test-backend-ops -o MUL_MAT -b HRX0` on the current pin, neither of which this lane
has run.

Still open on #572, stated so nobody reads this as closed: the 1,679 tok/s gap is not explained; the

@bong-water-water-bong
bong-water-water-bong merged commit 5579a44 into main Nov 7, 2026
9 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the docs/572-iq3s-knob branch November 7, 2026 18:07
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