ggml-hrx: kernels for ZAYA's router and grouped conv; ZAYA1-8B decodes entirely on HRX (25.5 → 47.9 tok/s) - #24
Merged
bong-water-water-bong merged 2 commits intoSep 26, 2026
Conversation
added 2 commits
September 26, 2026 19:41
…, argsort, narrow get_rows, strided copy, broadcast repeat) New loom kernels with their dispatch registrations, for ops HRX sent to the CPU: - ggml_grouped_mul_mat_f16_f32: MUL_MAT with a batched F16 weight (one matrix per group, no broadcast), such as ZAYA's grouped convolution. This also lets the loader place such weights on HRX. - ggml_softmax_rows_f32 (no mask, scale 1), ggml_sum_rows_f32, ggml_argsort_rows_f32 (rank per element, ties by index), ggml_get_rows_small_f32 (rows narrower than 4 or not a multiple of 4; strided ids, as top-k views are), ggml_copy_strided_f32 (CONT of strided views, and REPEAT that only broadcasts, with zero strides). Each matcher claims only cases the existing kernels do not take. AMD files get one-line hookups: CMakeLists, dispatch-common, REPEAT in the declared ops. test-backend-ops -b HRX0, all against the CPU: MUL_MAT (batched F16 cases), SOFT_MAX 10/10, SUM_ROWS 6/6, ARGSORT 48/48, GET_ROWS 17/17, CONT 2/2, CPY 53/53, REPEAT 5/5.
- One token per sequence: the conv input transpose is a reshape, not a copy. - MEAN over the query-head group as SUM_ROWS + SCALE. - Qpre/Kpre reshape the contiguous matmul outputs instead of copying them. With the block entirely on HRX the copy made prefill wrong (perplexity 71.8). With the HRX kernels of the previous commit, ZAYA's decode graph on HRX0 goes from 641 graph splits to 1.
bong-water-water-bong
merged commit Sep 26, 2026
358cafc
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.
ZAYA1-8B decodes almost twice as fast on HRX0: its decode graph now runs entirely on the GPU (641 graph splits per token → 1).
Why it was slow. HRX sent seven ops in every ZAYA layer to the CPU, so each decode token made about three GPU↔CPU round trips per layer. The loader also left the 40 grouped-conv weights on the CPU, because HRX had no batched F16 matmul.
New HRX kernels (loom, with dispatch registrations; each matcher only claims cases the existing kernels do not take):
ggml_grouped_mul_mat_f16_f32ggml_softmax_rows_f32ggml_sum_rows_f32ggml_argsort_rows_f32ggml_get_rows_small_f32ggml_copy_strided_f32test-backend-ops -b HRX0, against the CPU:The AMD files get one-line hookups: CMakeLists,
dispatch-common.cpp, and REPEAT in the declared ops.ZAYA graph changes (
src/models/zaya.cpp):Measured on Strix Halo, ZAYA1-8B Q4_K_M,
GGML_HRX_DISABLE_DISPATCH=decode_split(what1bit serve --device hrxsets):llama-benchtg128Correctness:
-b 512/-b 2048test-llama-archs -a zayanow covers HRX0 too: OK (8.57e-06), and on Vulkan and CPU, all with save/reload.Not in this PR: prefill at 512 tokens still has 161 splits on HRX, and the decode-split flash-attention kernel stays off (ggml-org#140/ggml-org#123).
🤖 Generated with Claude Code