This repository was archived by the owner on Jul 9, 2026. It is now read-only.
perf(ggml-cuda mmq): Q4_K/Q5_K MMQ tuning for RDNA4 — +7.6% Qwen3.6-27B prefill#2
Open
DeanoC wants to merge 1 commit into
Open
perf(ggml-cuda mmq): Q4_K/Q5_K MMQ tuning for RDNA4 — +7.6% Qwen3.6-27B prefill#2DeanoC wants to merge 1 commit into
DeanoC wants to merge 1 commit into
Conversation
…7B prefill Q4_K/Q5_K MMQ path (gfx1201 / RDNA4), found by geo-evo over 9 iterations: - relax __launch_bounds__ minBlocks 2->1 (RDNA4 wave32 occupancy) - int2-vectorized y-tile flat copy in load_tiles - int4-vectorized x_dm LDS write in load_tiles_q4_K / load_tiles_q5_K Microbench (test-backend-ops, q4_K m=4096 n=512 k=14336): 1139 -> ~1037us = +9.8%. Real 27B (Qwen3.6-27B-Q4_K_M, pinned clocks): prefill pp512 583.6 -> 627.7 tok/s = +7.6%; decode unaffected (MMQ is the compute-bound batch path). Regressed approaches (dsB preload, stream-K, half2 prefetch) documented + reverted.
168f20a to
0699be8
Compare
Collaborator
Author
|
Updated to the iter-9 kernel: added the int4-vectorized x_dm LDS write (load_tiles_q4_K/q5_K), improving the result from +6.4% → +7.6% real 27B prefill (microbench +7.5% → +9.8%). Same-session pinned-clock A/B: stock 583.6 → optimized 627.7 tok/s. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
What
Tuning of the Q4_K/Q5_K MMQ path (
ggml/src/ggml-cuda/mmq.cuh) for RDNA4 / gfx1201, found autonomously by the geo-evo kernel loop over 9 iterations:__launch_bounds__minBlocks 2 → 1 (RDNA4 wave32 occupancy)load_tilesload_tiles_q4_K/load_tiles_q5_K(the biggest single win)MMQ is the compute-bound quantized-matmul path (prefill + dflash spec-decode verify), so kernel efficiency translates here — unlike the batch-1 matvec/decode path, which is VRAM-bandwidth-bound (a parallel MMVQ experiment got +40% microbench but 0 real decode gain; not included).
Results (gfx1201 / Radeon AI PRO R9700)
test-backend-ops perf,MUL_MAT q4_K m=4096 n=512 k=14336): 1139 → ~1037 µs = +9.8%unsloth/Qwen3.6-27B-Q4_K_M, pinned clocks, same-session A/B): prefillpp512583.6 → 627.7 tok/s = +7.6%; decodetg128unchanged (MMQ doesn't touch batch-1 decode)Notes
mmq.cuhis byte-identical betweenac06e543(base,perf/luce-verify-kernels) and the30c9d7dbase the change was measured on — applies cleanly.feat/rdna35-mmq-tile-override.Luce-Org/lucebox-ggmlwhen ready.🤖 Generated with Claude Code