Skip to content

hrx: decline the decode-split under a non-production partial-transient layout (engine#123 step 6) - #84

Merged
bong-water-water-bong merged 1 commit into
1bit/hrx-vulkan-patchedfrom
1bit/hrx123-decline-guard
Oct 3, 2026
Merged

bong-water-water-bong merged 1 commit into
1bit/hrx-vulkan-patchedfrom
1bit/hrx123-decline-guard

Conversation

@bong-water-water-bong

Copy link
Copy Markdown

engine#123 step 6 — decline-and-fall-back guarantee.

The decode-split pack handoff is only proven with the production 4096 partial-transient
alignment. GGML_HRX_FA_PARTIAL_ALIGN selects a non-production test layout whose safety is not
established. This adds a single guard in the decode-split matcher
(match_decode_split_flash_attention_f32_f16): when the partial-transient alignment is not the
production value, decline (return {}) so the op falls back to
flash_attention_f32_f16_wmma rather than run an unproven layout and risk the probabilistic fault
tracked in engine#123.

Production behaviour is unchanged — the guard is false at alignment 4096, so kDecodeSplitNextQ8
still serves capacities 64-32768 exactly as before.

Verified on gfx1151 (Strix Halo, Qwen3-Coder-30B-A3B, -dev HRX0) against the shipped f5b7f4ad:

  • GGML_HRX_FA_PARTIAL_ALIGN=256: dispatch log = common.flash_attention_f32_f16_wmma only
    (decode-split declined), 0 faults across llama-bench -p 0 -n 8 -d 2100.
  • production (alignment 4096): dispatch log = common.flash_attention_decode_split_next_q8.

Ref: engine#123.

…t layout (engine#123 step 6)

The decode-split pack handoff is only proven with the production 4096 partial-transient
alignment; a non-production (test) layout is unproven. Refuse the dispatch there so it falls
back to flash_attention_f32_f16_wmma rather than run an unproven layout and risk a
probabilistic fault. Production behaviour is unchanged (the guard is false at alignment 4096).

Verified on gfx1151 with the shipped f5b7f4a tree: GGML_HRX_FA_PARTIAL_ALIGN=256 ->
flash_attention_f32_f16_wmma only, 0 faults; production -> flash_attention_decode_split_next_q8.
@github-actions github-actions Bot added the ggml label Oct 3, 2026
@bong-water-water-bong
bong-water-water-bong merged commit 973e5ce into 1bit/hrx-vulkan-patched Oct 3, 2026
10 of 24 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the 1bit/hrx123-decline-guard branch November 12, 2026 21:13
bong-water-water-bong pushed a commit that referenced this pull request Nov 14, 2026
…t.stored_copy instead of labelling it

The three reviews of the label asked the right question -- is the expectation change temporary or permanent? It is
permanent (gpu-kernels#84's 306 entry claiming a 256-aligned stored-read Q4_K prefill is the shipped +25-28 %, not a
stopgap), so the case should say what the add-on path DOES rather than be excused from reaching a verdict. And asking
that question found a second, larger thing:

  with the label the case aborted at its FIRST match (:3712), so nothing ever checked what followed;
  with the assertions passing, `found` turned out to be 3 on the add-on path and 1 on Loom.

`REQUIRE(found == 1)` was arm-blind -- the weight is bound by three dispatches on the add-on path (#84's entry is
reached through them) and by one on Loom. The label had been hiding both that invariant and the kernel expectation,
for as long as it existed.

What the case now asserts, per arm:

  stored_copy_exists:
    REQUIRE(binding.layout == kNativeWeightLayout)        measured ggml-native on BOTH paths
    hip_addon_dispatch_active()  -> REQUIRE(name starts with "hip:")
    otherwise                    -> REQUIRE(name == loom_libs:...q5_k_iq4_xs..._token256) + weight_format == "4"

  final count: add-on >= 1 (measured 3), Loom == 1 (unchanged)

`>= 1` rather than `== 3` deliberately: three is a plan-shape number that moves the next time the add-on materialises
differently, while the invariant this case protects -- the weight is bound by the dispatch whose parameters were just
asserted -- is enforced per binding in both arms.

What the add-on arm cannot do, stated so nobody assumes otherwise: it cannot name the kernel, because add-on ids are
hashed by design (ggml-org#2392) and this one moves with any kernel edit. The specific choice stays pinned by
GGML_HRX_HIP_DENSE_PREFILL_Q4K_STORED=0 (gpu-kernels#85's opt-out, which flips the row back to the Loom kernel) and by
gpu-kernels' own tile probes.

Verified (add-on build at the pin):
  add-on row   [PASS] 1 passed, 0 failed, 0 known-fail, 0 unexpected-pass
  -loom row    [PASS] 1 passed, 0 failed, 0 known-fail, 0 unexpected-pass   (GGML_HRX_DISABLE_DISPATCH=hip.)
  (the hip_addon_known_fail entry is removed: with the case passing in both arms it would report UNEXPECTED-PASS)

Refs gpu-kernels#84 (the 306 entry), gpu-kernels#85 (the opt-out and the tile probes), engine#2392 (why add-on ids are
hashed, and the UNEXPECTED-PASS rule that retires a stale label), gpu-kernels#86 where the failure was reported.
bong-water-water-bong added a commit that referenced this pull request Nov 14, 2026
… add-on path (gpu-kernels#84's 306 entry) (#386)

* hrx-backend-test: label q4k_aligned_prefill_layout.stored_copy on the add-on path (gpu-kernels#84)

gpu-kernels#84 registered a matcher at priority 306 that claims "a 256-aligned batch of a Q4_K weight Loom
reads STORED" and routes it to hip.dense_prefill.mm_q4k_stored -- the +25-28 % prefill change. That is exactly
this case's stored-copy arm, which asserts the Loom q5_k/iq4_xs form instead:

  tests/hrx-backend-test.cpp:3712: name == "loom_libs:ggml_mul_mat_q5_k_iq4_xs_q8_1_x4_wmma_token256"

So with the add-on at the pin the case is red, and the loom-only build is untouched. Measured, in this order:

  add-on gk-b0ed206 (before #84)                    [PASS]
  add-on 6105368 (the pin)                          [FAIL] :3712
     ... with GGML_HRX_HIP_DENSE_PREFILL_Q4K_STORED=0  [PASS]   <- gpu-kernels#85's own opt-out bisects it

A label rather than a rewritten assertion because the alternative is not reachable in-process: the policy
knobs are read into static storage once per process (swiglu-tile-probe documents the same constraint for its
two runs), so the case cannot flip the opt-out mid-run. Doing it properly needs a child process per policy --
what llama.cpp#383 just established for the arch table -- and that is a follow-up, not a reason to leave the
suite red.

The `expect` fragment is the :3712 requirement itself, so any OTHER failure in this case still surfaces as
UNEXPECTED-FAIL instead of being absorbed by the label. Arm-scoping is hip_addon_dispatch_active(), which is
why the loom-only row still asserts the Loom kernel; 22 labels already exist and the loom row reports 0
known-fail, so that gate is demonstrably working.

Verified on the add-on build at the pin:
  one case:           1 known-fail, 0 unexpected-pass
  full host tier:     68 passed, 0 failed, 24 known-fail, 0 unexpected-pass of 92, zero UNEXPECTED-FAIL lines
  (was 68/1/23 of 92 -- the single failure becomes the label, nothing else moves)

Refs gpu-kernels#84 (the 306 entry), gpu-kernels#85 (the opt-out used to prove it), engine#2392 (this
labelling + UNEXPECTED-FAIL enforcement), gpu-kernels#86 where the failure was first reported as a control arm.

* hrx-backend-test: assert the add-on path in q4k_aligned_prefill_layout.stored_copy instead of labelling it

The three reviews of the label asked the right question -- is the expectation change temporary or permanent? It is
permanent (gpu-kernels#84's 306 entry claiming a 256-aligned stored-read Q4_K prefill is the shipped +25-28 %, not a
stopgap), so the case should say what the add-on path DOES rather than be excused from reaching a verdict. And asking
that question found a second, larger thing:

  with the label the case aborted at its FIRST match (:3712), so nothing ever checked what followed;
  with the assertions passing, `found` turned out to be 3 on the add-on path and 1 on Loom.

`REQUIRE(found == 1)` was arm-blind -- the weight is bound by three dispatches on the add-on path (#84's entry is
reached through them) and by one on Loom. The label had been hiding both that invariant and the kernel expectation,
for as long as it existed.

What the case now asserts, per arm:

  stored_copy_exists:
    REQUIRE(binding.layout == kNativeWeightLayout)        measured ggml-native on BOTH paths
    hip_addon_dispatch_active()  -> REQUIRE(name starts with "hip:")
    otherwise                    -> REQUIRE(name == loom_libs:...q5_k_iq4_xs..._token256) + weight_format == "4"

  final count: add-on >= 1 (measured 3), Loom == 1 (unchanged)

`>= 1` rather than `== 3` deliberately: three is a plan-shape number that moves the next time the add-on materialises
differently, while the invariant this case protects -- the weight is bound by the dispatch whose parameters were just
asserted -- is enforced per binding in both arms.

What the add-on arm cannot do, stated so nobody assumes otherwise: it cannot name the kernel, because add-on ids are
hashed by design (ggml-org#2392) and this one moves with any kernel edit. The specific choice stays pinned by
GGML_HRX_HIP_DENSE_PREFILL_Q4K_STORED=0 (gpu-kernels#85's opt-out, which flips the row back to the Loom kernel) and by
gpu-kernels' own tile probes.

Verified (add-on build at the pin):
  add-on row   [PASS] 1 passed, 0 failed, 0 known-fail, 0 unexpected-pass
  -loom row    [PASS] 1 passed, 0 failed, 0 known-fail, 0 unexpected-pass   (GGML_HRX_DISABLE_DISPATCH=hip.)
  (the hip_addon_known_fail entry is removed: with the case passing in both arms it would report UNEXPECTED-PASS)

Refs gpu-kernels#84 (the 306 entry), gpu-kernels#85 (the opt-out and the tile probes), engine#2392 (why add-on ids are
hashed, and the UNEXPECTED-PASS rule that retires a stale label), gpu-kernels#86 where the failure was reported.

---------

Co-authored-by: bcloud <agent@local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant