Shaders: isolate cross-half LDS storage at each Wave32 exchange site #246

Open
github-bot wants to merge 1 commit from github-bot/gh-246 into main AGit
Owner

@⁠Barbital11111 on GitHub · 2026-11-27 20:05 UTC · original
Barbital11111:fix/wave32-half-exchange-slots → main · +112 −13 · 4 files · 1 commits · open

What

On an RTX 5090 D v2, an earlier build based on d12eb1b2 showed hard-edged 16×16 black tiles on outdoor surfaces. CS_DepthProcessingHBO (2f03a2df10503cef) wrote an invalid 0xff classification byte. The downstream CS_ShadowTileClassify (9991e29feaa26e3e) tests bit 1 and can skip the tile when its exception condition is inactive, leaving the cleared shadow mask at zero. The full indirect dispatch path was not traced for every visible block.

When a logical wave64 runs as two host wave32s, the group-barrier path gives successive exchanges the same LDS words. In the isolated HBO dispatch, the OR reduction read the wrong upper-half value. Changing the final image store from float to integer left all 14,400 classifications unchanged, including the 32 bad tiles.

Change

Allocate group-shared storage per static exchange site and per logical wave: one dword for a lane broadcast, two for a pair of partial results. This covers ballots, reductions and prefix sums through the common exchange path. Loop iterations still reuse their own site. Sites that would exceed the 32 KiB group budget use the existing scratch pair. The separate counter-based, double-buffered pair-meeting path keeps its existing ordering. After dead-code elimination, remove unreferenced group-shared globals and remap the surviving references, as the optimizer already does for constant tables.

Evidence on the earlier builds

  • Isolating the bitwise reductions corrected all 32 bad tiles in an isolated GPU dispatch. The full 14,400-byte classification image matched the reference byte for byte. In live play with that first-stage fix on the d12eb1b2-based build, the outdoor blocks were substantially reduced. A few remained.
  • With only the bitwise sites isolated, a CPU test that deliberately delayed a read until after the next site's write found 72,000 mismatches in 115,200 checks. With all static sites isolated it found zero. Both versions passed the ordered schedule. The delayed schedule is fault injection across a barrier; it does not identify which GPU instruction supplied the wrong value in the original dispatch.

Verification on 0cef07e9

  • This port was built on Windows x64 against upstream commit 0cef07e9d7.
  • Both synthetic regression tests failed with the expected assertions on the original implementation and passed with this patch.
  • Shader library test summary: test result: ok. 290 passed; 0 failed; 4 ignored; 0 measured; 0 filtered out; finished in 297.01s
  • shader-tests PASS
  • shader-clippy PASS
  • ci-clippy reported the same failing tests or lint diagnostics on clean main
  • ci-clippy-features reported the same failing tests or lint diagnostics on clean main
  • other-libraries reported the same failing tests or lint diagnostics on clean main
  • The pinned upstream library translated all 160 local inputs. All 160 passed SDK DXIL validation. The HBO output had eight distinct exchange arrays, with 0/115,200 delayed-read mismatches in the CPU address check.
  • The CLI package and replay tests were excluded locally. The game was not run on this upstream port.

#43 analyzes aliasing between the guest's LDS accesses. #104 and #118 constrain out-of-bounds guest LDS accesses. This change isolates the translator's own scratch for valid exchanges. #42 changes shared-memory optimization and barrier deduplication; the emitted-address regression is worth rerunning if both changes land. #108 fixes the choice of mask dword for upper-half lanes, a separate source of incorrect values.

Prepared with Claude Code (coordination) and OpenAI Codex (implementation).
🤖 Generated with Claude Code

