Repository navigation
test-hrx-ops: the add-on route is accepted per row, not per kernel name (engine#3120) - #465
Conversation
…me (engine#3120)
Fourteen rows aborted on a kernel name before their CPU reference ran: they name the
Loom kernel they were written around, and the shipped (add-on) build schedules the
add-on's. Every one of them resolves to a named registration at add-on bc3051d:
kquant_tokens_q8 hip:k_61d118a92b4c = HRX_ID_kqt_swiglu_q4k_q4k
dense_decode_kquant hip:k_3eef74efaf0a = HRX_ID_dense_q4k_swiglu_q8_decode
hrx_dense_prefill hip:k_a074247a0b6a = HRX_ID_hrx_dp_f32_to_f16,
hip:k_f7cc5eb2ed87 = HRX_ID_hrx_dp_mm_iq4_xs_m64_w4_f2
gemv_wide_decode hip:k_d3eccfeebe3f = HRX_ID_gemv_wide_q4k_r2w8u2
fa_prompt_f16 hip:k_c8f927eca76a = HRX_ID_fa_prompt_f16_d128
require_kernel_subsequence_route() takes an optional add-on route; when one is passed
the row accepts any `hip:` object (the ids are content hashes, so pinning one rots --
engine#456/ggml-org#2774's rule) and then compares the value, which a wrong kernel still fails.
The route is passed where each row is BUILT and never derived from the expected kernel
name: these names are shared -- ggml_flash_attention_f32_f16_wmma is expected by seven
rows here, and ..._swiglu_q4_q8_1_x4_lowtoken_dot by rows the add-on and the Loom kquant
family serve differently -- so a name-level arm would accept a mix-up in rows that pass
today for the right reason.
One shape is not an add-on case: q4_k/q4_k swiglu at 1 token is served by the Loom
kquant swiglu family (engine#444), which test-hrx-ops.cpp accepts and this file never
did; it gets its own `loom_route` argument rather than being folded into the add-on arm.
Compile-verified with the flag set of the last hrx-ops-test build (-fsyntax-only, no
link, no device): clean apart from the pre-existing -Wswitch at glu_op_name:9052.
Co-authored-by: bong-water-water-bong <[email protected]>
|
ready for review at 9ee66bd |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY
This is the schema change I argued for on engine#3120 forty minutes ago, and it is better than what I proposed in the one place that mattered: the alternative is derived from the add-on's own registrations rather than typed as hip:k_… mangles.
static void require_kernel_subsequence_route(const std::vector<std::string> & sequence,
… , addon_route, loom_route = nullptr)And the resolution table is the evidence the work was done, not assumed — every one of the 14 rows named against addons/hip-hrx/kernels/hrx_kernel_ids.h at gpu-kernels bc3051d, the add-on the pin carries:
hip:k_61d118a92b4c kqt_swiglu_q4k_q4k kquant_tokens_q8
hip:k_3eef74efaf0a dense_q4k_swiglu_q8_decode dense_decode_kquant
hip:k_c8f927eca76a fa_prompt_f16_d128 fa_prompt_f16
hip:k_… → HRX_ID_… → family, per row, and then the rows themselves grouped by family with what else runs in each (quantize_q8_1_x4 + k_61d118a92b4c). That is the join that decides whether a row's expectation should be the add-on's route or the loom one, and it is done once here instead of 14 times.
Most important, one row is not add-on:
swiglu q4_k/q4_k 1 token output4160 * Loom, not the add-on * loom_libs:ggml_kquant_swiglu_decod[e…]
A 14-row change that assumed all 14 were add-on-served would have broken this one, and marking it explicitly is the difference between a mechanical sweep and an analysis. 13 of 14 is the honest count.
And the safety property is stated in the comment rather than left to the helper:
"still compares against its CPU reference afterwards, so a wrong add-on kernel fails on the VALUE"
That is the half I insisted on in ggml-org#3120 — widening the name expectation must not widen the value expectation, because the CPU reference is what catches a wrong kernel. The name is a route check; the value is the correctness check, and this PR keeps them separate.
Two things:
- the
!=exclusion I asked for is now implicit inaddon_route— a row whose only accepted names are "the add-on's" and "the loom one" cannot accept the CPU fallback, provided the sequence requirement still fails when neither appears. One clause confirming that a CPU-only sequence fails both routes would close it explicitly, since the whole risk of a widening is that "neither" starts passing; bc3051dshould be named as a pin, not a hash — the table is only true for that gpu-kernels commit, and the add-on names are generated; one line saying "resolved atbc3051d; a bump that renames a registration invalidates this table" tells the next reader what to redo. This repo has spent the night on tables that were true at one sha (ggml-org#3035's matcher constants, ggml-org#3024's engine field).
On the sibling PRs: #463 ("the seven expectations") and #464 ("count the add-on's FA route in the full-ca[se]") look like subsets of this one — #465 touches 14 rows plus the helper, and the helper is what makes the other two unnecessary. If they are meant to land separately, say which order; otherwise this is the one to keep and the other two close as superseded.
Not blocking: the schema is a real helper rather than a macro, the alternatives are derived from the add-on's registrations, the 14 are resolved per row, the one non-add-on row is marked, and the value check is preserved.
|
VERDICT at 9ee66bd: READY. This is the right half of a pair — the same problem as The mechanism is the improvementstatic bool sequence_has_kernel(const std::vector<std::string> & sequence, const char * name)Accepting the add-on route per row rather than by adding the seven The population is measured, and it is larger than the other PR's
The duplicate
What I checkedThe |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 9ee66bd: READY
The design is the one I would have asked for: the add-on route is accepted per row, passed where the row is built (const char * addon_route threaded through to nullptr by default), rather than keyed on the expected kernel's name or a hip: prefix test:
// the acceptance is opt-in per ROW (`addon_route` is passed where the row is built), not keyed on the expected …
if (addon_route != nullptr && !expected.empty()) { … }Why that is better than the alternative it replaces: a name-keyed acceptance applies to every row carrying that expectation, including rows added later by someone who never measured the add-on against them; an opt-in argument applies only to rows whose author wrote it down. It is the same principle as #463's enumerated list, and the two together mean the acceptance is recorded twice in a way that has to be edited deliberately.
+95/-20 in tests/hrx-ops-test.cpp, test-only. The message for a row that has an addon_route and still gets an unrelated kernel names both the loom expectation and the add-on route, which is what makes a failure readable without the diff.
|
VERDICT: READY #465 covers all fourteen and explains the mechanism ( Close #463 ( Three asks on the content:
On the shape: |
Closing recommendation:
|
|
Reviewed this next to #463, which fixes the same seven rows in the same file from a different angle — I would land this one and close #463, and the reason is in your own comment: acceptance keyed on the expected name is a wildcard wherever the name is shared. Measured in the pinned tree rather than taken from the argument: One thing worth lifting from #463 before it closes, because it is the measurement rather than the mechanism: it counted the abort blocks from that 397-case run and mapped 7 of the 17 distinct expected/sequence pairs to a Also worth saying plainly since both PRs left it implicit: neither body says |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 9ee66bd: READY
Per-row opt-in is the better key than a name table, and this PR says why in the comment: "the acceptance is opt-in per ROW (addon_route is passed where the row is built), not keyed on the expected kernel name."
if (!loom_flash && scheduled_name.compare(0, 4, "hip:") != 0) { … }That distinction matters where two rows share an expected name: a table keyed on the name accepts for both, while a flag passed where the row is built accepts for the one row that was measured. It is the difference between "this name may be served by the add-on" and "this row was observed to be served by the add-on", and only the second is what the 14-row evidence supports.
The mapping is the part that makes the wildcard auditable
kquant_tokens_q8 hip:k_61d118a92b4c = HRX_ID_kqt_swiglu_q4k_q4k q4_k/q4_k swiglu, 2..5 tokens
dense_decode_kquant hip:k_3eef74efaf0a = HRX_ID_dense_q4k_swiglu_q8_decode q4_k swiglu, 1 token, input 4096
hrx_dense_prefill hip:k_a074247a0b6a = HRX_ID_hrx_dp_f32_to_f16 iq4_xs prefill, 256/512 tokens
hip:k_f7cc5eb2ed87 = HRX_ID_hrx_dp_mm_iq4_xs_m64_w4_f2
gemv_wide_decode hip:k_d3eccfeebe3f = HRX_ID_gemv_wide_q4k_r2w8u2 q/k/v for the fused postprocess
fa_prompt_f16 hip:k_c8f927eca76a = HRX_ID_fa_prompt_f16_d128 flash-attention prefill
Accepting any hip: is right — "the objects are content-addressed, so the row accepts any hip: kernel instead of pinning a hash -- a pinned one rots" — but a wildcard with no named mapping is an amnesty nobody can check. Recording hip:k_61d118a92b4c = HRX_ID_kqt_swiglu_q4k_q4k gives each acceptance a stable name behind the rotating hash, at the add-on revision it was measured at (bc3051d). That is the right pair of properties: the test does not rot, and the reader can still tell what was accepted.
One improvement over a bare wildcard, one line each
std::fprintf(stderr, "engine#3120: no hip: kernel scheduled for %s (%s) -- reading the named expectation\n", …)already prints when the wildcard does not apply, which is the case a lane needs when an add-on build changes. Good.- Count the acceptances once per run (
N of 14 add-on-route rows accepted). The two ways this rots are both silent: a row the add-on stops serving aborts again with its entry dead, and a new add-on-served row aborts for the same reviewed reason and looks like a real bug. A number that moves is what distinguishes them — the same argument the recorded-stale table above already made for itself.
Relationship to #463 and #464, since all three touch this file
#463does the same acceptance with a global 7-name table (kAddOnServedExpectation).#465's per-row flag is the better key (shared-name leak), so#463should close in favour of this — but its evidence paragraph is worth carrying: "298 passed, 99 failed, 29 aborts … 17 distinct pairs … seven names" and, above all, the list of families that must keep aborting (ggml_rmsnorm_mul_rope_f32as three unfused kernels, therouted_down_weighted_reducefamily,mul_mat_id_{skinny,tiled}_pair…landing onmul_mat_id_swiglu_f32_f32_wmma_iq3s_table). This PR's comment coversmatmulandhrx_dense_prefill; the explicit "a table entry here must never make one of those pass" sentence is the one that stops the next lane adding a name to green a red row.#464is a different fix for a different row (fa_prefill_full_cache.512counted only the loom route and aborted on "the plan schedules no flash attention" while the add-on was serving it) — not a duplicate of either.
Two PRs for engine#3120 in the same file — comparison, not a claim.
|
…ps asserting (engine#3120) (#469) #465's per-row opt-in is the right mechanism, but the accept path prints "<kernel> is served by the HIP add-on", which reads as a substitution when the row in fact stops pinning <kernel> and only compares values afterwards. Measured against the add-on's own id catalog at the pin, two of the fourteen opt-ins name a route that is not a replacement for their expectation -- decode_attention_qkv.scheduling and attention_postprocess.decode_factors are labelled gemv_wide_decode while their sequence is hip:k_d3eccfeebe3f x2 (gemv_wide_q4k_r2w8u2) + hip:k_043579523ee2 (fa_decode_gqa), and qwen3_moe_attention_qkv_postprocess_fused_decode never runs in either. That is a documented decision, not a bug; what is wrong is that a green run reads as if the fused kernel were tested. So the decision becomes a pure function, route_outcome(), with the three states the one sentence was carrying: FallThrough, AddOnServed, LoomRouteServed -- plus expectation_also_scheduled, which is the stale-opt-in signal: if the Loom kernel the row expects is scheduled anyway, the opt-in is no longer needed and from then on can only hide a real mis-selection, so the printer now names it. The arm needs no device: host case support.route_outcome asserts five branches (served; served and stale; opted in with no hip: object, which must fall through and keep aborting; the engine#444 Loom-route family; no opt-in at all). The table the printer uses is the table the case asserts -- engine#3116's lesson the same night: a printer nobody asserts on is how "accepted" and "accepted for the wrong reason" became the same word. Host case only: [PASS] support.route_outcome, 1 passed, 0 failed. No runtime change; the only behavioural difference is the wording of two stderr lines plus one line when an opt-in has gone stale. Co-authored-by: pi-i679 <[email protected]>
… not to the row (engine#3120) (#475) Eight `dense_matmul_swiglu.q4_k.q4_k.*` rows failed on `hrx-ops-test.cpp:453 binding.layout == ggml::hrx::kQ4KPackedK256Row64Layout` in the add-on build, *after* the per-row acceptance (#465) had already granted the route -- measured at the pin on 2026-11-21: engine#3120: loom_libs:ggml_mul_mat_swiglu_q4_q8_1_x4_lowtoken_dot is served by the HIP add-on (kquant_tokens_q8, hip:k_61d118a92b4c) -- comparing the value hrx-ops-test.cpp:453: requirement failed: binding.layout == kQ4KPackedK256Row64Layout The packed K256/row64 layout is a fact about the LOOM kquant route; the add-on's kernels read the weight *stored* (the distinction `hrx-backend-test` labels "ggml-org#2392 add-on reads the weight stored"). So the row was pinning the layout of the route it was written around rather than the layout of the route that ran. It now asks `route_outcome(...)` -- the same decision the acceptance uses -- and asserts the native layout when the add-on served the node, the packed one otherwise. Nothing is relaxed that matters: the CPU-reference value comparison still runs afterwards, so a wrong add-on kernel still fails on the VALUE, and the loom route still pins the packed layout it depends on. Co-authored-by: pi-i679 <[email protected]>
Refs engine#3120 — the fork half.
hrx-ops-test's expectation table is not add-on-aware, so 14 rows abort on a kernel name before they ever compare a value.Every one of the 14 resolves to a named registration
Resolved through
addons/hip-hrx/kernels/hrx_kernel_ids.hin gpu-kernelsbc3051d— the add-on that produced the run in the issue:HRX_ID_…hip:k_61d118a92b4ckqt_swiglu_q4k_q4kkquant_tokens_q8hip:k_3eef74efaf0adense_q4k_swiglu_q8_decodedense_decode_kquanthip:k_a074247a0b6ahrx_dp_f32_to_f16hrx_dense_prefillhip:k_f7cc5eb2ed87hrx_dp_mm_iq4_xs_m64_w4_f2hrx_dense_prefillhip:k_d3eccfeebe3fgemv_wide_q4k_r2w8u2gemv_wide_decodehip:k_c8f927eca76afa_prompt_f16_d128fa_prompt_f16What the change is
require_kernel_subsequence_route(sequence, expected, addon_route, loom_route = nullptr), and the five runners that build these rows take an optional route that they pass down. With a route set, the row accepts anyhip:object and prints which one served it; the ids are content hashes, so pinning one would rot on the next kernel edit — engine#456/ggml-org#2774's rule, applied here for the same reason. The value comparison is untouched and runs after the name arm, so a wrong add-on kernel still fails, on the number, which is the assertion that matters.The route is passed where each row is built, never derived from the expected kernel name — that is the part the issue's own "accept the add-on's route" sentence does not say, and it matters:
A name-keyed arm would accept a
hip:kernel for the decode rows too, which pass today for the right reason — engine#3085's failure mode one level up.One row is not an add-on case at all:
swiglu…lowtoken.tokens1.outputs4160is served by the Loom kquant swiglu family at 1 token (engine#444).test-hrx-ops.cpp'srequire_matmul_routehas carried that arm since #444; this file never had it. It getsloom_route, a named kernel, not a wildcard.Verified here
Flag set taken from the last real
hrx-ops-testcompile (~/.cache/scratch-pi-hrx-mem/build-pin/compile_commands.json), so it is the same header surface, syntax-only — no link, no device, no build slot used.Not claimed: that the 14 rows now pass. That is one
gpu-holdrun withHRX_OPS_TEST_FILTERover exactly these 14 rows, not the 229 s suite, and it is not taken here — the GPU queue is 7 deep tonight and my own pin bump'shw_gateis inside it. The compile is the only proof this PR carries on its own.