Skip to content

hrx: ZAYA CCA query/key mixing and norms at decode in one dispatch (ZAYA1-8B decode 81 -> 90 tok/s) - #40

Merged
bong-water-water-bong merged 1 commit into
1bit/hrx-vulkan-patchedfrom
1bit/zaya-cca-qk-norm
Sep 29, 2026
Merged

bong-water-water-bong merged 1 commit into
1bit/hrx-vulkan-patchedfrom
1bit/zaya-cca-qk-norm

Conversation

@bong-water-water-bong

Copy link
Copy Markdown

Stacked on #39. I'll retarget it to 1bit/hrx-vulkan-patched once #39 merges.

Why. Between the CCA convolution and RoPE, ZAYA:

  • mixes each query head with its key head, and each key head with the mean of its query group;
  • adds the convolution output;
  • RMS-normalizes every head, and scales the key heads.

That's ~30 graph nodes and 14 dispatches per layer at decode. ops/zaya_cca_qk_norm_decode_f32.loom does it in one dispatch (2.2 µs), one workgroup per head.

Matcher. dispatch-zaya-cca-qk-norm.cpp roots at the copy of the convolution output's query slice. Every node of both chains comes after the convolution in graph order, so the dispatch has its inputs ready. It checks the SCALE constants (0.5, 1/gqa), the RMS epsilon, and single consumers.

Loom workflow. The .loom file has a reference kernel and two check.case differentials (exact and random). Both pass under iree-test-loom --device=amdgpu --sanitizer=access with hrx-system 244cd38.

Checked on strixhalo (gfx1151), ZAYA1-8B Q4_K_M, HRX0, fused vs GGML_HRX_DISABLE_DISPATCH=zaya.cca_qk_norm:

plain fused
dispatches per token 2,565 2,005
token span 15.90 ms 14.30 ms
decode tg128, 3 interleaved rounds 81.3 / 81.0 / 79.8 89.6 / 89.9 / 90.4 tok/s
teacher-forced top-1 vs FP32 69/96 69/96
batch-1 wikitext PPL (4×512) 33.49 33.45

With #35–#39 this takes ZAYA1-8B HRX decode from 62 to ~90 tok/s. Vulkan is 93, so ZAYA now meets RFC 1bit-MONSTER/engine#213's decode gate (within 10%).

🤖 Generated with Claude Code

Between the CCA convolution and RoPE, ZAYA mixes each query head with its key
head and each key head with the mean of its query group, adds the convolution
output, RMS-normalizes every head and scales the key heads: ~30 graph nodes,
14 dispatches per layer at decode. ops/zaya_cca_qk_norm_decode_f32.loom does
it in one dispatch (one workgroup per head); dispatch-zaya-cca-qk-norm.cpp
matches it from the copy of the convolution output's query slice (every node of
both chains comes after the convolution in graph order) and checks the SCALE
constants, the RMS epsilon and single consumers. Hookups: manifest,
dispatch-common, CMake.

The .loom file carries a reference kernel and two check.case differentials
(exact and random); both pass under iree-test-loom --device=amdgpu
--sanitizer=access with hrx-system 244cd38.

ZAYA1-8B Q4_K_M, HRX0 (gfx1151), fused vs GGML_HRX_DISABLE_DISPATCH=zaya.cca_qk_norm:
- dispatches per token 2,565 -> 2,005; token span 15.90 -> 14.30 ms;
- decode tg128, 3 interleaved rounds: 81.3 / 81.0 / 79.8 -> 89.6 / 89.9 / 90.4 tok/s
  (Vulkan: 93);
- teacher-forced top-1 vs transformers FP32: 69/96 both;
- batch-1 wikitext perplexity (4 x 512): 33.49 -> 33.45.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the ggml label Sep 29, 2026
@bong-water-water-bong
bong-water-water-bong changed the base branch from 1bit/zaya-cca-conv-decode to 1bit/hrx-vulkan-patched September 29, 2026 17:48
@bong-water-water-bong
bong-water-water-bong merged commit c9283cf into 1bit/hrx-vulkan-patched Sep 29, 2026
10 of 24 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the 1bit/zaya-cca-qk-norm branch November 12, 2026 21:17
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