Shaders: readfirstlane takes each program wave's lane on hardware waves holding more than four #61
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!61
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-61"
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?
@guialmm on GitHub · 2026-11-26 17:06 UTC · original
guialmm:fix/readfirstlane-wide-hardware-wave→main· +12 −5 · 1 files · 1 commits · closed without mergingOn a real GPU,
WaveEmulationTests.Wave_operations_see_the_console_wavefails forwave: 2andwave: 4withgroupLanes: False: only the last column (readfirstlane(x, c)) is wrong, and every thread from the fourth program wave on reads the same value. This is the "WaveEmulation wave 2 and 4 with groupLanes False, last column wrong" item from the RTX 3070 run in #9.Why. On a hardware wave wider than the program wave,
readfirstlaneinrdna_prelude.hlslitakes oneWaveActiveMaxover auint4, one component per program wave, and the comment there assumes at most four program waves (128 lanes, or WARP's 4 lanes for test waves). A 32-lane NVIDIA wave holds 16 two-lane or 8 four-lane test waves, so waves 3 and up all land in.wand read the max over all of them. With two-lane waves that is thread 6's value (6·7+3 = 45), with four-lane waves thread 12's (87), which is what the test prints.Change. The same max, four program waves per
WaveActiveMax, repeated until it coversWaveGetLaneCount() / VW_WAVEwaves. The loop is unrolled with a constant bound (128 / VW_WAVE) and each step is behind a wave-uniform test, so for console waves (32 or 64 lanes) only the first step runs, as one max like before. Only this function changes.Checked on an RTX 3060 (12 GB, driver 32.0.16.1714), Windows 11:
dotnet build FiveStar.slnx: no warnings.FIVESTAR_TEST_ADAPTER=hardware,WaveEmulationTests, same build with and without the change: 2 failed, 14 passed before; 16 passed after.FIVESTAR_TEST_ADAPTER=hardware, whole shader project (without the three cases that hang NVIDIA in #9): 30 failures before, 28 after. The 28 left are the other open items from #9 (buffer-bounds E_OUTOFMEMORY, root-descriptor fallback, integer gathers, StageProbe); none is new.dotnet test FiveStar.slnx, 0 failed (shaders: 550 passed, 14 skipped, as on main).AI-assisted (Claude Code, Claude Opus 5.5): found the cause, wrote the change and ran the tests above on my machine.
🤖 Generated with Claude Code
@ThatRecompDev on GitHub · 2026-11-26 21:32 UTC · original
nice catch on the uint4 only covering four program waves, the fix reads clean. ran it here on WARP together with our next translator changes and the whole shader suite passes (583, 0 failed). since it changes translation output we'll land it together with that batch so testers only re-translate once, should be soon
@ThatRecompDev on GitHub · 2026-11-27 08:01 UTC · original
this one is in main too, as
496df042with you as author (the batch was built on your commit before you rebased, so github doesn't see the PR as merged, closing it by hand). it went in with976cc3e3together with #62, #66 and #67. heads-up for everyone: translation output changed with this batch, so the next run translates and compiles the shaders again. thanks for the fix!Pull request closed