Skip to content

hrx: MoE decode GEMV without runtime divisors - #38

Merged
bong-water-water-bong merged 1 commit into
1bit/hrx-vulkan-patchedfrom
1bit/mmid-decode-no-runtime-div
Sep 29, 2026
Merged

bong-water-water-bong merged 1 commit into
1bit/hrx-vulkan-patchedfrom
1bit/mmid-decode-no-runtime-div

Conversation

@bong-water-water-bong

Copy link
Copy Markdown

Same issue as #37, this time in #32's MoE decode kernel. Newer Loom (hrx-system 244cd38) lowers integer division only for constant divisors on AMDGPU. The kernel divided its flat row index by the runtime slot count, and took the input row as slot % input_rows. That would stop compiling at the next HRX bump; the engine's pinned Loom still accepts it.

What changed:

  • The launch grid is (row pairs, slot_count, token_count), so slot and token come from the workgroup ids.
  • The input row is a select: the slot when each slot has its own activation, 0 when all slots share one.
  • The matcher now admits only those two input layouts (input_rows 1 or slot_count), which are the ones llama.cpp's MUL_MAT_ID produces.

Checked on strixhalo, HRX0:

  • ZAYA1-8B covers both layouts: gate/up read a shared input, down reads one per slot.
    • Greedy output, 6 prompts × 48 tokens: identical, max |Δlogprob| 0.
    • Decode: 66.5 tok/s before and after, over 3 interleaved rounds.
  • GLM-4.7-Flash still answers " Paris." through the kernel.

Not covered: a check.case for this kernel. The corpus's shared decode library files (AMD's) don't parse under 244cd38 yet, so a Loom-level test waits for AMD's corpus migration.

🤖 Generated with Claude Code

Newer Loom (hrx-system 244cd38) lowers integer division only for constant
divisors on AMDGPU. ops/mul_mat_id_decode_f32.loom split its flat row index
with index.div / index.rem by the runtime slot count and took the input row
as slot % input_rows, which would stop compiling at the next HRX bump (the
engine's pinned Loom still accepts it).

The launch grid is now (row pairs, slot_count, token_count), so the slot and
token come from the workgroup ids, and the input row is a select: slot when
each slot has its own activation, 0 when they share one. The matcher now
admits only those two input layouts (input_rows == 1 or == slot_count), the
ones llama.cpp's MUL_MAT_ID produces.

ZAYA1-8B HRX0 (gate/up read a shared input, down one per slot): greedy 6
prompts x 48 tokens identical, max |dlogprob| 0; decode unchanged (66.5 tok/s
before and after, 3 interleaved rounds). GLM-4.7-Flash HRX0 still answers
" Paris." through the kernel.

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

Copy link
Copy Markdown
Author

Merging over the windows job. It failed twice on different server tests (test_router_api_key_required, then test_incorrect_api_key), both with ConnectionResetError(10054) in the Windows server suite. This PR changes only ggml/src/ggml-hrx files, which the Windows build doesn't compile, and #36/#37 passed the same job. Every other runnable check passes.

@bong-water-water-bong
bong-water-water-bong merged commit 1174e7b into 1bit/hrx-vulkan-patched Sep 29, 2026
10 of 26 checks passed
bong-water-water-bong added a commit that referenced this pull request Oct 25, 2026
…ts the kernels (#144)

The #142 guard sends IQ2_S MUL_MAT_ID to HRX when the embedded hrx_prefill_gemm code object exports the IQ2_S kernels (names looked up in the code object), every batch incl. one token (GGML_HRX_HIP_IQ2S_MIN_TOKENS, default 1): a CPU decode reading experts the loader had moved into HRX memory collapsed to 0.64 tok/s. Flash-Next UD-IQ3_XXS on HRX0 with gpu-kernels #38: PPL 1.9514, pp512 297, tg128 25.2.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@bong-water-water-bong
bong-water-water-bong deleted the 1bit/mmid-decode-no-runtime-div branch November 12, 2026 21:16
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