Repository navigation
ggml-hrx: claim a gated delta net only when its q, k and v come from ops - #118
Merged
bong-water-water-bong merged 1 commit intoOct 20, 2026
Merged
Conversation
fused_context_claim kept GATED_DELTA_NET on HRX whenever any source was produced by an op. The test-backend-ops GATED_DELTA_NET cases build q and k as L2_NORMs of leaves and v from a leaf. While L2_NORM had no standalone HRX path those cases were skipped; gpu-kernels #12 added one, the GDN node was then claimed through its L2_NORM inputs, no dispatch matches such a graph, and 31 cases failed with "graph_compute: unsupported HRX node 0: GATED_DELTA_NET" (hw-gate run 39510505298, engine #480: ops 618/649). The model graphs (qwen35, qwen35moe, qwen3next) feed v from a view of the delta-net conv and q, k from L2_NORMs of views of it, so the claim now also requires v produced by an op and q, k produced by ops whose L2_NORM, if any, reads an op output. Co-Authored-By: Claude Opus 5.5 <[email protected]>
bong-water-water-bong
pushed a commit
that referenced
this pull request
Nov 13, 2026
…esurrected My restore commit (0cebcb5) put back 65 files under loom-libs/ that AMD's tip does not have: it restored against a layout that predates upstream's "Factor into composable kernels (#118)", which moved kernels into motifs/<family>/ subdirectories. Seven of the 65 are BYTE-IDENTICAL to a file the new layout already holds, so dropping them changes nothing the compiler can see: motifs/binary_f32_apply.loom motifs/unary_f32_apply.loom ops/get_rows_scalar_3d_f32.loom ops/repeat_scalar_3d_f32.loom ops/skinny_input_f32_scaled_publish_f32.loom ops/tiled_input_f32_scaled_publish_f32.loom ops/unary_f32.loom I checked content hashes rather than names, because the point of #118 is that a kernel's file can move and its name can stay. The other 58 are not duplicates and are deliberately left alone: some are genuinely ours (the IQ3S table decode), and deleting a file because AMD's tip lacks it would drop our features, not just our leftovers.
bong-water-water-bong
pushed a commit
that referenced
this pull request
Nov 13, 2026
…elector as the fallback it replaced Two refs in dispatch-gated-mul-mat-id.cpp named kernels the merged corpus does not have, and the build said so from a static_assert in a file with no conflict markers at all: ggml_mul_mat_id_swiglu_f32_f32_wmma removed by upstream 01175b6 "Factor into composable kernels (#118)" ggml_mul_mat_id_swiglu_f32_f32_wmma_iq3s_table ours, engine ggml-org#572 item 4, never in AMD's manifest First half needs no judgement: AMD's own file already answers it. At 9bf5871 the choice is a function, not a ternary -- match.token_count <= 5 ? kMulMatIdSkinnySwiGLUF32F32Kernel : kMulMatIdTiledSwiGLUF32F32Kernel -- and that function is already present in the merged file. So the selection now composes ours' override around AMD's selector: IQ3S table decode when the match selects it, AMD's tiled/skinny arms otherwise. The dead ref goes. Second half is a real choice with a cost either way: adding the IQ3S entry to the manifest breaks the two-manifest closure we kept whole, and dropping it silently removes a measured optimisation (-55% vector ALU, VGPR 153->100) from routed IQ3_XXS prefill. A merge is the wrong place to lose that, so the entry is added -- as an explicit addition beside AMD's, cloned from the id-swiglu f16_f16 entry because the op, the operands and therefore the binding list are the same, with source pointing at our file. The generator's own validator caught the one thing I got wrong on the first attempt (an emptied library_sources disagrees with the legacy dependency closure), which is the right failure mode for a manifest edit. Verified: kernel corpus regenerates (167 exports, iq3s_table present in the generated catalog) and the TU compiles with no diagnostics.
bong-water-water-bong
pushed a commit
that referenced
this pull request
Nov 13, 2026
…in (4th and 5th non-marker defects) Same shape twice, found by building rather than by triage: dispatch-get-rows.cpp 0 lines at our tip, 628 at AMD's pin, 461 in the merge -> took AMD's dispatch-mul-mat-id.cpp 0 lines at our tip, 533 at AMD's pin, 521 in the merge -> took AMD's Both are files our line never had, so there is nothing of ours to preserve, and the merged copies were short. The measurable damage was in the kernel refs: the merged mul-mat-id named ggml_mul_mat_id_f32_f32_wmma / _postops_f32_f32_wmma / _postops_next_rmsnorm_f32_f32_wmma, which are the PRE-#118 naming scheme and cannot resolve, because #118 replaced each single kernel with a tiled/skinny pair: kMulMatIdF32F32WmmaKernel -> kMulMatIdTiledF32F32Kernel + kMulMatIdSkinnyF32F32Kernel kMulMatIdPostOpsF32F32WmmaKernel -> ...TiledPostOpsF32F32Kernel + ...SkinnyPostOpsF32F32Kernel kMulMatIdPostOpsNextRmsNormF32F32Wmma... -> ...TiledPostOpsNextRmsNorm... + ...SkinnyPostOpsNextRmsNorm... So "old names in a short file" was the signature of every one of these: a file that exists only on AMD's side, partially applied. AMD's registry in each is a superset of the merged one, which is the check that made taking it whole safe. Note for the next person: dispatch-gated-mul-mat-id.cpp looks like the same case (also 0 lines at our tip) but is NOT -- it is a real merge of AMD's file with our IQ3S table additions, and I briefly clobbered my own composition by checking AMD's copy over it. Restored from 2d2e279 (304 lines, 5 iq3s refs, AMD's selector in use, compiles clean). The difference is that its merged copy was LONGER than AMD's. Verified: both files compile with no diagnostics.
bong-water-water-bong
added a commit
that referenced
this pull request
Nov 13, 2026
…m 1, engine#2381) (#341) * tests: the routed gate/up check accepts the composable pair-input kernels (engine#2374 item 1) routed_moe_decode.q6_k.true failed with 'gate_up_routed', which I first read as our dispatch missing AMD's q8-activation arms after the engine#2138 decision. It is not: with GGML_HRX_LOG_DISPATCH=1 the plan shows the matcher firing -- ggml_hrx dispatch: common.mul_mat_id_swiglu.f32_f32_wmma (fused) -- and that registration selects through mul_mat_id_swiglu_f32_kernel(), which returns the SKINNY pair-input kernel at token_count <= 5 and tiled above. Those are the composable kernels upstream #118 produced when it factored the monolith. So the code launches the right kernel and the test's accepted set predates the refactor: a Q6_K decode pair correctly lands on ggml_mul_mat_id_skinny_pair_input_f32_swiglu_publish_f32, which the case did not list. The check's intent -- 'a routed mul_mat_id SwiGLU kernel is in the plan' -- is satisfied by either naming, and the case already accepts three alternatives, so the two composable names join that set with the reason in a comment. Verified on the device: the case no longer aborts (exit 0, no requirement failure). * tests: the partition-table reference shares the router's descriptor layout (engine#2381) qwen_expert_table_partition_prefill_512_execution was the last failing case of hrx-backend-test's device tier, and the issue's own summary said all 128 entries were off by a constant. They were: the case uses expert_count = 128, so moe_router_descriptor_layout() returns the Qwen layout (mask 127, partition shift 7, row-count shift 13) -- which is exactly what the qwen3_moe routed kernels decode -- while this reference hard-coded the COMMON layout (partition << 9, (row_count-1) << 15). Expert field matched, partition and row-count were two bits off, so every entry disagreed with a CORRECT device result. The reference now calls the same selector the router calls and shifts by layout.partition_shift / layout.row_count_shift, so a future layout change cannot desynchronise the pair. Verified on the device in a gpu-hold window (coder-llm stopped and restarted, :8090 answered): [PASS] qwen_expert_table_partition_prefill_512_execution, device 1 passed / 0 failed. On the full tier this is the 12/13 -> 13/13 case. --------- Co-authored-by: bcloud <bcloud@localhost>
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.
Engine #480's gate: ops 618/649, all 31 failures GATED_DELTA_NET ("unsupported HRX node 0"). test-backend-ops builds q/k as L2_NORM of leaf tensors; once gpu-kernels #12 added a standalone L2_NORM, fused_context_claim (rule: any source produced by an op) claimed the GDN node, but no GDN matcher accepts that graph. Now v must come from an op and q/k from ops whose L2_NORM (if any) reads an op output. Our own file (fused-context-claim.h). Model graphs unchanged (Qwen3.8-27B still dispatches llm.gated_delta_net.f32_wmma_head128 + hip.q36.gdn_decode); ops back to 618/618.
🤖 Generated with Claude Code