Shaders: readfirstlane on a wider hardware wave takes the max per program wave #27

Manually merged
github merged 1 commit from gh-pr/27/head into gh-pr/27/base 2026-11-27 03:14:23 +00:00
Owner

@⁠Sr-0w on GitHub · 2026-11-25 11:32 UTC · original
Sr-0w:shaders/readfirstlane-wider → main · +13 −1 · 2 files · 1 commits · merged 2026-11-25 11:38 UTC

What

On a hardware wave wider than the program wave (a 32-lane program in an AMD pixel wave of 64), readfirstlane still read the first active lane with WaveReadLaneAt at the ballot's lowest bit. #21 removed that read from the narrower path because AMD's compiler crashes on it. The same compiler (RX 7800 XT) also access-violates on it in CreatePipelineState on this path, here on a tiled lighting pixel program. It ended every boot of a retail game after about two minutes.

How the culprit was found:

  • With one driver compile at a time, a compile trace names the pipeline.
  • The pipeline crashes on its own in fivestar shader pso.
  • Neutralizing WaveReadLaneAt calls one at a time leaves a single read (the fourth of each readfirstlane) that crashes the compiler by itself.

The lane at the ballot's lowest bit now gives its value to a WaveActiveMax of a uint4, with one component per program wave. A hardware wave holds at most four program waves: 128 lanes for a 32-lane program, or WARP's 4 lanes for the test waves. The pipeline then builds in 6.5 s. Only the group forms still use vw_read.

Tests

  • The 2-lane case of Wave_operations_see_the_console_wave runs this path on WARP. Returning the first component for every program wave fails it.
  • Shaders tests: 364 passed.
  • Loader: the 4 CompileBudgetTests that also fail on main on this machine fail here too.

Docs: the readfirstlane paragraph of shader-translation.md.

🤖 Generated with Claude Code

**@⁠Sr-0w** on GitHub · 2026-11-25 11:32 UTC · [original](https://github.com/ThatRecompDev/five-star-recomp/pull/27) `Sr-0w:shaders/readfirstlane-wider` → `main` · +13 −1 · 2 files · 1 commits · merged 2026-11-25 11:38 UTC ## What On a hardware wave wider than the program wave (a 32-lane program in an AMD pixel wave of 64), `readfirstlane` still read the first active lane with `WaveReadLaneAt` at the ballot's lowest bit. #21 removed that read from the narrower path because AMD's compiler crashes on it. The same compiler (RX 7800 XT) also access-violates on it in `CreatePipelineState` on this path, here on a tiled lighting pixel program. It ended every boot of a retail game after about two minutes. How the culprit was found: - With one driver compile at a time, a compile trace names the pipeline. - The pipeline crashes on its own in `fivestar shader pso`. - Neutralizing `WaveReadLaneAt` calls one at a time leaves a single read (the fourth of each `readfirstlane`) that crashes the compiler by itself. The lane at the ballot's lowest bit now gives its value to a `WaveActiveMax` of a `uint4`, with one component per program wave. A hardware wave holds at most four program waves: 128 lanes for a 32-lane program, or WARP's 4 lanes for the test waves. The pipeline then builds in 6.5 s. Only the group forms still use `vw_read`. ## Tests - The 2-lane case of `Wave_operations_see_the_console_wave` runs this path on WARP. Returning the first component for every program wave fails it. - Shaders tests: 364 passed. - Loader: the 4 `CompileBudgetTests` that also fail on main on this machine fail here too. Docs: the `readfirstlane` paragraph of `shader-translation.md`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
On a hardware wave wider than the program wave (a 32-lane program in an
AMD pixel wave of 64), readfirstlane read the first active lane with
WaveReadLaneAt at the ballot's lowest bit. That is the read #21 removed
from the narrower path: the same AMD compiler (RX 7800 XT) access-violates
on it in CreatePipelineState, here on a tiled lighting pixel program, and
it ended every boot of a retail game after about two minutes. The
pipeline alone reproduces it; keeping only that one read of the program
is enough.

The lane at the ballot's lowest bit now gives its value to a WaveActiveMax
of a uint4, one component per program wave (a hardware wave holds at most
four: 128 lanes for a 32-lane program, WARP's 4 for the test waves). The
pipeline then builds in 6.5 s. Only the group forms still use vw_read.

The 2-lane case of Wave_operations_see_the_console_wave runs this path on
WARP; returning the first component for every program wave fails it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XTYmP8DzdtgeCMD6HPuCyc
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 03:14:23 +00:00
github manually merged commit 6720057ed3 into gh-pr/27/base 2026-11-27 03:14:23 +00:00
Author
Owner

@⁠ThatRecompDev on GitHub · 2026-11-25 11:38 UTC · original

really nice detective work narrowing it down to the fourth WaveReadLaneAt, and the per-program-wave max is a clean way around it. merging.

those CompileBudgetTests failing on your machine are on us: they read the real machine's memory and GPU vendor, so they depend on the host. we're making them independent of the machine now, so they should stop bugging you.

**@⁠ThatRecompDev** on GitHub · 2026-11-25 11:38 UTC · [original](https://github.com/ThatRecompDev/five-star-recomp/pull/27#issuecomment-7161318961) really nice detective work narrowing it down to the fourth WaveReadLaneAt, and the per-program-wave max is a clean way around it. merging. those CompileBudgetTests failing on your machine are on us: they read the real machine's memory and GPU vendor, so they depend on the host. we're making them independent of the machine now, so they should stop bugging you.
This discussion has been locked. Commenting is limited to contributors.
No description provided.