Repository navigation
ggml-hrx: Q8_0/Q4_0/Q4_1/Q5_0/Q5_1/IQ4_NL/MXFP4 prompt matmuls on the int8 x4 kernel (4B Q8_0 pp512 889 -> 2657) - #80
Conversation
Q8_0, Q4_0, Q4_1, Q5_0, Q5_1, IQ4_NL and MXFP4 have one scale per 32 values, one K32 block of the q8_1 x4 kernel, so its own contraction applies: motifs/nvfp4_q8_1_x4.loom stages two blocks per K chunk. Q8_0, Q4_0 (code - 8), Q5_0 (code - 16), IQ4_NL and MXFP4 (their tables) as signed values; Q4_1 and Q5_1 as unsigned codes with the block minimum as the K32 correction, which the kernel applies against the q8_1 activation sum. AMD's file: the Q2_0 flag becomes a format selector (@ggml_own_x4_format), the signed-weight flag comes from @ggml_own_x4_signed, the staging call takes the selector, and the weight_format config range widens to 80 (Q8_0); +52/-23 against its pre-#78 text. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ls take the q8_1 x4 kernel common.mul_mat.legacy_q8_1_x4_prefill (priority 300) shares the NVFP4 / Q2_0 matcher conditions. Qwen3-4B Q8_0, balanced mode: pp512 889 -> 2657 tok/s; KLD vs CPU 0.00705 -> 0.00085. Qwen3-0.6B with each format's projections: pp512 +16..49%, KLD vs CPU 0.0015..0.0018 (the generic f16 path gave 0.0032). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-value block formats on the x4 path For Q8_0, Q4_0, Q4_1, Q5_0, Q5_1, IQ4_NL and MXFP4: integer activations with |max| 127 per K32 block (exact q8_1, nonzero block sums, so a wrong offset or minimum term fails) against rows quantized at scales 2^-8..2^6; HRX must match an f64 reference from to_float to 1e-5 of sum |w x| (worst 6e-8). Then random weights against the CPU backend (NMSE <= 1.3e-9). Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Review (PR-Agent duty): good change. Three model checks before I approve, and the merge comes after the release, stacked after #79. Good:
Q4_0 and MXFP4 back release-pin models whose prompts now take this path, so please measure (HRX0 vs the #79 tip, same settings):
|
|
Verified on strixhalo (gfx1151, balanced power mode 85 W). Build: this branch at 89fdac0, HRX0. "Before" is the same binary with Settings: wikitext-2 test, c512, b512 (so ub 512, prompt-sized), 8 chunks,
The CPU baseline for Bonsai-2 is |
|
Closed under the 2026-10-03 direction: new GPU kernels are HIP in the private add-on, the public fork keeps plumbing and fixes. Q8_0 and MXFP4 prompt GEMMs already run on HIP there (hip.mul_mat_q8_0_prefill, the GEAK MXFP4/Q6_K GEMMs); Q2_0 / NVFP4 / Q4_0-Q5_1 prompt matmuls will be HIP kernels when a model needs them. The branch stays for reference. |
Prompt matmuls of the classic 32-value block formats, Q8_0, Q4_0, Q4_1, Q5_0, Q5_1, IQ4_NL and MXFP4, on the int8 q8_1 x4 WMMA kernel. Stacked on #79 (on #78). These formats no longer prefill on the generic f16 WMMA kernels, which also takes them out of the #284 f16-accumulation path.
How
motifs/nvfp4_q8_1_x4.loomstages two blocks per K chunk:mas the K32 correction, which the kernel already applies against the q8_1 activation sum.mul_mat_q5_k_q8_plane_wmma.loom:@ggml_own_x4_format, in our motif);@ggml_own_x4_signed;weight_formatconfig range widens to 80 (Q8_0).common.mul_mat.legacy_q8_1_x4_prefill(priority 300) uses the same matcher conditions as NVFP4 / Q2_0.Validation, gfx1151, balanced power mode:
Qwen3-0.6B with each format's projections, pp512 before -> after and KLD vs CPU after (the generic f16 path gave 0.0032):
The 0.6B is overhead-bound. The 4B Q8_0 row shows the size of the effect on a real model.
Not for the release pin.
🤖 Generated with Claude Code