mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #786] [CLOSED] hip: RDNA3 (gfx1100) WMMA kernel for the int8-KV QSA prompt attention (opt-in STRATA_HIP_WMMA, gfx12/gfx11) #2825
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2825
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/786
Author: @xyzzing
Created: 10/4/2026
Status: ❌ Closed
Base:
main← Head:feature/prompt-attn-wmma-rdna3📝 Commits (1)
49969d1hip: RDNA3 (gfx1100) WMMA kernel for the int8-KV QSA prompt attention (opt-in STRATA_HIP_WMMA, gfx12/gfx11)📊 Changes
2 files changed (+135 additions, -12 deletions)
View changed files
📝
src/kernels/cuda/qsa_prompt_attn.cu(+129 -9)📝
src/kernels/qsa_prompt_attn_parity.cpp(+6 -3)📄 Description
RDNA3 (gfx1100) WMMA kernel for the int8-KV QSA prompt attention — opt-in
STRATA_HIP_WMMA=1, gfx12 + gfx11This extends the S6 matrix-core prompt attention (currently gfx12-only) to RDNA3. gfx1100 keeps the ordered FP32 fallback as the default; the arm engages only under the existing
STRATA_HIP_WMMA=1opt-in, and the default path is byte-identical to current behavior. (In particular, unlike #313, nothing in the default HIP path changes — the scalar fallback stays exactly as upstream ships it.)Measured on an RX 7900 XTX (gfx1100, 24 GB), engine 0.1.39, ROCm 10.2 nightly SDK (hipBLASLt 100500 table, gfx1100), production-mirrored config (spec 3, GR_V3, --spec-min-p 0.70, --kv int8, --kv-resident 32768). Since there is no AMD card in the upstream test ring, these numbers carry the PR.
The layout that makes it work
RDNA3 runs the same
v_wmma_f32_16x16x16_f16instruction as gfx12, but through the unsuffixed builtin — and its wave32 fragment layout differs from the gfx12-suffixed builtin's on all three operands (AMD Matrix Instruction Calculator,rdna3tables, wave32, no modifiers; hardware-confirmed by a standalone probe before touching the kernel):l, slotiholdsA[l & 15][i]B[i][l & 15]D[(l >> 4) + 2*i][l & 15]Packing the gfx12 way into the RDNA3 builtin passes compilation and fails parity at ~30× the output scale. The kernel's packing sites re-index accordingly; the online-softmax protocol, LDS staging, per-cell K/V scales and masking are unchanged (the B side still holds one cell per lane, so the per-cell scale folds exactly as on gfx12).
Parity
Upstream's own
hip_prompt_attn_wmma(first time it runs off gfx12) — 3/3 PASS:Objdump gate: exactly 32
v_wmma_f32_16x16x16_f16in the compiled kernel (the loop body — no fallback can masquerade).End-to-end (paired A/B, arms alternate, same binary, env-gated)
The FP32 fallback was measured at 25.6% (128K) / 26.9% (32K) of prefill GPU time on this card — the single largest prefill phase.
Decode is flat at 32K (−0.03%) and 128K (medians equal) — the decode protection cap holds. Attribution agrees with the mechanism: the arm drops the qsa-attn share from 26–27% to 8.4–10.6% of prefill GPU time.
Notes
e[0] == '1'), and noSTRATA_WMMA_GFX11-style compile define leaks into other device passes — the arch gate is the same runtimegcnArchNameprefix check upstream already uses, extended togfx11.qsa_prompt_attn.cu,qsa_prompt_attn_parity.cpp) is deliberately minimal.6f32ec0, 0.1.39). Credit to @StevenChenSE's #313 for pioneering the gfx1100 WMMA prefill direction; the dense-GEMM half of that PR is orthogonal to this arm.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.