[PR #856] [CLOSED] hip: RDNA3 (gfx1100) WMMA kernel for the QSA block-score select/scorer (opt-in STRATA_SELECT_WMMA, gfx12/gfx11) #2875

Closed
opened 2026-11-04 02:03:47 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/856
Author: @xyzzing
Created: 10/4/2026
Status: ❌ Closed

Base: main ← Head: feature/select-wmma-rdna3-0139


📝 Commits (3)

  • 49969d1 hip: RDNA3 (gfx1100) WMMA kernel for the int8-KV QSA prompt attention (opt-in STRATA_HIP_WMMA, gfx12/gfx11)
  • 9687100 QSA select: the gfx11 (RDNA3) WMMA block-scorer arm on the 0.1.39 line (#368 content)
  • 972a637 qsa_select_wmma_parity: the warp-kernel contraction pin demoted to a diagnostic

📊 Changes

8 files changed (+789 additions, -79 deletions)

View changed files

📝 CMakeLists.txt (+11 -0)
📝 include/strata/kernels/qsa_select.hpp (+9 -0)
📝 src/kernels/cuda/qsa_prompt_attn.cu (+129 -9)
📝 src/kernels/cuda/qsa_select.cu (+162 -2)
📝 src/kernels/qsa_prompt_attn_parity.cpp (+6 -3)
📝 src/kernels/qsa_select_bench.cpp (+118 -60)
➕ src/kernels/qsa_select_wmma_parity.cpp (+348 -0)
📝 src/prefill/prefill.cpp (+6 -5)

📄 Description

Companion to #786: the same RDNA3 WMMA treatment for the QSA select/scorer path, which the profiler puts at ~12-14% of 128K prefill on gfx1100.

What

  • qsa_block_scores_wmma: a gfx11 (RDNA3) WMMA block-scorer arm. Dispatch in qsa_block_scores_tc (qsa_select.cu) tries the gfx12 WMMA kernel first, then this arm under STRATA_SELECT_WMMA (opt-in; default unchanged). The tail block keeps the warp kernel's arithmetic (shared block_scores_tail_kernel, bitwise) and the +1e9 dead-tail rule is exact.
  • Parity harness src/kernels/qsa_select_wmma_parity.cpp (new): ragged query/block tiles, whole tiles, an x8-magnitude FP16-headroom case, degenerate n_kv=0, one-hot lane/store-adversarial case.

Arithmetic contract and parity (pre-derived before the kernel, rollout records §18): WMMA arm = FP16 inputs / FP32 accumulation; bound per entry B = 2^-9.5·S + 8·2^-24·|score| against a float64 oracle (S = the |k·q| magnitude sum, computed in f64 in the harness). Measured on the 10.2 nightly SDK: worst bound utilisation 11.0% across all cases, 0 differing selection IDs (top-k over warp vs WMMA scores, near-tie-gap guard), tail block bitwise the warp arm's, write-set canaries intact, negative control (+2.5·B perturbation) fails as required. The warp arm's host-model contraction pin (7.1.1-era: fma-left) no longer fits the nightly clang's v_fmac interleaving; the harness now enumerates six contraction shapes and reports the best fit as a diagnostic, with the oracle bound + selection agreement + tail check as the hard gates.

Measured, paired A/B (RX 7900 XTX, 0.1.39 + #786 arm-on in BOTH arms, arms differ only in STRATA_SELECT_WMMA; 5 pairs × 1k/32k/128k, odd pairs a-first):

tier prefill tok/s a→b (median) Δ decode tok/s a→b (median) Δ
128K 1506 → 1675 +11.2% 66.0 → 69.3 +4.9%
32K 1595 → 1689 +5.9% 73.6 → 74.4 +1.1%
1K 764 → 791 +3.5% 72.0 → 72.0 -0.0%

Mechanism: the qsa select phase drops 10249 ms → 1952 ms (5.25×; 11.8% → 2.4% of 128K prefill). Consistent with the earlier 0.1.33 measurement (+9.8% @128K, scorer microbench 11.6×). Decode: no regression in any tier (medians; the one 51.9 tok/s outlier in b-128k-p2 does not move the median).

Opt-in only. STRATA_SELECT_WMMA=1 enables the arm; the default path and the gfx12 arm are untouched.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/856 **Author:** [@xyzzing](https://github.com/xyzzing) **Created:** 10/4/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feature/select-wmma-rdna3-0139` --- ### 📝 Commits (3) - [`49969d1`](https://github.com/Niko1221/Strata/commit/49969d18e2147c94587fad1be22340469803f4be) hip: RDNA3 (gfx1100) WMMA kernel for the int8-KV QSA prompt attention (opt-in STRATA_HIP_WMMA, gfx12/gfx11) - [`9687100`](https://github.com/Niko1221/Strata/commit/9687100579ccf4649aa2356bd43ed63108cd99c9) QSA select: the gfx11 (RDNA3) WMMA block-scorer arm on the 0.1.39 line (#368 content) - [`972a637`](https://github.com/Niko1221/Strata/commit/972a63745e02a317d8e625521b996eeb625098b3) qsa_select_wmma_parity: the warp-kernel contraction pin demoted to a diagnostic ### 📊 Changes **8 files changed** (+789 additions, -79 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+11 -0) 📝 `include/strata/kernels/qsa_select.hpp` (+9 -0) 📝 `src/kernels/cuda/qsa_prompt_attn.cu` (+129 -9) 📝 `src/kernels/cuda/qsa_select.cu` (+162 -2) 📝 `src/kernels/qsa_prompt_attn_parity.cpp` (+6 -3) 📝 `src/kernels/qsa_select_bench.cpp` (+118 -60) ➕ `src/kernels/qsa_select_wmma_parity.cpp` (+348 -0) 📝 `src/prefill/prefill.cpp` (+6 -5) </details> ### 📄 Description Companion to #786: the same RDNA3 WMMA treatment for the QSA **select/scorer** path, which the profiler puts at ~12-14% of 128K prefill on gfx1100. **What** - `qsa_block_scores_wmma`: a gfx11 (RDNA3) WMMA block-scorer arm. Dispatch in `qsa_block_scores_tc` (qsa_select.cu) tries the gfx12 WMMA kernel first, then this arm under `STRATA_SELECT_WMMA` (opt-in; default unchanged). The tail block keeps the warp kernel's arithmetic (shared `block_scores_tail_kernel`, bitwise) and the `+1e9` dead-tail rule is exact. - Parity harness `src/kernels/qsa_select_wmma_parity.cpp` (new): ragged query/block tiles, whole tiles, an x8-magnitude FP16-headroom case, degenerate n_kv=0, one-hot lane/store-adversarial case. **Arithmetic contract and parity** (pre-derived before the kernel, rollout records §18): WMMA arm = FP16 inputs / FP32 accumulation; bound per entry **B = 2^-9.5·S + 8·2^-24·|score|** against a float64 oracle (S = the |k·q| magnitude sum, computed in f64 in the harness). Measured on the 10.2 nightly SDK: worst bound utilisation **11.0%** across all cases, **0 differing selection IDs** (top-k over warp vs WMMA scores, near-tie-gap guard), tail block **bitwise** the warp arm's, write-set canaries intact, negative control (+2.5·B perturbation) fails as required. The warp arm's host-model contraction pin (7.1.1-era: fma-left) no longer fits the nightly clang's `v_fmac` interleaving; the harness now enumerates six contraction shapes and reports the best fit as a diagnostic, with the oracle bound + selection agreement + tail check as the hard gates. **Measured, paired A/B** (RX 7900 XTX, 0.1.39 + #786 arm-on in BOTH arms, arms differ only in `STRATA_SELECT_WMMA`; 5 pairs × 1k/32k/128k, odd pairs a-first): | tier | prefill tok/s a→b (median) | Δ | decode tok/s a→b (median) | Δ | |---|---|---|---|---| | 128K | 1506 → 1675 | **+11.2%** | 66.0 → 69.3 | +4.9% | | 32K | 1595 → 1689 | +5.9% | 73.6 → 74.4 | +1.1% | | 1K | 764 → 791 | +3.5% | 72.0 → 72.0 | -0.0% | Mechanism: the `qsa select` phase drops 10249 ms → 1952 ms (5.25×; 11.8% → 2.4% of 128K prefill). Consistent with the earlier 0.1.33 measurement (+9.8% @128K, scorer microbench 11.6×). Decode: no regression in any tier (medians; the one 51.9 tok/s outlier in b-128k-p2 does not move the median). **Opt-in only.** `STRATA_SELECT_WMMA=1` enables the arm; the default path and the gfx12 arm are untouched. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:03:47 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2875
No description provided.