[PR #312] [CLOSED] QSA select: ROCWMMA block-scores arm (opt-in STRATA_SELECT_WMMA=1, gfx1100) #2566

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/312
Author: @xyzzing
Created: 9/30/2026
Status: ❌ Closed

Base: main ← Head: feature/qsa-select-rocwmma-optin


📝 Commits (3)

  • 8849753 QSA select: ROCWMMA block-scores arm (opt-in STRATA_SELECT_WMMA=1, gfx1100)
  • 8ec2d6e QSA select: WMMA parity harness (two independent references, PORTING 18 bound)
  • d02abde QSA select: the scorer bench and adversarial parity fixtures

📊 Changes

6 files changed (+617 additions, -46 deletions)

View changed files

📝 CMakeLists.txt (+37 -0)
📝 include/strata/kernels/qsa_select.hpp (+9 -0)
📝 src/kernels/cuda/qsa_select.cu (+150 -0)
📝 src/kernels/qsa_select_bench.cpp (+72 -42)
➕ src/kernels/qsa_select_wmma_parity.cpp (+323 -0)
📝 src/prefill/prefill.cpp (+26 -4)

📄 Description

Rework of #228 per your note — this PR is only the scorer, its parity test, the bench and the CMake detection. No .agentic/, AGENTS.md, CLAUDE.md, CI workflows, serve/telemetry.py, direct_file.*, or math_constants.h. (The rates-table row and the verify-profiler fix that were bundled in #228 are deliberately left out.)

What it is

The CUDA TF32 scorer can't run on gfx1100 (no mma.sync). This adds qsa_block_scores_wmma: a 16×16×16 ROCWMMA GEMM view of the block scores (FP16 operands, FP32 accumulation), reusing block_scores_tail_kernel unchanged so the tail n_bid stays bitwise the warp kernel's. Keys/queries convert to FP16 per call into an internal scratch.

Opt-in, default off (as requested)

  • STRATA_SELECT_WMMA=1 → try the ROCWMMA arm, else fall through
  • STRATA_SELECT_OLD=1 → force the warp kernel
  • default (unset) → the existing tensor-core (3xTF32) arm, then warp — unchanged behavior

The prompt path prints the arm that actually ran (strata select: prompt scorer arm = ...), so a quiet fallback can't masquerade as the fast path. Without rocWMMA headers the arm compiles out and the entry refuses; a CUDA build is untouched.

Commits

  1. The scorer + CMake detection + prompt-path dispatch (qsa_select.cu/.hpp, prefill.cpp, CMakeLists.txt).
  2. The WMMA parity harness — two independent references against the pre-derived fp16 bound.
  3. The bench + adversarial parity fixtures (--selftest).

gfx1100 numbers (RX 7900 XTX, IQ3_S — my card carries these, per your note)

  • Kernel: 10.5× vs the warp scorer at 128K (nq=256), median-of-9.
  • Parity: 5/5 fixtures within the pre-derived bound B(qi,b) = 2^-9.5·S + 8·2^-24·|score| (PORTING.md §18) over one-hot + coordinate-coded rows.
  • End-to-end (paired, greedy, n=10 each): 1K +0.18%, 4K +0.93%, 32K −4.54%, 64K +3.77%, 128K +8.7% — consistent with your read (+8.7% at 128K, −4.5..+3.8% elsewhere), and exactly why the arm stays opt-in rather than default.

Because the gain is context-dependent (clear at 128K, mixed below), the arm is opt-in and the default path is byte-for-byte unchanged. The parity harness and bench are included so you can rebuild and re-measure on any gfx1100. Numbers are from my campaign build (0.1.29-based engine of record); the scorer is additive and the prompt-path hook is a localized call-site edit that merges cleanly onto 0.1.30.

Built on the multi-query scorer (#187). Refs: PORTING.md §18 (parity bound).


🔄 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/312 **Author:** [@xyzzing](https://github.com/xyzzing) **Created:** 9/30/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feature/qsa-select-rocwmma-optin` --- ### 📝 Commits (3) - [`8849753`](https://github.com/Niko1221/Strata/commit/8849753a0313f898b3c086440fbfc0bd85a88f47) QSA select: ROCWMMA block-scores arm (opt-in STRATA_SELECT_WMMA=1, gfx1100) - [`8ec2d6e`](https://github.com/Niko1221/Strata/commit/8ec2d6ecfcc2ddbb30fc87963064fe4216ad1f1a) QSA select: WMMA parity harness (two independent references, PORTING 18 bound) - [`d02abde`](https://github.com/Niko1221/Strata/commit/d02abdec0f88f9dc37d7ca3073c82d291e20a261) QSA select: the scorer bench and adversarial parity fixtures ### 📊 Changes **6 files changed** (+617 additions, -46 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+37 -0) 📝 `include/strata/kernels/qsa_select.hpp` (+9 -0) 📝 `src/kernels/cuda/qsa_select.cu` (+150 -0) 📝 `src/kernels/qsa_select_bench.cpp` (+72 -42) ➕ `src/kernels/qsa_select_wmma_parity.cpp` (+323 -0) 📝 `src/prefill/prefill.cpp` (+26 -4) </details> ### 📄 Description Rework of #228 per your note — this PR is **only the scorer, its parity test, the bench and the CMake detection**. No `.agentic/`, `AGENTS.md`, `CLAUDE.md`, CI workflows, `serve/telemetry.py`, `direct_file.*`, or `math_constants.h`. (The rates-table row and the verify-profiler fix that were bundled in #228 are deliberately left out.) ## What it is The CUDA TF32 scorer can't run on gfx1100 (no `mma.sync`). This adds `qsa_block_scores_wmma`: a 16×16×16 ROCWMMA GEMM view of the block scores (FP16 operands, FP32 accumulation), reusing `block_scores_tail_kernel` unchanged so the tail `n_bid` stays bitwise the warp kernel's. Keys/queries convert to FP16 per call into an internal scratch. ## Opt-in, default off (as requested) - `STRATA_SELECT_WMMA=1` → try the ROCWMMA arm, else fall through - `STRATA_SELECT_OLD=1` → force the warp kernel - default (unset) → the existing tensor-core (3xTF32) arm, then warp — **unchanged behavior** The prompt path prints the arm that actually ran (`strata select: prompt scorer arm = ...`), so a quiet fallback can't masquerade as the fast path. Without rocWMMA headers the arm compiles out and the entry refuses; a CUDA build is untouched. ## Commits 1. **The scorer + CMake detection + prompt-path dispatch** (`qsa_select.cu`/`.hpp`, `prefill.cpp`, `CMakeLists.txt`). 2. **The WMMA parity harness** — two independent references against the pre-derived fp16 bound. 3. **The bench + adversarial parity fixtures** (`--selftest`). ## gfx1100 numbers (RX 7900 XTX, IQ3_S — my card carries these, per your note) - **Kernel**: 10.5× vs the warp scorer at 128K (`nq=256`), median-of-9. - **Parity**: 5/5 fixtures within the pre-derived bound `B(qi,b) = 2^-9.5·S + 8·2^-24·|score|` (PORTING.md §18) over one-hot + coordinate-coded rows. - **End-to-end** (paired, greedy, n=10 each): 1K **+0.18%**, 4K **+0.93%**, 32K **−4.54%**, 64K **+3.77%**, 128K **+8.7%** — consistent with your read (+8.7% at 128K, −4.5..+3.8% elsewhere), and exactly why the arm stays opt-in rather than default. Because the gain is context-dependent (clear at 128K, mixed below), the arm is opt-in and the default path is byte-for-byte unchanged. The parity harness and bench are included so you can rebuild and re-measure on any gfx1100. Numbers are from my campaign build (0.1.29-based engine of record); the scorer is additive and the prompt-path hook is a localized call-site edit that merges cleanly onto 0.1.30. Built on the multi-query scorer (#187). Refs: PORTING.md §18 (parity bound). --- <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:23 +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#2566
No description provided.