[PR #2017] [CLOSED] prompt attention (gfx11 / gfx12 WMMA): issue a chunk's reads before its compute #3808

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

📋 Pull Request Information

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

Base: main ← Head: pr/prompt-attn-reads


📝 Commits (1)

  • 45ce4b5 prompt attention (gfx11 / gfx12 WMMA): issue a chunk's reads before its compute

📊 Changes

1 file changed (+56 additions, -29 deletions)

View changed files

📝 src/kernels/cuda/qsa_prompt_attn.cu (+56 -29)

📄 Description

Title

Issue: none

Summary

prompt_attn_wmma_kernel interleaved a chunk's global reads with its compute: the V slice was staged first, then each 16-cell
tile loaded its K scale and fragments between the q.k WMMAs, so a wave waited on each read in turn. The chunk's reads now go
out together (fetch), then the same compute runs on them (chunk). The values and the order of the arithmetic are unchanged.

What changed

src/kernels/cuda/qsa_prompt_attn.cu only: the HIP WMMA kernel, which runs only with STRATA_HIP_WMMA=1 (not in any default
table), so the default path is untouched.

Ryzen AI Max+ 395 (gfx1151, ROCm 7.14.1), on 296b59d2, hip_prompt_attn_wmma, three interleaved runs against 296b59d2's
kernel, median ms per chunk:

context / queries STRATA_PA_FAST=1 STRATA_PA_FAST=0
32,768 / 2,048 12.54 -> 11.32 (-9.7%) 15.10 -> 14.22 (-5.8%)
1,500 / 1,500 3.36 -> 3.16 4.19 -> 3.98
2,100 / 256 1.30 -> 1.23 1.65 -> 1.58

The output hash (NEWHASH) is the same as 296b59d2's in every run, for both values of STRATA_PA_FAST. (With
STRATA_PA_FAST=1 the tool prints FAIL against its FP64 threshold on 296b59d2 as well, with the same errors.)

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 prompt attention is its own file and is not changed).

Not run: the kernel on other gfx11 / gfx12 cards, and end to end.

🤖 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/2017 **Author:** [@libratechw](https://github.com/libratechw) **Created:** 10/12/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/prompt-attn-reads` --- ### 📝 Commits (1) - [`45ce4b5`](https://github.com/Niko1221/Strata/commit/45ce4b535ab7535ea632ecf1e64ea1411ff91d7f) prompt attention (gfx11 / gfx12 WMMA): issue a chunk's reads before its compute ### 📊 Changes **1 file changed** (+56 additions, -29 deletions) <details> <summary>View changed files</summary> 📝 `src/kernels/cuda/qsa_prompt_attn.cu` (+56 -29) </details> ### 📄 Description ## Title Issue: none ## Summary `prompt_attn_wmma_kernel` interleaved a chunk's global reads with its compute: the V slice was staged first, then each 16-cell tile loaded its K scale and fragments between the q.k WMMAs, so a wave waited on each read in turn. The chunk's reads now go out together (`fetch`), then the same compute runs on them (`chunk`). The values and the order of the arithmetic are unchanged. ## What changed `src/kernels/cuda/qsa_prompt_attn.cu` only: the HIP WMMA kernel, which runs only with `STRATA_HIP_WMMA=1` (not in any default table), so the default path is untouched. Ryzen AI Max+ 395 (gfx1151, ROCm 7.14.1), on 296b59d2, `hip_prompt_attn_wmma`, three interleaved runs against 296b59d2's kernel, median ms per chunk: | context / queries | `STRATA_PA_FAST=1` | `STRATA_PA_FAST=0` | |---|---:|---:| | 32,768 / 2,048 | 12.54 -> 11.32 (-9.7%) | 15.10 -> 14.22 (-5.8%) | | 1,500 / 1,500 | 3.36 -> 3.16 | 4.19 -> 3.98 | | 2,100 / 256 | 1.30 -> 1.23 | 1.65 -> 1.58 | The output hash (`NEWHASH`) is the same as 296b59d2's in every run, for both values of `STRATA_PA_FAST`. (With `STRATA_PA_FAST=1` the tool prints FAIL against its FP64 threshold on 296b59d2 as well, with the same errors.) 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 prompt attention is its own file and is not changed). Not run: the kernel on other gfx11 / gfx12 cards, and end to end. 🤖 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:54 +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#3808
No description provided.