[PR #95] [MERGED] HIP: RDNA3 dense GEMV for the decode's mv (Q6_K + BF16 in one launch, bit-exact) #332

Closed
opened 2026-10-29 21:24:17 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/95
Author: @mw00
Created: 10/10/2026
Status: ✅ Merged
Merged: 10/10/2026
Merged by: @mw00

Base: main ← Head: gorgon-halo-hip


📝 Commits (2)

  • 7f763ea HIP: RDNA3 dense GEMV for the decode's mv (Q6_K + BF16 in one launch, bit-exact)
  • 1715cf0 HIP RDNA3 GEMV: comments without mv_rows (not on main)

📊 Changes

4 files changed (+613 additions, -1 deletions)

View changed files

📝 CMakeLists.txt (+6 -0)
📝 include/strata/kernels/glm_expert_bench.hpp (+9 -0)
📝 src/kernels/cuda/glm_fast.cu (+294 -1)
➕ tests/hip/glm_mv_bench.cu (+304 -0)

📄 Description

The Gorgon Halo work's RDNA3 dense GEMV, on its own so it can ship before the MTP rework. On the RDNA 3.5 APUs (gfx115x) the decode's dense GEMVs (mv: the KDA/DSA projections, the shared experts, the dense FFN, the head - Q6_K and BF16) run in one launch of a kernel that keeps two super-blocks' loads in flight, and every output is bit for bit the original kernels'.

What changes

  • mv_rdna_kernel (src/kernels/cuda/glm_fast.cu, under STRATA_USE_HIP only):
    • one row per wave;
    • the loads of two Q6_K super-blocks issued before the arithmetic. The APU's LPDDR5X latency, not its bandwidth, set the pace before;
    • Q6_K's -32 as a second sudot4, instead of the __vsubss4 emulation;
    • the activations in LDS when K <= 4096.
  • Where it runs: by default on gfx115x (the APUs it was measured on). STRATA_GLM_MV_RDNA=1 runs it on any gfx11 (an RX 7900 has not been measured yet); STRATA_GLM_MV_RDNA=0 keeps the original kernels.
  • tests/hip/glm_mv_bench.cu: the model-free benchmark and parity test at Maya's decode shapes (ctest glm_mv_parity).
  • NVIDIA: nothing changes. Every addition is under STRATA_USE_HIP; the one shared line (mv() skips the jobs already done) is a no-op there.

Measured

Radeon 8065S, glm_mv_bench, us per batch, original -> new:

batch original new
kda_proj 384 366
kda_out 131 126
dsa_proj 59 46
dsa_q 152 145
dsa_out 258 244
router + shared expert 90 78
dense_down 197 182

dense_gu and the head are even. On Maya-S the decode is 3.1% faster (19.27 vs 18.70 tok/s).

Not in this PR

The Gorgon Halo branch's MTP work (cheaper drafts, the acceptance-weighted length search), its complete expert pool, and this kernel's multi-row path for the verify window are all built on the MTP rework (#76). They wait in a stacked PR on #76.

Checks

  • The original kernels this is compared against (mv_kernel_t, mv_kernel, row_dot_bf16, dot_q6_K) are the same on main as on the branch where the parity was measured.
  • tools/check_hip_compat.py: every CUDA name mapped.
  • NVIDIA: the build and the greedy tokens on 2x Tesla V100, as part of the release tree.
  • AMD, on the Gorgon Halo (Radeon 8065S, gfx1151; Windows, HIP SDK 7.2), in a fresh checkout of this branch:
    • the HIP build for gfx1100;gfx1201;gfx1151 with the tests on;
    • ctest -R glm_mv_parity: all 333 cases bit-exact (9 decode shapes x 37 configurations), differ=0 max_abs=0;
    • Maya-S, greedy, 5 x 256 tokens: the same tokens with the kernel on and off (STRATA_GLM_MV_RDNA=0), and the same as v1.0.30;
    • decode, run in on/off/on/off order: 19.27 tok/s on against 18.70 off (+3.1%), every answer faster in both pairs.

🔄 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/mw00/project-maya/pull/95 **Author:** [@mw00](https://github.com/mw00) **Created:** 10/10/2026 **Status:** ✅ Merged **Merged:** 10/10/2026 **Merged by:** [@mw00](https://github.com/mw00) **Base:** `main` ← **Head:** `gorgon-halo-hip` --- ### 📝 Commits (2) - [`7f763ea`](https://github.com/mw00/project-maya/commit/7f763ea17b59c3574d03f2a5a9c2041065faa2a2) HIP: RDNA3 dense GEMV for the decode's mv (Q6_K + BF16 in one launch, bit-exact) - [`1715cf0`](https://github.com/mw00/project-maya/commit/1715cf0d702193638a22c0d87cf11df4607a1cee) HIP RDNA3 GEMV: comments without mv_rows (not on main) ### 📊 Changes **4 files changed** (+613 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+6 -0) 📝 `include/strata/kernels/glm_expert_bench.hpp` (+9 -0) 📝 `src/kernels/cuda/glm_fast.cu` (+294 -1) ➕ `tests/hip/glm_mv_bench.cu` (+304 -0) </details> ### 📄 Description The Gorgon Halo work's RDNA3 dense GEMV, on its own so it can ship before the MTP rework. On the RDNA 3.5 APUs (gfx115x) the decode's dense GEMVs (mv: the KDA/DSA projections, the shared experts, the dense FFN, the head - Q6_K and BF16) run in one launch of a kernel that keeps two super-blocks' loads in flight, and every output is bit for bit the original kernels'. ## What changes - **`mv_rdna_kernel`** (src/kernels/cuda/glm_fast.cu, under `STRATA_USE_HIP` only): - one row per wave; - the loads of two Q6_K super-blocks issued before the arithmetic. The APU's LPDDR5X latency, not its bandwidth, set the pace before; - Q6_K's -32 as a second `sudot4`, instead of the `__vsubss4` emulation; - the activations in LDS when K <= 4096. - **Where it runs:** by default on gfx115x (the APUs it was measured on). `STRATA_GLM_MV_RDNA=1` runs it on any gfx11 (an RX 7900 has not been measured yet); `STRATA_GLM_MV_RDNA=0` keeps the original kernels. - **`tests/hip/glm_mv_bench.cu`:** the model-free benchmark and parity test at Maya's decode shapes (ctest `glm_mv_parity`). - **NVIDIA:** nothing changes. Every addition is under `STRATA_USE_HIP`; the one shared line (`mv()` skips the jobs already done) is a no-op there. ## Measured Radeon 8065S, `glm_mv_bench`, us per batch, original -> new: | batch | original | new | |---|---:|---:| | kda_proj | 384 | 366 | | kda_out | 131 | 126 | | dsa_proj | 59 | 46 | | dsa_q | 152 | 145 | | dsa_out | 258 | 244 | | router + shared expert | 90 | 78 | | dense_down | 197 | 182 | dense_gu and the head are even. On Maya-S the decode is 3.1% faster (19.27 vs 18.70 tok/s). ## Not in this PR The Gorgon Halo branch's MTP work (cheaper drafts, the acceptance-weighted length search), its complete expert pool, and this kernel's multi-row path for the verify window are all built on the MTP rework (#76). They wait in a stacked PR on #76. ## Checks - The original kernels this is compared against (`mv_kernel_t`, `mv_kernel`, `row_dot_bf16`, `dot_q6_K`) are the same on main as on the branch where the parity was measured. - `tools/check_hip_compat.py`: every CUDA name mapped. - NVIDIA: the build and the greedy tokens on 2x Tesla V100, as part of the release tree. - AMD, on the Gorgon Halo (Radeon 8065S, gfx1151; Windows, HIP SDK 7.2), in a fresh checkout of this branch: - the HIP build for gfx1100;gfx1201;gfx1151 with the tests on; - `ctest -R glm_mv_parity`: all 333 cases bit-exact (9 decode shapes x 37 configurations), `differ=0 max_abs=0`; - Maya-S, greedy, 5 x 256 tokens: the same tokens with the kernel on and off (`STRATA_GLM_MV_RDNA=0`), and the same as v1.0.30; - decode, run in on/off/on/off order: 19.27 tok/s on against 18.70 off (+3.1%), every answer faster in both pairs. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 21:24:17 +07:00
Sign in to join this conversation.
No labels
pull-request
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
mw00/project-maya#332
No description provided.