**@⁠Barbital11111** on GitHub · 2026-11-27 20:05 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/246) `Barbital11111:fix/wave32-half-exchange-slots` → `main` · +112 −13 · 4 files · 1 commits · open <!-- PR title: Shaders: isolate cross-half LDS storage at each Wave32 exchange site --> ## What On an RTX 5090 D v2, an earlier build based on `d12eb1b2` showed hard-edged 16×16 black tiles on outdoor surfaces. `CS_DepthProcessingHBO` (`2f03a2df10503cef`) wrote an invalid `0xff` classification byte. The downstream `CS_ShadowTileClassify` (`9991e29feaa26e3e`) tests bit 1 and can skip the tile when its exception condition is inactive, leaving the cleared shadow mask at zero. The full indirect dispatch path was not traced for every visible block. When a logical wave64 runs as two host wave32s, the group-barrier path gives successive exchanges the same LDS words. In the isolated HBO dispatch, the OR reduction read the wrong upper-half value. Changing the final image store from float to integer left all 14,400 classifications unchanged, including the 32 bad tiles. ## Change Allocate group-shared storage per static exchange site and per logical wave: one dword for a lane broadcast, two for a pair of partial results. This covers ballots, reductions and prefix sums through the common exchange path. Loop iterations still reuse their own site. Sites that would exceed the 32 KiB group budget use the existing scratch pair. The separate counter-based, double-buffered pair-meeting path keeps its existing ordering. After dead-code elimination, remove unreferenced group-shared globals and remap the surviving references, as the optimizer already does for constant tables. ## Evidence on the earlier builds - Isolating the bitwise reductions corrected all 32 bad tiles in an isolated GPU dispatch. The full 14,400-byte classification image matched the reference byte for byte. In live play with that first-stage fix on the `d12eb1b2`-based build, the outdoor blocks were substantially reduced. A few remained. - With only the bitwise sites isolated, a CPU test that deliberately delayed a read until after the next site's write found 72,000 mismatches in 115,200 checks. With all static sites isolated it found zero. Both versions passed the ordered schedule. The delayed schedule is fault injection across a barrier; it does not identify which GPU instruction supplied the wrong value in the original dispatch. ## Verification on `0cef07e9` <!-- upstream-verification --> - This port was built on Windows x64 against upstream commit 0cef07e9d766df48f0e95f13ce3bbbe2290fe9d3. - Both synthetic regression tests failed with the expected assertions on the original implementation and passed with this patch. - Shader library test summary: test result: ok. 290 passed; 0 failed; 4 ignored; 0 measured; 0 filtered out; finished in 297.01s - shader-tests PASS - shader-clippy PASS - ci-clippy reported the same failing tests or lint diagnostics on clean main - ci-clippy-features reported the same failing tests or lint diagnostics on clean main - other-libraries reported the same failing tests or lint diagnostics on clean main - The pinned upstream library translated all 160 local inputs. All 160 passed SDK DXIL validation. The HBO output had eight distinct exchange arrays, with 0/115,200 delayed-read mismatches in the CPU address check. - The CLI package and replay tests were excluded locally. The game was not run on this upstream port. <!-- /upstream-verification --> ## Related work #43 analyzes aliasing between the guest's LDS accesses. #104 and #118 constrain out-of-bounds guest LDS accesses. This change isolates the translator's own scratch for valid exchanges. #42 changes shared-memory optimization and barrier deduplication; the emitted-address regression is worth rerunning if both changes land. #108 fixes the choice of mask dword for upper-half lanes, a separate source of incorrect values. Prepared with Claude Code (coordination) and OpenAI Codex (implementation). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Keep separate broadcast words and partial-result pairs per logical wave, within the group shared-memory budget. Drop unreferenced shared globals after dead-code elimination and test delayed reads against emitted DXIL.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 20:10:01 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/246/head:github-bot/gh-246'
git switch 'github-bot/gh-246'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-246'
git switch 'github-bot/gh-246'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-246'
git switch 'github-bot/gh-246'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-246'
git switch 'main'
git merge --squash 'github-bot/gh-246'
git switch 'main'
git merge --ff-only 'github-bot/gh-246'
git switch 'main'
git merge 'github-bot/gh-246'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.