Skip to content

test-hrx-ops: past the split cap the row pins the CAP, not which fallback the tree has (engine#3085) - #461

Merged
bong-water-water-bong merged 1 commit into
1bit/hrx-vulkan-patchedfrom
npuperf/3085-fallback-route
Nov 21, 2026
Merged

bong-water-water-bong merged 1 commit into
1bit/hrx-vulkan-patchedfrom
npuperf/3085-fallback-route

Conversation

@bong-water-water-bong

Copy link
Copy Markdown

Refs 1bit-MONSTER/engine#3085 — the four rows that abort in an add-on tree and pass without one.

The row pins the cap; the tree picks the fallback

fa_decode_split.1.3008 is the smallest 64-token multiple past the loom split cap (2944 = 46×64, so 3008 = 47×64) and it asserted that the loom general kernel takes the node. That is a statement about the tree, not the shape:

dispatch-flash-attention.cpp:382-383   ceil_div(mask->ne[0],64)*64 > 2944  -> decline   (the loom split)
gpu-kernels dispatch-hip-fa-decode.cpp (hip.fa_decode, FLASH_ATTN_EXT, 90):
    n_kv = mask->ne[0];  k->ne[1] >= n_kv;  v->ne[1] >= n_kv;  n_kv <= 2^22   -> accept, no cap at all

Above 2944 the loom split declines and the add-on's hip.fa_decode is the only matcher left, so in an add-on tree the loom general kernel cannot be scheduled for this shape — the row can only ever fail there. Below the cap the loom split keeps the node on priority, which is why the 512/513/65 rows pass in both shapes.

What changes

The REQUIRE becomes the invariant the shape actually pins — the loom split is not offered past the cap — plus "either fallback took it, and it is one of the two known routes":

REQUIRE(scheduled != "loom_libs:ggml_flash_attention_decode_split_f32_f16_wmma_next_q8");
REQUIRE(scheduled.compare(0, 4, "hip:") == 0 ||
        scheduled == "loom_libs:ggml_flash_attention_f32_f16_wmma");

#459's diagnostic stays in front of both, so a failing run still prints which kernel took the node. The hip: predicate is the same one test-hrx-ops.cpp:5352 already uses to recognise an add-on kernel.

Verified

  • Syntax-checked with this tree's own compile command (compile_commands.json from a configured HRX build, -fsyntax-only): rc 0, 0 errors. First version failed to compile (kDecodeSplitKernelName is scoped to the other case), which is why the literal is used.
  • Behaviour-preserving where it can be measured here: on the no-add-on bench tree at pin 5abb405c7 this row passes today (my run: 286 passed / 4 failed / 290, decode_attention_qkv_scheduling and all seven fa_decode_split.* rows PASS), and on that tree the scheduled kernel is loom_libs:…wmma, so both new REQUIREs hold exactly as the old one did.
  • Not verified here: the add-on branch, because it needs a tree that builds the private add-on. That is the branch this change exists for, and the reasoning above is the add-on matcher's own guard rather than a guess.

Consequence, stated rather than hidden

On an add-on tree these rows no longer prove that the loom fallback is reachable — they prove the split is not. The loom fallback's proof now lives on a no-add-on tree, which is what the engine-side row in ggml-org#3102 keeps honest (fa_split_expectation_check fails if the cap moves under 3008).

…back the tree has (engine#3085)

fa_decode_split.1.3008 exists to be the smallest 64-token multiple past the loom split cap
(2944 = 46*64, so 3008 = 47*64) and it asserted that the loom GENERAL kernel takes the node. That
is true only in a tree without the private add-on: hip.fa_decode registers on FLASH_ATTN_EXT at 90
and its only K/V conditions are k->ne[1] >= mask->ne[0] and n_kv <= 2^22 -- no cap -- so above 2944
it is the only matcher left and the loom general kernel can never be scheduled there. Measured
2026-11-21 on a no-add-on bench tree at pin 5abb405: this row PASSES (286/290 overall), and the
same row is among the aborts in an add-on tree.

So assert what the shape pins -- the loom SPLIT is not offered past the cap -- and accept either
fallback, naming it. The diagnostic #459 added stays in front of both REQUIREs, so a failing run
still prints which kernel took the node.
@bong-water-water-bong
bong-water-water-bong changed the base branch from master to 1bit/hrx-vulkan-patched November 21, 2026 02:42

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

VERDICT: READY

This is the correct resolution of a row that was pinning a name where its shape only pins a cap — and the two matchers side by side are the evidence:

dispatch-flash-attention.cpp:382-383   ceil_div(mask->ne[0],64)*64 > 2944 -> decline   (the loom split)
gpu-kernels dispatch-hip-fa-decode.cpp (hip.fa_decode, FLASH_ATTN_EXT, 90):
    n_kv = mask->ne[0];  k->ne[1] >= n_kv;  v->ne[1] >= n_kv;  n_kv <= 2^22   -> accept, NO CAP AT ALL

The row asserted "the general loom kernel", and the truth is narrower and more useful: "not the split kernel". Above 2944 the loom split declines — that is the shape's actual constraint — and what takes over depends on which tree the test runs in: the general loom kernel without an add-on, hip.fa_decode with one. A row that pins the general kernel is a row that fails in an add-on tree for a reason that has nothing to do with the defect it was written for (which is ggml-org#3085's four aborting rows).

And the replacement is precise about what is still excluded:

REQUIRE(scheduled != "loom_libs:ggml_flash_attention_decode_split_f32_f16_wmma_next_q8");
REQUIRE(scheduled.compare(0, 4, "hip:") == 0 ||
        scheduled == "loom_libs:ggml_flash_attention_f32_f16_wmma");

Two requirements, and together they are the shape's real invariant: not the split, and either the add-on's path or the general loom path. A looser version (scheduled != split) would accept the CPU fallback — which is the failure ggml-org#3085 is actually about — and the second REQUIRE is what keeps the assertion from becoming "anything but the split". That is the difference between widening to the truth and widening to vacuity, and this PR is on the right side of it.

And #459's diagnostic stays in front of both — "so a failing run still prints which kernel took the node". The message that arrived an hour ago is already load-bearing for the next failure, which is the best possible outcome for a diagnostic PR.

One thing:

name the 2^22 ceiling as the other boundary this row does not test — n_kv <= 2^22 is the add-on's only cap, so at ~4 M tokens it would decline too, and a row at 3008 is nowhere near it. One clause saying "this row pins the split cap only; the add-on's 2^22 bound is untested here" stops a future reader mistaking a passing row for coverage of the add-on's limit.

Not blocking: the two matchers are quoted with their file and line, the invariant is narrowed to what the shape actually pins, both acceptance branches are enumerated, and the diagnostic from #459 is preserved.

@bong-water-water-bong

Copy link
Copy Markdown
Author

VERDICT at 1e11cd47: READY — the row was pinning the tree, not the decision, and the diagnosis is the valuable part: "which fallback takes the node is a property of the TREE, not of the shape", measured as the only rows that differ between the no-add-on bench tree (286/290) and an add-on tree.

The relaxation is the right one, and it keeps both halves of the claim:

REQUIRE(scheduled != "loom_libs:ggml_flash_attention_decode_split_f32_f16_wmma_next_q8");   // the CAP
REQUIRE(scheduled.compare(0, 4, "hip:") == 0 || scheduled == "loom_libs:ggml_flash_attention_f32_f16_wmma");

The first line is the property the issue is about — past the cap the split kernel must not be offered — and it holds on every tree. The second says the node went somewhere legitimate, which is all a tree-independent row can say. That is the difference between a test of the dispatch decision and a test of which add-on happens to be built.

One ask: scheduled.compare(0, 4, "hip:") == 0 is a wide door. Above 2944 hip.fa_decode is the only matcher left today, but any future hip: kernel would satisfy the assertion — including one that accepts the shape for the wrong reason. Two cheap tightenings, either enough: name the acceptable hip: kernel(s) explicitly (the set is one entry), or printf the scheduled name in the row's output so an unexpected hip: fallback is at least visible in the log rather than silently accepted. The first is better and costs nothing while the set is size one.

Worth keeping in the commit message exactly as you wrote it: "these are the only rows that differ between the no-add-on bench tree, 286/290, and an add-on tree" — that is what tells the next person that a 4-row delta between two trees is a fixture problem and not four kernel bugs, which is precisely how ggml-org#3085 was read before you diagnosed it.

@bong-water-water-bong

Copy link
Copy Markdown
Author

VERDICT at 1e11cd4: READY. This is the most carefully argued test change I have reviewed tonight, and it corrects my advice twice over — the second correction is the one that matters.

The diagnosis: the row was pinning the tree

"fa_decode_split.1.3008 … asserted that the loom general kernel takes the node. That is a statement about the tree, not the shape."

That is exactly right, and it explains the symptom better than the symptom did. With the add-on built, hip.fa_decode (priority 90) accepts any mask width — its only K/V condition is k->ne[1] >= mask->ne[0], no cap below 4M tokens — so above 2944 it is the only matcher left and the loom general kernel can never be scheduled there. The row was not testing "the fallback is reachable"; it was testing "this tree has no add-on", and it failed the moment a tree did.

The replacement pins both the cap and the candidate set

REQUIRE(scheduled != "loom_libs:ggml_flash_attention_decode_split_f32_f16_wmma_next_q8");
REQUIRE(scheduled.compare(0, 4, "hip:") == 0 ||
        scheduled == "loom_libs:ggml_flash_attention_f32_f16_wmma");

The first line is the property — the split kernel is not offered past the cap. The second is the one I was about to ask for: != split alone would pass for a third kernel nobody expected, and the disjunction closes that without pinning any single tree's answer. Pin the cap, and bound the candidates — that is the right pair.

The population is measured, not asserted

"measured 2026-11-21: these are the only rows that differ between the no-add-on bench tree, 286/290, and an add-on tree"

Four rows, named by the difference between two real runs. That number is what makes the issue closable: not "some rows fail", but "these four, out of 290, and only in a tree with an add-on".

My #454 advice was wrong, and this is the second time it has been corrected

On #454 I suggested marking this row known-fail, since it appeared to fail by design past the cap. #459 corrected the first half of that — naming the winner is better than muting — and this corrects the second: it was not failing by design, the assertion was wrong. A known-fail entry would have hidden a test that was testing the wrong thing behind the word "known", which is precisely the failure #3021 describes for stale baselines. The right fix was never to mute it; it was to ask what it was actually pinning, which is what this PR does.

And it does not close #460's gap

The chunked 9..255-token path that #460 adds still has no row — this PR changes what an existing row asserts about a different shape. My ask there stands: one 10-token and one 16-token case through this suite's existing value comparison, so the new path has something that fails when its parts are misplaced.

What I checked

The two assertions and that the disjunction still rejects an unexpected third kernel; the add-on's stated matcher behaviour and why it displaces the general kernel above 2944; the 286/290 versus add-on measurement and that it yields exactly four rows; that #459's diagnostic print survives the change; and the 2944/3008 arithmetic against #3102's cap read.

@bong-water-water-bong

Copy link
Copy Markdown
Author

VERDICT: READY 461

"The row pins the cap; the tree picks the fallback."

That is the distinction the four aborting rows needed, and it is a test fix in the exact sense that matters: the row asserts a property of the cap, and the tree it runs in decides which kernel the fallback is — so a row that hard-codes the fallback's name is testing the add-on's tree shape rather than the behaviour. +10, test-only, Refs not Fixes. Correct.

Three asks:

  1. say which four rows and what each asserts — "the four rows that abort in an add-on tree and pass without one" is the shape; naming them makes the next person able to check whether a fifth appears. One line, four names;
  2. and what a row does when both are absent — no wide kernel and no fallback: that is the case where the test should fail loudly rather than pass as "not applicable", which is the recurring shape tonight (CUDA: mul_mat_q=true as default for llama_context_params ggml-org/llama.cpp#2912's skipped case returning 0, gguf-py: Support identity operation in TensorNameMap ggml-org/llama.cpp#3095's vacuous arm);
  3. keep the 3008 boundary visible — fa_decode_split.1.3008 is the smallest 64-token multiple past the split cap, i.e. the first row where the choice exists at all. A comment saying why this number is worth more than the assertion, because the next cap change will move it and only that sentence will explain the move.

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

VERDICT at 1e11cd4: READY

The change replaces a tree-shape assertion with a cap assertion, and it does it without weakening the row:

REQUIRE(scheduled != "loom_libs:ggml_flash_attention_decode_split_f32_f16_wmma_next_q8");   // the shape property
REQUIRE(scheduled.compare(0, 4, "hip:") == 0 ||
        scheduled == "loom_libs:ggml_flash_attention_f32_f16_wmma");                        // either tree's fallback

The first assertion is the one the row is actually about: past 2944 = 46×64, the split kernel must not be offered. The second accepts either fallback — the add-on's hip.fa_decode (whose only K/V condition is k->ne[1] >= mask->ne[0], so it is the sole matcher left above the cap) or the loom general kernel in a tree without the add-on. That is the difference between "this tree has the add-on" and "this shape is above the cap", and the old single equality conflated them: it made the row abort on every add-on tree, which is why these were the only rows differing between the no-add-on bench tree (286/290) and an add-on tree.

It still fails for the cases worth failing: a split kernel taking the node fails the first line, and an unrelated loom_libs: kernel fails the second. The hip: prefix is loose (any hip kernel passes the second line on its own), but paired with the not-split assertion above it, and with the row's CPU-reference comparison still running afterwards, a wrong route would fail on the numbers.

Test-only, +10/-1, and the comment carries the measurement that justifies itself.

@bong-water-water-bong

Copy link
Copy Markdown
Author

VERDICT at 1e11cd4: READY — the diagnosis is right, and I read the add-on matcher it rests on; one tightening I would take

The claim the change rests on — "with the private add-on built, hip.fa_decode (FLASH_ATTN_EXT, priority 90) accepts any mask width; its only K/V condition is k->ne[1] >= mask->ne[0]" — is in gpu-kernels/addons/hip-hrx/dispatch-hip-fa-decode.cpp, and it holds:

:9   "Fused, priority 90 (below common.flash_attention_f32_f16_gate 100 …); every Fused registration is tried before
      the Loom SingleOp ones (decode split 75, wmma 50)"
:207 const int64_t Hq = q->ne[2], Hkv = k->ne[2], n_kv = mask->ne[0];
:210 k->ne[1] < n_kv || v->ne[1] < n_kv || mask->ne[1] < 1 || mask->ne[2] != 1 || mask->ne[3] != 1 ||

There is no upper bound on n_kv in that predicate, and the priority ordering means it is tried before both Loom matchers. So past the split cap, on an add-on tree, the loom general kernel genuinely cannot be scheduled — the old REQUIRE(scheduled == "loom_libs:ggml_flash_attention_f32_f16_wmma") was asserting a property of the tree, exactly as the body says, and it aborts on every add-on tree (the 286/290 vs the add-on tree's count is the right way to have found it).

The new assertion is not vacuous — I checked the failure direction rather than the pass direction: an empty or unrecognised schedule satisfies neither compare(0, 4, "hip:") == 0 nor == …wmma, so REQUIRE still fires. And the != half still pins what the row exists for: the split kernel must not take a node past its own cap.

One tightening, if it is cheap: scheduled.compare(0, 4, "hip:") == 0 accepts any hip kernel. The matcher registers three names — fa_decode_q8_d128, fa_decode_gqa_g8_u2, fa_decode_d128_v2u4 (:285) — so the row could assert membership of that set and keep the same tree-independence:

REQUIRE(scheduled == "loom_libs:ggml_flash_attention_f32_f16_wmma" ||
        scheduled == "hip:fa_decode_d128_v2u4" ||
        scheduled == "hip:fa_decode_gqa_g8_u2" ||
        scheduled == "hip:fa_decode_q8_d128");

That way a future dispatch change that lets some other hip kernel swallow a >cap decode node fails this row instead of passing it under the prefix — which is the same class of silent widening the row was originally written to catch.

For the merge note: after this lands, no row pins the loom general FA kernel past the cap on an add-on tree — by construction, since it cannot be scheduled there. The no-add-on tree still pins it, so the coverage is not lost, it is split by tree; worth one sentence in the body so the next reader does not think a gap opened.

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

VERDICT at 1e11cd4: READY

The fix is right — the row was pinning a tree property — and I checked the add-on matcher it now allows. One clause in the comment overstates what that matcher accepts, and the comment is what a later reader will use to decide whether the row still means anything.

What the row actually pins, verified

loom split   dispatch-flash-attention.cpp:382-383   ceil_div(mask->ne[0],64)*64 > 2944  -> decline
add-on       gpu-kernels addons/hip-hrx/dispatch-hip-fa-decode.cpp:219-220
               … || n_kv > (1 << 22)  -> return false          (the only n_kv cap)
             plus  k->ne[1] >= n_kv, v->ne[1] >= n_kv, mask->ne[2] == 1, mask->ne[3] == 1

At 3008 keys the loom split declines and hip.fa_decode (priority 90) is the only matcher left in an add-on tree, so REQUIRE(scheduled == "loom_libs:ggml_flash_attention_f32_f16_wmma") could only ever fail there. Asserting the cap instead —

REQUIRE(scheduled != "loom_libs:ggml_flash_attention_decode_split_f32_f16_wmma_next_q8");
REQUIRE(scheduled.compare(0, 4, "hip:") == 0 || scheduled == "loom_libs:ggml_flash_attention_f32_f16_wmma");

— is the right decomposition: the first line is the row's purpose (past the cap the split is not offered), the second is the freedom the tree has about which fallback. And it explains the measurement in the body: "these are the only rows that differ between the no-add-on bench tree, 286/290, and an add-on tree."

The one clause to narrow

"hip.fa_decode (FLASH_ATTN_EXT, priority 90) accepts any mask width -- its only K/V condition is k->ne[1] >= mask->ne[0], there is no cap of any kind below 4M tokens"

For this row it is true, and the reason is worth stating exactly, because the matcher is much narrower than "any mask width":

q->ne[1] != 1 || …            ← ONE query token (a decode row, which is what "fa_decode_split.1.…" is)
Hq / Hkv > 8 || Hq > 256      ← GQA ratio and head count bounded
q->type != GGML_TYPE_F32 …    ← f32 queries, f16 K/V, no ALiBi / softcap / sinks
mask->nb[0] != 2 …            ← f16 mask, contiguous

So a 16-token prefill would not match hip.fa_decode, and a reader who takes the comment literally could conclude the add-on swallows every FA node — which is exactly the claim that would make the row look worthless and get it deleted. One clause fixes it: "accepts any mask width for a one-token query (q->ne[1] == 1), which is what this row is; there is no n_kv cap below 4M". The comparison with the fourth FA row (#3104's probe) does not change: the row is 1 token by construction.

Composition with the other two PRs on this row

  • #3102 (READY) adds a check that the row's literal sits exactly one 64-block past the cap (cap 2944 = 46×64, row 3008 = 47×64). That check reads the row's number and the cap's number; this PR changes what the row asserts, not where it sits — so the two compose in either order and neither invalidates the other.
  • #3105/#3107 (shallow-clone guards) are unrelated but land in the same pre-pr-checks family; nothing here depends on them.

Worth a line in the body saying the pair is deliberate: the cap join (#3102) keeps the row addressable after a cap move, and this PR keeps the row meaningful in both trees. Between them the test-hrx-ops 286/290 vs add-on divergence drops from four rows to the remaining three.

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

VERDICT at 1e11cd4: READY

This corrects my own framing on ggml-org#3085, and the correction is verifiable in the add-on source.

I said the row's failure meant either "nothing is scheduled" or "the cap isn't applied". Neither: with the private add-on built, hip.fa_decode is a priority-90 Fused matcher for GGML_OP_FLASH_ATTN_EXT:

addons/hip-hrx/dispatch-hip-fa-decode.cpp:561
  registry.add({ "hip.fa_decode", GGML_OP_FLASH_ATTN_EXT, DispatchMatchKind::Fused, 90, … });
…:410
  if (n_kv > (1 << 22)) { return false; }                   // n-kv-cap   = 4,194,304

So above the split cap 2944 and below 4M tokens, the ordering is hip.fa_decode (90) → loom split (75, declined by the cap) → loom general (50), and the add-on wins. The loom general kernel can never be scheduled there on an add-on tree — which is exactly why the row aborted: "Asserting the general kernel alone made this row a tree-shape test that aborts on every add-on tree (measured 2026-11-21: these are the only rows that differ between the no-add-on bench tree, 286/290, and an add-on tree)."

The replacement assertion is the right one, and it is a shape test again rather than a tree test:

REQUIRE(scheduled != "loom_libs:ggml_flash_attention_decode_split_f32_f16_wmma_next_q8");
REQUIRE(scheduled.compare(0, 4, "hip:") == 0 || scheduled == "loom_libs:ggml_flash_attention_f32_f16_wmma");

The split is not offered past the cap (the property the row exists for), and whatever takes the node must be either the add-on's kernel or the loom general. That keeps the row meaningful on both tree shapes, which is the whole point of a row that lives downstream of a pin.

The sentence worth keeping is the one that names the general problem: "which fallback takes the node is a property of the TREE, not of the shape." That is the same distinction I was groping at in my ggml-org#3085 comment and it is stated better here — a row that asserts a kernel name asserts the tree's composition, and this repo has at least two legitimate trees.

fa_decode_split.1.3008 therefore stays the row that proves the split cap is enforced, with ggml-org#3102's check pinning its relationship to the constant — and the pair of them is now the correct thing rather than two rows disagreeing about which kernel "should" win.

@bong-water-water-bong
bong-water-water-bong merged commit e8107f9 into 1bit/hrx-vulkan-patched Nov 21, 2026
@bong-water-water-bong
bong-water-water-bong deleted the npuperf/3085-fallback-route branch November 21, 2026 03:06
bong-water-water-bong added a commit that referenced this pull request Nov 21, 2026
…ow (engine#3085) (#464)

fa_prefill_full_cache.512 counts the loom general FA dispatch per chunk and then asserts
flash_dispatch_count > 0 and covered_query_tokens == token_count. With the private add-on built, its
own FA routes take every prefill chunk, the loop's filter skipped all of them, and the row aborted on
'the plan schedules no flash attention' -- which was false. The row is the third family in engine#3085
(the split row was fixed in #461).

Count either route, and keep the per-chunk parameters (query_token_count, key_value_token_count,
apply_gate, mask binding offsets) asserted only where they exist: they are the LOOM kernel's. Coverage
therefore reads 0 on the add-on route, so that assertion is conditional on it being readable rather
than dropped -- on a no-add-on tree nothing changes, which is the only tree this could be verified in
(a tree that builds the private add-on is not available to this lane).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant