mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #313] [CLOSED] RDNA3 WMMA kernels for the gfx1100 prefill (opt-in, runtime-gated on gfx11; rebased on 0.1.30) #2567
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#2567
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/313
Author: @StevenChenSE
Created: 9/30/2026
Status: ❌ Closed
Base:
main← Head:wmma-optin📝 Commits (1)
1e42cf3RDNA3 WMMA kernels for the gfx1100 prefill: opt-in, runtime-gated on gfx11, rebased on 0.1.31📊 Changes
10 files changed (+1249 additions, -6 deletions)
View changed files
📝
CMakeLists.txt(+9 -1)📝
cmake/hip_backend.cmake(+8 -0)📝
docs/AMD_HIP.md(+40 -0)📝
include/strata/hip_compat/cuda_runtime.h(+8 -0)➕
include/strata/hip_compat/math_constants.h(+7 -0)📝
src/kernels/cuda/qsa_prompt_attn.cu(+388 -5)📝
src/prefill/gemm.cu(+28 -0)➕
src/prefill/wmma_gemm.cu(+298 -0)➕
src/prefill/wmma_gemm.h(+22 -0)➕
tests/hip/prefill_wmma_gemm_parity.cpp(+441 -0)📄 Description
Second attempt of #260, rebased on current main (engine 0.1.30) — reworked per the review. Single commit, 10 files.
Addressing the review
STRATA_WMMA_GEMM=1)STRATA_WMMA_GEMM=1enables the dense WMMA GEMMs (fp16 + bf16),STRATA_PA_WMMA=1the WMMA prompt attention;STRATA_WMMA_BF16=0still excludes just bf16. With the switches unset, WMMA does not run at all — the default hipBLASLt-table-to-fallback path is unchanged and output is bit-identical to today's build. When opted in, WMMA dispatches ahead of the table; measurement below shows that arrangement is also the faster one on this card.hipGetDeviceProperties().gcnArchNameand return false without agfx11prefix, so a gfx1201, a mixed-arch build, or any other device never executes WMMA code regardless of what was compiled. Additionally theSTRATA_WMMA_GFX11compile definition is now set only for gfx11CMAKE_HIP_ARCHITECTURESconfigurations.docs/AMD_HIP.mdandtests/hip/prefill_wmma_gemm_parity.cpp.efbbbf), andcmake/hip_backend.cmake(no BOM upstream) likewise untouched in encoding.What the PR contains
src/prefill/wmma_gemm.{cu,h}— dense GEMM over the RDNA3 WMMA fragment layout (16x16x16, wave32 "doubled" inputs), fp16 + bf16, dispatched fromGemm::f16/Gemm::bf16.src/kernels/cuda/qsa_prompt_attn.cu— the prompt attention on WMMA instead of the ordered FP32 fallback.tests/hip/prefill_wmma_gemm_parity.cpp— ctest-registered parity vs a double-precision host reference, 440 shapes × 4 beta/ldy configurations × 2 dtypes (partial tiles, padding, guards, declined shapes); passes on this base (freshly rebuilt from this branch's sources).strata_prefill, the arch-gated compile definition, the ctest registration, and theCUDART_INF_Fmapping hip_compat needs.docs/AMD_HIP.md.With/without numbers
One RX 7900 XTX, 6-core host, PCIe 4.0 x16, engine 0.1.30, the documented measured configuration (
--prefill 8192 --spec 4 --kv int8 --kv-resident 32768 --adapt-every 0 --pcie-frac 0,STRATA_PREFILL_MMQ=1), two interleaved repetitions per cell.Against the strongest BLAS available here. The shipped tables (100100/100200) don't match this ROCm's hipBLASLt 1.4.1 (100401), so I calibrated a table for this runtime with the repository's own
tools/hip/tune_hipblasltand compared against it (4K, ranking consistent in both pairs):GEMM=1 PA=1)WMMA leads the calibrated table by 10–27 % on prefill in both pairs, and the plain fallback by 55–90 %; decode is a wash at this sample size.
Switch sweep (the "off" arm here is the version-mismatched hipblasGemmEx fallback):
WMMA_GEMM=1GEMM=1 PA=1GEMM=1 PA=1Prefill: +31 % at the 1K median, +88 % at 32K vs the fallback; decode unchanged within this host's variance. Host and configuration named because they matter: expert offload over PCIe and a 6-core CPU are part of the setup.
Integration notes (without these the kernels compile but never run)
STRATA_USE_HIP— a privateSTRATA_BACKEND_HIPsilently compiled the dispatch out;__gfx1100__(it defines__HIP_DEVICE_COMPILE__), so the build suppliesSTRATA_WMMA_GFX11;hip_compatneedsCUDART_INF_F(CUDA'smath_constants.hspelling) mapped toHIP_INF_F.Not claimed
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.