Repository navigation
tests: name the kquant decode route for the few-token matmuls in test-hrx-ops (engine #444, item 2) - #128
Merged
bong-water-water-bong merged 1 commit intoOct 23, 2026
Conversation
…-hrx-ops (engine #444, item 2) Item 2 of #444 is the stale routing expectations: `test-hrx-ops` still spells the kernel the pre-pin dispatcher chose for one-token and few-token matmuls (`loom_libs:ggml_mul_mat_f32_f32_decode_wave64`, `…_f32_f32_wmma`, `…_swiglu_…_lowtoken_dot`), while the registration on this pin sends those shapes to the kquant decode family. The rule is `dispatch-kquant-decode.cpp`: at most `kMaxTokens` (8) tokens of a kquant format, an input size that is a multiple of 256 and no more than 65536, and no q8 alternate on the value. Under it: - plain matmul family: `ggml_kquant_mul_mat_decode_f32` (one token), `ggml_kquant_mul_mat_decode_tokens_f32` (two to eight); - fused gate/up pair: `ggml_kquant_swiglu_decode_f32` / `ggml_kquant_swiglu_decode_tokens_f32`; - the bias/residual postops form goes through the same two plain kernels (`match_kquant_mul_mat_add_decode` delegates to the shared matcher). Rather than rewrite ~120 call sites (and get the format list wrong in some of them), the expectation is translated in **one** helper, `kquant_decode_expectation()`, which carries the format list and the size gate copied from the registration. The five plain-matmul helpers and the SwiGLU helper call it; the call tables keep the kernel they were written with, so a shape the rule does not cover (Q4_0/Q4_1/Q5_0/Q5_1/Q8_1, F16, BF16, F32, more than eight tokens, a non-multiple-of-256 input) still expects exactly what it expected before. Host side at the pin: ``` test skipped: no device available for test-hrx-ops (237 device case(s)) [PASS] 1/2 rmsnorm_support [PASS] 2/2 alternate_value_alias_lookup test-hrx-ops summary: 2 passed, 0 failed, 2 total ``` The 237 device cases are the point of this change, and they need the GPU slot: the rule above is taken from the registration, and the device run is what confirms each case lands on the kernel the rule names. Any case where the rule is wrong goes red on that run and is fixed against what the scheduler actually printed - not written into the tables blind. That run is queued the moment the release-candidate holds clear; nothing in this commit is claimed as device-verified. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
bong-water-water-bong
added a commit
that referenced
this pull request
Oct 23, 2026
* tests: fix test-hrx-ops from the device run (engine #444) First device run of `test-hrx-ops` in its per-case form: **194 passed, 45 failed, 239 total** at fork `f1670b43` + hrx-system `82804197bc` (host 2 passed). The failures say two different things. ## My route translation was wrong, the table was right 45 failures were caused by the translation added in #128, not by the test. On hardware the registry schedules the **q8 publication plus the table's own kernel**: ``` missing expected kernel: loom_libs:ggml_kquant_mul_mat_decode_tokens_f32 scheduled kernels: qwen3_moe:ggml_quantize_q8_1_x4_f32 loom_libs:ggml_mul_mat_f32_f32_wmma ``` i.e. here the kquant matcher declines because a q8 alternate exists and the shape goes quantize + wmma — exactly what the table said before I "corrected" it. That also settles the open question from #128: the rule in `dispatch-kquant-decode.cpp` describes when the decode family is *eligible*, not that it always wins. `require_matmul_route()` now accepts the table's kernel **or** the kquant family (and reports the scheduled sequence when neither is there), so the case keeps its guard without forcing one of the two. ## Registered decode/prefill pairs Four shapes named the prefill variant while the plan schedules the decode one, and the asymmetric flash attention case names the flash kernel while the MLA shapes schedule the rows kernel. Both are pairs the registry picks from by token count / layout, so a case that names one accepts the other: | named | sibling | |---|---| | `llm_attention_v_matmul_set_rows_f32_f32_wmma` | `llm_attention_v_matmul_set_rows_decode_f32_f32` | | `ggml_flash_attention_f32_f16_wmma` | `ggml_attention_rows_f32_f16` | ## Names that are simply gone (updated from the scheduled sequence) - `routed_moe.q4_k.true`: `qwen3_moe_routed_down_weighted_reduce_next_rmsnorm_f32` -> `qwen3_moe_routed_down_weighted_reduce_f16_f32` (the reduce and the next RMSNorm are separate dispatches; the fused variant is not scheduled for this shape). - `routed_moe_decode.q4_k` / `.q6_k`: the table named routed-down kernels that are not in the sequence; what the plan schedules is the fused gate/up kernel (`qwen3_moe_routed_gate_up_swiglu_q4k_q8_1_x4_next_q8`, resp. `…_gate_up_swiglu_q4k_q8`) followed by `ggml_mul_mat_id_decode_f32_wave64`, so the expected list now ends with those. - `routed_moe_decode.q6_k.true`: the q6_k variant does not publish q8, so the sequence starts with `ggml_rmsnorm_binary_f32` instead of `qwen3_moe_rmsnorm_f32_quantize_q8_1_x4`. ## Evidence ``` test-hrx-ops (host): 2 passed, 0 failed, 2 total test-hrx-ops (f1670b4): 194 passed, 45 failed, 239 total <- before these fixes hrx-backend-test: host 60 passed, 0 failed, 6 known-fail, 0 unexpected-pass device 11 passed, 0 failed, 0 known-fail, 0 unexpected-pass ``` The 45 -> expected ~4 remaining failures are host-verified only: the GPU lane went to the Qwen3.8-27B leaderboard before the re-run, so the device confirmation of these edits is the first thing to do when it comes back. That re-run is also what #444 still needs to close. 🤖 Generated with [Claude Code](https://claude.com/claude-code) * tests: drop the leftover duplicate route check and the identical-arm ternary (engine #444) Review cleanups on #132, no behaviour change: - `run_dense_matmul_cpu_reference_case` called `require_matmul_route()` twice - the second call was a leftover from splitting the one-element subsequence check out of the pair, and sat unindented inside the `normalize_input` branch. Removed; the single call before the branch already covers the route. - `run_routed_moe_cpu_reference_case`'s expected list ended in a ternary whose two arms are now the same kernel (`qwen3_moe_routed_down_weighted_reduce_f16_f32`) because the fused next-rmsnorm variant is not scheduled for either shape. Replaced with the plain entry and a comment saying why `include_next_rmsnorm` no longer selects a kernel there. Host check: `test-hrx-ops summary: 2 passed, 0 failed, 2 total` (237 device cases skip without a device). The device re-run is still what #444 needs before it can close. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: bong-water-water-bong <[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.
tests: name the kquant decode route for the few-token matmuls in test-hrx-ops (engine #444, item 2)
Item 2 of #444 is the stale routing expectations:
test-hrx-opsstill spells the kernel the pre-pindispatcher chose for one-token and few-token matmuls (
loom_libs:ggml_mul_mat_f32_f32_decode_wave64,…_f32_f32_wmma,…_swiglu_…_lowtoken_dot), while the registration on this pin sends those shapes to thekquant decode family.
The rule is
dispatch-kquant-decode.cpp: at mostkMaxTokens(8) tokens of a kquant format, an input sizethat is a multiple of 256 and no more than 65536, and no q8 alternate on the value. Under it:
ggml_kquant_mul_mat_decode_f32(one token),ggml_kquant_mul_mat_decode_tokens_f32(two to eight);
ggml_kquant_swiglu_decode_f32/ggml_kquant_swiglu_decode_tokens_f32;match_kquant_mul_mat_add_decodedelegates to the shared matcher).
Rather than rewrite ~120 call sites (and get the format list wrong in some of them), the expectation is
translated in one helper,
kquant_decode_expectation(), which carries the format list and the size gatecopied from the registration. The five plain-matmul helpers and the SwiGLU helper call it; the call tables
keep the kernel they were written with, so a shape the rule does not cover (Q4_0/Q4_1/Q5_0/Q5_1/Q8_1, F16,
BF16, F32, more than eight tokens, a non-multiple-of-256 input) still expects exactly what it expected before.
Host side at the pin:
The 237 device cases are the point of this change, and they need the GPU slot: the rule above is taken from
the registration, and the device run is what confirms each case lands on the kernel the rule names. Any case
where the rule is wrong goes red on that run and is fixed against what the scheduler actually printed - not
written into the tables blind. That run is queued the moment the release-candidate holds clear; nothing in
this commit is claimed as device-verified.
🤖 Generated with Claude Code