[PR #634] gfx1151: the fused prompt experts at 3 blocks a multiprocessor (prefill +3.5% on Strix Halo) #638

Open
opened 2026-10-29 21:27:44 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/634
Author: @mrsirg97-rgb
Created: 10/28/2026
Status: 🔄 Open

Base: main ← Head: fused-moe-speed


📝 Commits (1)

  • b894045 gfx1151: the fused prompt experts at 3 blocks a multiprocessor for every type pair

📊 Changes

3 files changed (+138 additions, -3 deletions)

View changed files

📝 CMakeLists.txt (+4 -0)
📝 src/prefill/moe_fused_rdna4.cu (+7 -3)
➕ tests/hip/prefill_fused_bench.cpp (+127 -0)

📄 Description

On gfx1151 (Strix / Gorgon Halo), the fused GLM prompt experts now size their persistent grid at 3 blocks per multiprocessor for every type pair. It's a one-line change in moe_fused_rdna4.cu's experts(). gfx1100 and RDNA4 keep their current factors, since I can't measure them.

Why. The grid was 4 blocks per multiprocessor, except 3 for IQ2_S / IQ2_XS. On a Radeon 8060S, 3 is faster or equal for every supported pair; 4 and 5 are the slowest, and 6 falls in between. HIP's occupancy query reports 2 resident blocks per multiprocessor for these kernels (LDS-bound), and that doesn't explain the curve: 2 blocks measures about as slow as 4. So this is a measured constant, the same way the existing 3 and 4 were chosen. Each output is still computed by one block in the same order, so the results are bit-for-bit identical.

New microbenchmark. tests/hip/prefill_fused_bench.cpp (hip_prefill_fused_bench, EXCLUDE_FROM_ALL) runs one GLM layer's fused experts at a real shape: 288 experts, 8 routed per token, IQ2_XXS gate/up and IQ3_XXS down by default, random valid blocks. It prints the median time, int8 TOPS, and a hash of the output's bits. Usage: hip_prefill_fused_bench [tokens] [reps] [gu_type] [down_type].

Measured. Radeon 8060S (Ryzen AI MAX+ 395, ROCm 7.15, hipBLASLt 1.4.1).

hip_prefill_fused_bench, IQ2_XXS / IQ3_XXS:

tokens 4 blocks/MP (before) 3 blocks/MP output hash
2K 45.6 ms 39.5 ms (−13%) unchanged
9K 184.3 ms 156.3 ms (−15%) unchanged
16K 336.1 ms 283.3 ms (−16%) unchanged

Other pairs at 9K tokens:

  • IQ2_XXS / IQ4_NL: −14%
  • IQ3_XXS / IQ3_XXS: −15%
  • IQ3_S / IQ4_NL: −14%
  • IQ4_XS / IQ2_S: −14%
  • IQ2_XS and IQ2_S gate/up, which were already at 3: unchanged

The sweep of 3 / 4 / 5 / 6 blocks was repeated at 2K, 9K and 16K tokens. 3 won at every size.

./maya.sh --bench used unsloth's GLM-5.3-Flash UD-IQ2_XXS at 512K context, with a hipBLASLt table retuned for this hipBLASLt (#631). Two runs each, alternating, with only the engine binary differing:

before this PR
prefill, 2K tokens 314 / 316 tok/s 326 / 325 (+3.4%)
prefill, 8K tokens 321 / 318 tok/s 330 / 332 (+3.6%)
decode 30.0 tok/s 30.0 tok/s
  • Engine profile (STRATA_GLM_PREFILL_PROF=1, ~9K-token prompts): moe_fused 0.815 → 0.717 ms/token.
  • Checks: hip_prefill_fused_parity and tools/check_hip_compat.py pass.
  • Not measured: gfx1100, RDNA4, Windows, gfx1151 machines other than the 8060S. Their factors are unchanged.

🔄 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/634 **Author:** [@mrsirg97-rgb](https://github.com/mrsirg97-rgb) **Created:** 10/28/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fused-moe-speed` --- ### 📝 Commits (1) - [`b894045`](https://github.com/mw00/project-maya/commit/b894045e8f565282b64832419097bf18632d3d18) gfx1151: the fused prompt experts at 3 blocks a multiprocessor for every type pair ### 📊 Changes **3 files changed** (+138 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+4 -0) 📝 `src/prefill/moe_fused_rdna4.cu` (+7 -3) ➕ `tests/hip/prefill_fused_bench.cpp` (+127 -0) </details> ### 📄 Description On gfx1151 (Strix / Gorgon Halo), the fused GLM prompt experts now size their persistent grid at 3 blocks per multiprocessor for every type pair. It's a one-line change in `moe_fused_rdna4.cu`'s `experts()`. gfx1100 and RDNA4 keep their current factors, since I can't measure them. **Why.** The grid was 4 blocks per multiprocessor, except 3 for IQ2_S / IQ2_XS. On a Radeon 8060S, 3 is faster or equal for every supported pair; 4 and 5 are the slowest, and 6 falls in between. HIP's occupancy query reports 2 resident blocks per multiprocessor for these kernels (LDS-bound), and that doesn't explain the curve: 2 blocks measures about as slow as 4. So this is a measured constant, the same way the existing 3 and 4 were chosen. Each output is still computed by one block in the same order, so the results are bit-for-bit identical. **New microbenchmark.** `tests/hip/prefill_fused_bench.cpp` (`hip_prefill_fused_bench`, `EXCLUDE_FROM_ALL`) runs one GLM layer's fused experts at a real shape: 288 experts, 8 routed per token, IQ2_XXS gate/up and IQ3_XXS down by default, random valid blocks. It prints the median time, int8 TOPS, and a hash of the output's bits. Usage: `hip_prefill_fused_bench [tokens] [reps] [gu_type] [down_type]`. **Measured.** Radeon 8060S (Ryzen AI MAX+ 395, ROCm 7.15, hipBLASLt 1.4.1). `hip_prefill_fused_bench`, IQ2_XXS / IQ3_XXS: | tokens | 4 blocks/MP (before) | 3 blocks/MP | output hash | | --- | --- | --- | --- | | 2K | 45.6 ms | **39.5 ms** (−13%) | unchanged | | 9K | 184.3 ms | **156.3 ms** (−15%) | unchanged | | 16K | 336.1 ms | **283.3 ms** (−16%) | unchanged | Other pairs at 9K tokens: - IQ2_XXS / IQ4_NL: −14% - IQ3_XXS / IQ3_XXS: −15% - IQ3_S / IQ4_NL: −14% - IQ4_XS / IQ2_S: −14% - IQ2_XS and IQ2_S gate/up, which were already at 3: unchanged The sweep of 3 / 4 / 5 / 6 blocks was repeated at 2K, 9K and 16K tokens. 3 won at every size. `./maya.sh --bench` used unsloth's GLM-5.3-Flash UD-IQ2_XXS at 512K context, with a hipBLASLt table retuned for this hipBLASLt (#631). Two runs each, alternating, with only the engine binary differing: | | before | this PR | | --- | --- | --- | | prefill, 2K tokens | 314 / 316 tok/s | **326 / 325** (+3.4%) | | prefill, 8K tokens | 321 / 318 tok/s | **330 / 332** (+3.6%) | | decode | 30.0 tok/s | 30.0 tok/s | - **Engine profile** (`STRATA_GLM_PREFILL_PROF=1`, ~9K-token prompts): `moe_fused` 0.815 → 0.717 ms/token. - **Checks:** `hip_prefill_fused_parity` and `tools/check_hip_compat.py` pass. - **Not measured:** gfx1100, RDNA4, Windows, gfx1151 machines other than the 8060S. Their factors are unchanged. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#638
No description provided.