[PR #368] [CLOSED] QSA select: RDNA3 (gfx1100) WMMA block-scores arm on #337's arch dispatch (opt-in STRATA_SELECT_WMMA=1) #2599

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

📋 Pull Request Information

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

Base: main ← Head: pr-qsa-select-wmma-rdna3


📝 Commits (1)

  • ae3e1b7 QSA select: RDNA3 (gfx1100) WMMA block-scores arm on the arch dispatch (opt-in STRATA_SELECT_WMMA=1)

📊 Changes

6 files changed (+629 additions, -67 deletions)

View changed files

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

📄 Description

QSA select: RDNA3 (gfx1100) WMMA block-scores arm on #337's arch dispatch (opt-in STRATA_SELECT_WMMA=1)

Rebase of #312 as requested ("rebase this onto #337's HIP scorer entry point (it dispatches by arch) and keep it
opt-in under STRATA_SELECT_WMMA=1"). Stacked on #337: it merges that branch first, then adds the gfx1100 arm.

What the dispatch looks like now

qsa_block_scores_tc on HIP dispatches by architecture, one arm per card family:

  1. gfx12 (RDNA4) — #337's block_scores_wmma_kernel (bf16 three-way split), unchanged.
  2. gfx1100 (RDNA3) — this PR's block_scores_wmma_gfx11_kernel: rocWMMA 16x16x16 FP16 operands, FP32
    accumulation, wave32; keys and queries converted to FP16 per call into an internal scratch (the conversion is
    part of the arm's cost). Opt-in: STRATA_SELECT_WMMA=1 — its scores are FP16-input with another summation
    order, so they can change selection. STRATA_SELECT_OLD=1 still forces the warp kernel above all of this.
  3. anything else — return false, the warp kernel (unchanged default behavior; no card sees a new arm by default).

The arm that ran is printed once (strata select: prompt scorer arm = ...), so an opt-in that quietly fell back
cannot masquerade as the fast path.

Evidence (all measured on the card the PR targets)

  • Parity, 5/5 cases incl. adversarial fixtures (re-run on this branch's own 0.1.31 build) (qsa_select_wmma_parity, registered with ctest): the warp arm
    is bitwise == its host model; the tail block is bitwise == the warp arm (shared tail kernel — no new tail
    arithmetic); every score inside the pre-derived bound B(qi,b) = 2^-9.5 * S(qi,b) + 8 * 2^-24 * |score| vs a
    FP64 oracle (worst utilisation 0-11%); selection ids agree wherever the gap > 2B; the +2.5B negative control
    correctly FAILS the suite (the harness can detect a defect of the size the bound claims to cover).
  • Kernel bench @128K ctx (nq=256): warp 2.735 ms → wmma 0.235 ms = 11.64x on the kernel, re-measured on this branch's 0.1.31 build (the 0.1.24-base campaign measured 11.05x — same kernel, new base); the
    same kernel measured paired end-to-end at +8.7% at 128K (1K +0.2% ... 64K +3.8%; 123 paired cells,
    STRATA_SELECT_WMMA=1 vs default; decode within the protected cap) - that full table is in #312's description
    and carries over: the kernel is byte-identical through the 0.1.29/0.1.30/0.1.31 rebases, only the base moved.
  • The bench (qsa_select_bench) gains an FP64 accuracy gate sampled against all present arms and returns non-zero
    on a failed gate or a register-top-k mismatch (addressing the Copilot review items on #337's bench for our arm).

Files

CMakeLists.txt (parity + bench registration, rocWMMA detection), include/strata/kernels/qsa_select.hpp,
src/kernels/cuda/qsa_select.cu, src/kernels/qsa_select_bench.cpp (merged with #337's capacity-arg + FP64-gate
form), src/kernels/qsa_select_wmma_parity.cpp, src/prefill/prefill.cpp (call site unchanged from #337's —
the dispatch is internal to qsa_block_scores_tc).

We have no RDNA4 card, so the gfx12 arm is #337's and theirs to carry; on our RX 7900 XTX every number above is
personally reproduced. Default behavior on every architecture is unchanged unless STRATA_SELECT_WMMA=1.


Validated on this branch's own 0.1.31 build (gfx1100): parity 5/5, bench 128K 11.64x kernel with the wmma arm at worst 0.09 of its pre-declared bound, register top-k ids identical 256/256. The bench's FP64 gate applies each arm's own declared contract (4x-warp for the FP32-level arms; the 2^-9.5*S fp16-conversion bound for this arm - the same bound the parity suite enforces).


🔄 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/368 **Author:** [@xyzzing](https://github.com/xyzzing) **Created:** 10/1/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr-qsa-select-wmma-rdna3` --- ### 📝 Commits (1) - [`ae3e1b7`](https://github.com/Niko1221/Strata/commit/ae3e1b715caa896325b7c0a45a82a8a37287f2bb) QSA select: RDNA3 (gfx1100) WMMA block-scores arm on the arch dispatch (opt-in STRATA_SELECT_WMMA=1) ### 📊 Changes **6 files changed** (+629 additions, -67 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+11 -0) 📝 `include/strata/kernels/qsa_select.hpp` (+9 -0) 📝 `src/kernels/cuda/qsa_select.cu` (+162 -2) 📝 `src/kernels/qsa_select_bench.cpp` (+118 -60) ➕ `src/kernels/qsa_select_wmma_parity.cpp` (+323 -0) 📝 `src/prefill/prefill.cpp` (+6 -5) </details> ### 📄 Description # QSA select: RDNA3 (gfx1100) WMMA block-scores arm on #337's arch dispatch (opt-in STRATA_SELECT_WMMA=1) Rebase of #312 as requested ("rebase this onto #337's HIP scorer entry point (it dispatches by arch) and keep it opt-in under STRATA_SELECT_WMMA=1"). Stacked on #337: it merges that branch first, then adds the gfx1100 arm. ## What the dispatch looks like now `qsa_block_scores_tc` on HIP dispatches by architecture, one arm per card family: 1. **gfx12 (RDNA4)** — #337's `block_scores_wmma_kernel` (bf16 three-way split), unchanged. 2. **gfx1100 (RDNA3)** — this PR's `block_scores_wmma_gfx11_kernel`: rocWMMA 16x16x16 FP16 operands, FP32 accumulation, wave32; keys and queries converted to FP16 per call into an internal scratch (the conversion is part of the arm's cost). **Opt-in: `STRATA_SELECT_WMMA=1`** — its scores are FP16-input with another summation order, so they can change selection. `STRATA_SELECT_OLD=1` still forces the warp kernel above all of this. 3. anything else — `return false`, the warp kernel (unchanged default behavior; no card sees a new arm by default). The arm that ran is printed once (`strata select: prompt scorer arm = ...`), so an opt-in that quietly fell back cannot masquerade as the fast path. ## Evidence (all measured on the card the PR targets) - **Parity, 5/5 cases incl. adversarial fixtures** (re-run on this branch's own 0.1.31 build) (`qsa_select_wmma_parity`, registered with ctest): the warp arm is bitwise == its host model; the tail block is bitwise == the warp arm (shared tail kernel — no new tail arithmetic); every score inside the pre-derived bound `B(qi,b) = 2^-9.5 * S(qi,b) + 8 * 2^-24 * |score|` vs a FP64 oracle (worst utilisation 0-11%); selection ids agree wherever the gap > 2B; the +2.5B negative control correctly FAILS the suite (the harness can detect a defect of the size the bound claims to cover). - **Kernel bench @128K ctx (nq=256)**: warp 2.735 ms → wmma 0.235 ms = **11.64x** on the kernel, re-measured on this branch's 0.1.31 build (the 0.1.24-base campaign measured 11.05x — same kernel, new base); the same kernel measured paired end-to-end at **+8.7% at 128K** (1K +0.2% ... 64K +3.8%; 123 paired cells, `STRATA_SELECT_WMMA=1` vs default; decode within the protected cap) - that full table is in #312's description and carries over: the kernel is byte-identical through the 0.1.29/0.1.30/0.1.31 rebases, only the base moved. - The bench (`qsa_select_bench`) gains an FP64 accuracy gate sampled against all present arms and returns non-zero on a failed gate or a register-top-k mismatch (addressing the Copilot review items on #337's bench for our arm). ## Files `CMakeLists.txt` (parity + bench registration, rocWMMA detection), `include/strata/kernels/qsa_select.hpp`, `src/kernels/cuda/qsa_select.cu`, `src/kernels/qsa_select_bench.cpp` (merged with #337's capacity-arg + FP64-gate form), `src/kernels/qsa_select_wmma_parity.cpp`, `src/prefill/prefill.cpp` (call site unchanged from #337's — the dispatch is internal to `qsa_block_scores_tc`). We have no RDNA4 card, so the gfx12 arm is #337's and theirs to carry; on our RX 7900 XTX every number above is personally reproduced. Default behavior on every architecture is unchanged unless `STRATA_SELECT_WMMA=1`. --- Validated on this branch's own 0.1.31 build (gfx1100): parity 5/5, bench 128K 11.64x kernel with the wmma arm at worst 0.09 of its pre-declared bound, register top-k ids identical 256/256. The bench's FP64 gate applies each arm's own declared contract (4x-warp for the FP32-level arms; the 2^-9.5*S fp16-conversion bound for this arm - the same bound the parity suite enforces). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:01:40 +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#2599
No description provided.