[PR #2018] [CLOSED] prefill: VGPR-capped gfx11 fused expert kernels back on for gfx1151 on clang 23 (same bits, 10-15% less time per layer for most IQ formats) #3810

Closed
opened 2026-11-07 15:30:55 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2018
Author: @libratechw
Created: 10/12/2026
Status: ❌ Closed

Base: main ← Head: pr/gfx1151-vgpr-cap


📝 Commits (1)

  • c2b1fc5 prefill: the VGPR-capped gfx11 fused expert kernels are on again for gfx1151 on clang 23, except IQ2_XS gate/up and Q8_0 down (#1180)

📊 Changes

1 file changed (+27 additions, -6 deletions)

View changed files

📝 src/prefill/moe_fused_iq.cu (+27 -6)

📄 Description

Title

Issue: Refs #1180

Summary

Since 0.1.40.2 the waves_per_eu(8) variant of native_w11_kernel is uncapped on clang 22 and newer, because clang 22
computes wrong results with it on gfx1100 (#1180). On gfx1151 with clang 23 (ROCm 7.14.1) the capped kernels give the same
bits and take less time. This applies the cap there again, per format, and leaves every other architecture and compiler as
it is.

What changed

src/prefill/moe_fused_iq.cu only, in its HIP-only part:

  • NW_LB is the variant's template argument again (8, or -DSTRATA_W_LB=N), the same in the host and every device pass.
  • nw_capped(WT) decides in the device pass whether the cap applies: always before clang 22 or with -DSTRATA_W_LB; on
    gfx1151 with clang 23 for every format the occupancy variant launches except IQ2_XS gate/up and Q8_0 down; otherwise not
    (clang 22 and 24+, every other architecture).

Ryzen AI Max+ 395 (gfx1151, ROCm 7.14.1), on 296b59d2, hip_prefill_fused_iq --no-ref --only=<pair> --chunks=2048,3584,8192,
one layer, top 10 over 512 experts, fused ms, median of 3 (range); the output bits hash is the same as 296b59d2's in every
case. IQ2_XS gate/up stays uncapped, so its pair gains from the IQ4_NL down only:

gate/up / down tokens 296b59d2 this branch change
IQ2_XXS / Q2_0 2048 13.73 (13.52-13.84) 12.13 (11.99-12.21) -11.7%
3584 21.25 (20.93-21.31) 18.40 (18.23-18.49) -13.4%
8192 40.65 (40.39-40.80) 34.96 (34.73-35.01) -14.0%
IQ3_XXS / IQ4_NL 2048 14.44 (14.34-14.47) 12.94 (12.86-12.99) -10.4%
3584 22.62 (22.41-22.67) 19.57 (19.50-19.61) -13.5%
8192 42.42 (42.07-42.50) 36.27 (36.12-36.34) -14.5%
IQ3_S / IQ4_NL 2048 14.71 (14.55-14.72) 13.29 (13.28-13.40) -9.7%
3584 23.00 (22.89-23.14) 20.03 (20.03-20.16) -12.9%
8192 42.88 (42.84-42.99) 37.22 (37.07-37.53) -13.2%
IQ4_XS / Q2_0 2048 14.82 (14.60-14.83) 12.86 (12.85-12.93) -13.3%
3584 21.89 (21.89-21.99) 19.54 (19.43-19.64) -10.7%
8192 41.52 (41.47-41.70) 36.57 (36.49-36.75) -11.9%
IQ2_S / Q2_0 2048 15.13 (15.11-15.18) 14.75 (14.71-14.80) -2.5%
3584 23.89 (23.71-24.11) 23.15 (22.98-23.29) -3.1%
8192 44.59 (44.23-44.76) 42.94 (42.52-43.16) -3.7%
IQ2_XS / IQ4_NL 2048 15.14 (15.12-15.26) 14.93 (14.84-15.12) -1.4%
3584 24.06 (23.90-25.09) 23.11 (23.01-23.17) -4.0%
8192 44.79 (44.45-45.14) 43.05 (42.81-43.05) -3.9%

The two uncapped formats, with the cap forced on (-DSTRATA_W_LB=8; spills from -Rpass-analysis=kernel-resource-usage):
IQ2_XS gate/up spills 104 VGPRs and the IQ2_XS / IQ4_NL layer takes 74-78% more time; Q8_0 down spills 18 and Q4_K / Q8_0
moves -1.9% to +1.3%. The output hash is the same as uncapped.

Builds and tests on this branch:

  • HIP gfx1151: ctest, 112 tests: 104 pass, 5 skip, and the same three fail as on 296b59d2 (ple_parity, expert_parity,
    pool_test).
  • HIP: strata_kernels, strata_prefill and strata_mmq compile for gfx1012, gfx1030, gfx1100, gfx1103, gfx1150, gfx1151, gfx1200 and gfx1201.
  • CUDA 13.0, RTX 3060 (Windows): builds; ctest, 117 tests: 114 pass, 2 skip, and ple_parity fails as on 296b59d2.
  • SYCL (oneAPI 2026.1 icpx): builds (the SYCL port has its own copy of this file).

Not run: gfx1100-1103 / gfx1150 cards, other clang 23 builds, and end to end. The fused experts are opt-in on gfx11
(STRATA_PF_FUSED=1).

🤖 Generated with Claude Code


🔄 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/2018 **Author:** [@libratechw](https://github.com/libratechw) **Created:** 10/12/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/gfx1151-vgpr-cap` --- ### 📝 Commits (1) - [`c2b1fc5`](https://github.com/Niko1221/Strata/commit/c2b1fc5787d20c1771b03e37cbda621962d657f1) prefill: the VGPR-capped gfx11 fused expert kernels are on again for gfx1151 on clang 23, except IQ2_XS gate/up and Q8_0 down (#1180) ### 📊 Changes **1 file changed** (+27 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `src/prefill/moe_fused_iq.cu` (+27 -6) </details> ### 📄 Description ## Title Issue: Refs #1180 ## Summary Since 0.1.40.2 the `waves_per_eu(8)` variant of `native_w11_kernel` is uncapped on clang 22 and newer, because clang 22 computes wrong results with it on gfx1100 (#1180). On gfx1151 with clang 23 (ROCm 7.14.1) the capped kernels give the same bits and take less time. This applies the cap there again, per format, and leaves every other architecture and compiler as it is. ## What changed `src/prefill/moe_fused_iq.cu` only, in its HIP-only part: - `NW_LB` is the variant's template argument again (8, or `-DSTRATA_W_LB=N`), the same in the host and every device pass. - `nw_capped(WT)` decides in the device pass whether the cap applies: always before clang 22 or with `-DSTRATA_W_LB`; on gfx1151 with clang 23 for every format the occupancy variant launches except IQ2_XS gate/up and Q8_0 down; otherwise not (clang 22 and 24+, every other architecture). Ryzen AI Max+ 395 (gfx1151, ROCm 7.14.1), on 296b59d2, `hip_prefill_fused_iq --no-ref --only=<pair> --chunks=2048,3584,8192`, one layer, top 10 over 512 experts, `fused` ms, median of 3 (range); the output bits hash is the same as 296b59d2's in every case. IQ2_XS gate/up stays uncapped, so its pair gains from the IQ4_NL down only: | gate/up / down | tokens | 296b59d2 | this branch | change | |---|---:|---:|---:|---:| | IQ2_XXS / Q2_0 | 2048 | 13.73 (13.52-13.84) | 12.13 (11.99-12.21) | -11.7% | | | 3584 | 21.25 (20.93-21.31) | 18.40 (18.23-18.49) | -13.4% | | | 8192 | 40.65 (40.39-40.80) | 34.96 (34.73-35.01) | -14.0% | | IQ3_XXS / IQ4_NL | 2048 | 14.44 (14.34-14.47) | 12.94 (12.86-12.99) | -10.4% | | | 3584 | 22.62 (22.41-22.67) | 19.57 (19.50-19.61) | -13.5% | | | 8192 | 42.42 (42.07-42.50) | 36.27 (36.12-36.34) | -14.5% | | IQ3_S / IQ4_NL | 2048 | 14.71 (14.55-14.72) | 13.29 (13.28-13.40) | -9.7% | | | 3584 | 23.00 (22.89-23.14) | 20.03 (20.03-20.16) | -12.9% | | | 8192 | 42.88 (42.84-42.99) | 37.22 (37.07-37.53) | -13.2% | | IQ4_XS / Q2_0 | 2048 | 14.82 (14.60-14.83) | 12.86 (12.85-12.93) | -13.3% | | | 3584 | 21.89 (21.89-21.99) | 19.54 (19.43-19.64) | -10.7% | | | 8192 | 41.52 (41.47-41.70) | 36.57 (36.49-36.75) | -11.9% | | IQ2_S / Q2_0 | 2048 | 15.13 (15.11-15.18) | 14.75 (14.71-14.80) | -2.5% | | | 3584 | 23.89 (23.71-24.11) | 23.15 (22.98-23.29) | -3.1% | | | 8192 | 44.59 (44.23-44.76) | 42.94 (42.52-43.16) | -3.7% | | IQ2_XS / IQ4_NL | 2048 | 15.14 (15.12-15.26) | 14.93 (14.84-15.12) | -1.4% | | | 3584 | 24.06 (23.90-25.09) | 23.11 (23.01-23.17) | -4.0% | | | 8192 | 44.79 (44.45-45.14) | 43.05 (42.81-43.05) | -3.9% | The two uncapped formats, with the cap forced on (`-DSTRATA_W_LB=8`; spills from `-Rpass-analysis=kernel-resource-usage`): IQ2_XS gate/up spills 104 VGPRs and the IQ2_XS / IQ4_NL layer takes 74-78% more time; Q8_0 down spills 18 and Q4_K / Q8_0 moves -1.9% to +1.3%. The output hash is the same as uncapped. Builds and tests on this branch: - HIP gfx1151: ctest, 112 tests: 104 pass, 5 skip, and the same three fail as on 296b59d2 (`ple_parity`, `expert_parity`, `pool_test`). - HIP: `strata_kernels`, `strata_prefill` and `strata_mmq` compile for gfx1012, gfx1030, gfx1100, gfx1103, gfx1150, gfx1151, gfx1200 and gfx1201. - CUDA 13.0, RTX 3060 (Windows): builds; ctest, 117 tests: 114 pass, 2 skip, and `ple_parity` fails as on 296b59d2. - SYCL (oneAPI 2026.1 icpx): builds (the SYCL port has its own copy of this file). Not run: gfx1100-1103 / gfx1150 cards, other clang 23 builds, and end to end. The fused experts are opt-in on gfx11 (`STRATA_PF_FUSED=1`). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:30:55 +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#3810
No description provided.