Shaders: readfirstlane reads the first active lane with WaveReadLaneFirst #21
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ThatRecompDev--five-star-recomp!21
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/21/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Sr-0w on GitHub · 2026-11-25 05:36 UTC · original
Sr-0w:shaders/readfirstlane-amd→main· +17 −1 · 2 files · 1 commits · merged 2026-11-25 08:06 UTCWhat changed
The prelude's
readfirstlane(no wave emulation, no group wave) reads the first active lane withWaveReadLaneFirstinstead ofvw_read(x, firstbitlow(ballot)), i.e.WaveReadLaneAtwith a lane computed from a ballot. With EXEC empty it still reads lane 0, as before. Emulated and group-wave programs keep the old path.Why
On an RX 7800 XT (Adrenalin 32.0.32029.2010), the old pattern made the driver's shader compiler (amdxc64) crash in a story-load pixel program. I bisected the translated HLSL down to that one pattern:
readfirstlanethe program compiles and runs;vw_anyremoved it still crashes;WaveReadLaneFirstform runs.The result is the same: the first lane whose EXEC bit is set.
How I checked
dotnet test tests/FiveStar.Shaders.Tests: 320 passed, 12 skipped (the GPU cases coverv_readfirstlane_b32with partial EXEC).docs/shader-translation.mdnotes the AMD form next toreadfirstlane.🤖 Generated with Claude Code
@ThatRecompDev on GitHub · 2026-11-25 08:08 UTC · original
merged, thanks! checked it against the old ballot path and it picks the same lane in every case since both only see active lanes