Repository navigation
hip: the dense int8 prefill GEMM runs on the 8-bit WMMA - #240
Conversation
Qwen4-35B-A3B Q4_K_XL prefill +3.5% at pp4096 and Bonsai 2 9B Q2_0 +16.3% at pp4096 against the f16 GEMM, decode unchanged (leo A/B, noise under 1%). The dp4a body this branch started with measured slower than f16 on both and is gone. The int8 path is gated on wmma_gemm(), so only gfx11/gfx12 compile it.
A scale32 type's two 16-column WMMA steps chain in int32 (exact, 32 * 127^2 < 2^22) and fold once, halving the per-slot fold, its cvt and its LDS reads. Bonsai 2 9B Q2_0 prefill +21.3% at pp512 and +26.7% at pp4096 over f16, Qwen4-35B-A3B +4.7% at pp4096 (leo A/B, same binary, STRATA_MMQ= for f16). gemmi_q4_k 209 VGPR / 7 waves -> 135 / 10.
Main's RustingStudio#228 made mmq false while int8_gemm returns true on gfx11/12, so the tests built an f16 reference for a GEMM the launcher ran as int8. Tile lists also fell back to f16, which a test compared against int8 math (Q8_0 read 3.6e-3 off). gemmis_* now serves them as on CUDA: Q8_0 reads 8.2e-7.
Bonsai 2 9B Q2_0 3295 / 3196 tok/s at pp 512 / 4096 against 2589 / 2338 on the f16 GEMM; Qwen4-35B-A3B 1959 / 1873 at pp 4096 / 16384 against 1839 / 1767. STRATA_HIP_WMMA=0 and STRATA_MMQ are listed.
Aletheore Flash Lite review
No issues held up under independent verification (10 grounded, 0 confirmed by a second model). Review detailsReviewed 6 file(s); skipped 0. Dismissed 0; outside PR diff 0. Grounding: 10 of 10 proposed finding(s). |
🔍 Aletheore evidence diffgraph LR
n0["src/cuda/mod.rs"]
n1["src/hip/mod.rs"]
n2["backend.rs"]
n3["host_share.rs"]
n4["chat.rs"]
n5["device.rs"]
n6["lib.rs"]
n7["main.rs"]
n8["src/vulkan/mod.rs"]
n9["preflight.rs"]
n10["tests/common/mod.rs"]
n11["gpu_model.rs"]
n12["inkling2_attn_kv.rs"]
n13["kv_q8.rs"]
n14["kv_turbo.rs"]
n15["llama_numerics.rs"]
n16["vulkan_split_kv.rs"]
n0 --> n2
n0 --> n3
n0 --> n4
n0 --> n5
n0 --> n6
n0 --> n7
n0 --> n8
n0 --> n9
n0 --> n10
n0 --> n11
n0 --> n12
n0 --> n13
n0 --> n14
n0 --> n15
n0 --> n16
n1 --> n2
n1 --> n6
n1 --> n10
classDef changed fill:#d9772c,color:#fff,stroke:#b85f1c;
classDef changedFinding fill:#c0392b,color:#fff,stroke:#922b21;
classDef dependent fill:#f2f0ec,color:#18140f,stroke:#d6d0c5;
class n0 changed
class n1 changed
class n2 dependent
class n3 dependent
class n4 dependent
class n5 dependent
class n6 dependent
class n7 dependent
class n8 dependent
class n9 dependent
class n10 dependent
class n11 dependent
class n12 dependent
class n13 dependent
class n14 dependent
class n15 dependent
class n16 dependent
What changed
Aggregate deltas
|
|
Hi, ty, nice work on the 8-bit WMMA path. I merged it on top of main and the HIP stack, the only conflicts were the kernel name counts and the new q8 field next to the hipBLAS fields, easy to fix. |
|
Hi,
that was really required to have a chance to have mtp/dflash be of any use
at all. It's still a tie at best on my machine with qwen4. Before, it was
always faster without mtp.
…On Sun, Dec 6, 2026 at 4:31 PM Vasya ***@***.***> wrote:
*Vasyl-Trefilov* left a comment (RustingStudio/RustingStrata#240)
<#240 (comment)>
Hi, ty, nice work on the 8-bit WMMA path. I merged it on top of main and
the HIP stack, the only conflicts were the kernel name counts and the new
q8 field next to the hipBLAS fields, easy to fix.
One small thing I fixed on my side: the new comment in kernels.cu has the
text "#define MMA_FMA 1" in it, and the CUDA test
cubin_cache_key_changes_with_mma_fma checks that an RTX 20 card's source
has no "#define MMA_FMA", so it failed. I changed the comment to say "a
global MMA_FMA define". After that the CUDA tests pass, including your new
int8_gemm_dense_matches_reference, so the CUDA int8 path is the same as
before.
I can not run RDNA3 here, so I trust your numbers for the card. It goes in
after the hipBLAS stack.
—
Reply to this email directly, view it on GitHub
<#240?email_source=notifications&email_token=AAGRZ2IILHJ32ZJEEJUX2ST54V3WPA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTONBVHE4TEMZSGUY2M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-7459923251>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGRZ2IFCWTMEUHLITLF5R354V3WPAVCNFSNUABGKJSXA33TNF2G64TZHMYTIMJTGA3DOOJQGE5US43TOVSTWNRYGIZTENZWG4ZDFILWAI>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AAGRZ2MUFIXEUOB724GV4V354V3WPA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTONBVHE4TEMZSGUY2M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG>
and Android
<https://github.com/notifications/mobile/android/AAGRZ2L2J5EW4VCWUB7FJKT54V3WPA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTONBVHE4TEMZSGUY2M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>.
Download it today!
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
The dense int8 prefill GEMM now runs on the 8-bit WMMA (
v_wmma_i32_16x16x16_iu8), which issues in ~3 cycles per 16x16x16 tile against the f16 form's 16. On an RX 9070 XT (gfx1201) it beats the f16 GEMM for every int8 type, and it is the first int8 prefill path HIP has had:int8_gemmreturned false before, and #228 setmmqfalse to match.Measured
leo-ab, one binary,STRATA_MMQ=forces the f16 GEMM for the other arm, 2 rounds ABBA, all cells ok, noise under 1%. Prefill tok/s:Decode is unchanged (it runs the int8 GEMV-N, not this GEMM). MTP at k=1 (+27.9% decode) and DFlash2 are unchanged too; routing the MTP/DFlash verify step through this GEMM (
STRATA_VERIFY_GEMM) is a wash againstgemvn.gemmi_q4_kis 135 VGPR / 10 waves, against 176 / 8 for the f16gemm_q4_k.How it works
compat.h:strata_ld_wmma_i8/strata_wmma_i8, the gfx12 and gfx11 builtins. The fragment map is undocumented by AMD (ROCm issue #6025); it was confirmed on the card against a standalone harness and cross-checked with radiance'slibr4d/r4d_fp8_wmma.h.kernels.cu: aGEMMI_WMMAbody ingemmi_qreusing the loop's existing int8 staging. Ascale32type chains its two 16-column WMMA steps in int32 (exact: 32 * 127^2 < 2^22) and folds once per 32-column weight scale; the chained fold is what made the difference between winning by 9% and by 27% on Q2_0.hip/mod.rs:int8_gemm/mmqare gated onwmma_gemm()(a gfx11/gfx12 arch withSTRATA_HIP_WMMA), so other targets keep the f16 GEMM. Tile lists takegemmis_*as on CUDA.mmqnow returnsint8_gemm. It has to: the tests build their reference math from it, and hip: mmq is false, as this backend has no int8 GEMM #228's blanketfalsewould have described a GEMM the launcher runs as int8. On a target without the WMMA both are false, which is hip: mmq is false, as this backend has no int8 GEMM #228's state.Checks
tests/kernelson gfx1201: 38 passed, 2 failed, and both (moe_mailbox_round_trip,tensor_scale_applies_to_all_gpu_ops) fail identically on 37291b8.hiprtc_compiles_the_kernelspasses for gfx1201 and gfx1100. A newint8_gemm_dense_matches_referencecovers Q4_K/Q6_K/Q8_0/Q2_0 at 640 and 2560 columns on both tile shapes, to 1e-4.docs/HIP.mdhas the numbers and theSTRATA_MMQswitch.