Repository navigation
hrx: ZAYA CCA convolution at decode in one dispatch (ZAYA1-8B decode 72 -> 81 tok/s) - #39
Merged
bong-water-water-bong merged 1 commit intoSep 29, 2026
Conversation
ZAYA's CCA convolution (concat Q and K, append them to the two-step conv state and write the state back, a depthwise 2-tap conv plus bias, then per group of 128 channels a 2-tap grouped conv as two F16 matmuls, their sum and a bias) is ~35 graph nodes and 13 dispatches per layer at decode: 21% of a ZAYA1-8B layer (68 us of 328 us). ops/zaya_cca_conv_decode_f32.loom does it in one dispatch, one wave64 per output channel reading contiguous F16 weights; dispatch-zaya-cca-conv.cpp matches the exact decode structure (one token, one sequence) from the Q/K concat and leaves prefill and several sequences to the generic path. Hookups: manifest, dispatch-common, CMake. The .loom file carries a reference kernel and two check.case differentials (an exact constant case and a random-input comparison with the reference); both pass under iree-test-loom --device=amdgpu --sanitizer=access with hrx-system 244cd38, which also enforces constant divisors and proven bounds. ZAYA1-8B Q4_K_M, HRX0 (gfx1151), fused vs GGML_HRX_DISABLE_DISPATCH=zaya.cca_conv: - dispatches per token 3,045 -> 2,565; token span 17.95 -> 15.90 ms; - decode tg128, 3 interleaved rounds: 72.1 / 72.2 / 71.7 -> 81.2 / 81.0 / 80.8 tok/s; - teacher-forced top-1 vs transformers FP32: 69/96 both; - batch-1 wikitext perplexity (4 x 512, every token through the kernel): 33.31 -> 33.49 (CPU backend 34.30). Not bitwise: the kernel accumulates in its own order, so greedy text diverges after 8-43 tokens on 4 of 6 prompts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
bong-water-water-bong
merged commit Sep 29, 2026
a2a5e15
into
1bit/hrx-vulkan-patched
10 of 24 checks passed
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.
Part of RFC 1bit-MONSTER/engine#213 gate 1 (HRX decode within 10% of Vulkan; ZAYA1-8B Vulkan is 93 tok/s).
Why. ZAYA's CCA convolution is ~35 graph nodes and 13 dispatches per layer at decode: 68 µs of a 328 µs ZAYA1-8B layer (21%). The steps:
ops/zaya_cca_conv_decode_f32.loomdoes all of it in one dispatch (6.9 µs), one wave64 per output channel reading contiguous F16 weights.Matcher.
dispatch-zaya-cca-conv.cppmatches the exact decode structure (one token, one sequence), rooted at the Q/K concat, and leaves prefill and multi-sequence batches to the generic path. The code is in our own files; hookups are the manifest,dispatch-common, and CMake.Loom workflow (Ben Vanik's gist). The
.loomfile includes a plain reference kernel and twocheck.casedifferentials: an exact constant case, and a random-input comparison against the reference. Both pass underiree-test-loom --device=amdgpu --sanitizer=accesswith hrx-system 244cd38, whose stricter rules (constant divisors, proven bounds) the kernel already meets.Checked on strixhalo (gfx1151), ZAYA1-8B Q4_K_M, HRX0, fused vs
GGML_HRX_DISABLE_DISPATCH=zaya.cca_convin the same binary:Not bitwise. The kernel accumulates in its own order, so greedy text diverges after 8-43 tokens on 4 of 6 test prompts. Accuracy against the FP32 reference is unchanged.
🤖 Generated with Claude Code