Shaders: guard divergent single-console-wave barriers on narrow-wave (NVIDIA) GPUs #109

Open
github-bot wants to merge 2 commits from github-bot/gh-109 into main AGit
Owner

@⁠rivaldodev on GitHub · 2026-11-26 03:42 UTC · original
rivaldodev:fix/nvidia-auto-barrier-guards → main · +245 −15 · 5 files · 2 commits · open

Summary

Two focused improvements for narrow-wave (wave32) / capped-heap GPUs such as NVIDIA, tested live on hardware:

  1. Shaders: automatically guard divergent single-console-wave barriers on narrow-wave GPUs

    • Restricts automatic divergent barrier sync omission to single-console-wave groups (group_threads <= console_wave), preventing deadlocks on wave32 GPUs when only part of a console wave enters s_barrier.
    • Preserves memory fences (TGSM_FENCE / UAV_FENCE) and explicit VICTORY_GROUP_SYNC overrides.
    • Adds unit tests and a live narrow-wave hardware test (an_automatic_barrier_inside_a_lane_branch_runs_on_narrow_hardware).
  2. Tests: verify null heap clamp slot with small and exact-fit allocations

    • Extends view_heaps_keep_the_clamp_slot_null to verify small, exact-fit, and overflowing title heaps all keep the final clamp slot null on capped-heap GPUs (e.g., 1,000,000 views on NVIDIA).

Verification

  • cargo test --locked -p victory-shader an_automatic_barrier_inside_a_lane_branch_runs_on_narrow_hardware -- --nocapture — passed on live wave32 hardware (max wave 32: 1, 10, 32, 33 and 64 active lanes)
  • cargo test --locked -p victory-gpu clamp -- --nocapture — passed on live hardware (1000000 slots, 262144 dynamic slots; small, exact-fit and overflowing title heaps leave slot 999999 null)
  • cargo build --locked --profile diag -p victory --features diagnostics — passed
**@⁠rivaldodev** on GitHub · 2026-11-26 03:42 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/109) `rivaldodev:fix/nvidia-auto-barrier-guards` → `main` · +245 −15 · 5 files · 2 commits · open ## Summary Two focused improvements for narrow-wave (wave32) / capped-heap GPUs such as NVIDIA, tested live on hardware: 1. **Shaders: automatically guard divergent single-console-wave barriers on narrow-wave GPUs** - Restricts automatic divergent barrier sync omission to single-console-wave groups (`group_threads <= console_wave`), preventing deadlocks on wave32 GPUs when only part of a console wave enters `s_barrier`. - Preserves memory fences (`TGSM_FENCE` / `UAV_FENCE`) and explicit `VICTORY_GROUP_SYNC` overrides. - Adds unit tests and a live narrow-wave hardware test (`an_automatic_barrier_inside_a_lane_branch_runs_on_narrow_hardware`). 2. **Tests: verify null heap clamp slot with small and exact-fit allocations** - Extends `view_heaps_keep_the_clamp_slot_null` to verify small, exact-fit, and overflowing title heaps all keep the final clamp slot null on capped-heap GPUs (e.g., 1,000,000 views on NVIDIA). ## Verification - `cargo test --locked -p victory-shader an_automatic_barrier_inside_a_lane_branch_runs_on_narrow_hardware -- --nocapture` — passed on live wave32 hardware (`max wave 32: 1, 10, 32, 33 and 64 active lanes`) - `cargo test --locked -p victory-gpu clamp -- --nocapture` — passed on live hardware (`1000000 slots, 262144 dynamic slots; small, exact-fit and overflowing title heaps leave slot 999999 null`) - `cargo build --locked --profile diag -p victory --features diagnostics` — passed
Restricts automatic divergent barrier sync omission to single-console-wave groups (group_threads <= console_wave), preserves memory fences and explicit VICTORY_GROUP_SYNC overrides, and adds unit and live narrow-wave GPU tests.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:24:46 +00:00
Author
Owner

@⁠copilot-pull-request-reviewer[bot] on GitHub · 2026-11-26 03:42 UTC · original · reviewed

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

**@⁠copilot-pull-request-reviewer[bot]** on GitHub · 2026-11-26 03:42 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/109#pullrequestreview-6068249742) · **reviewed** Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Author
Owner

@⁠avatarmanz on GitHub · 2026-11-26 07:36 UTC · original

Left open: same barriers on 64-lane AMD hosts, but the new default (auto) changes the shader cache key, so every AMD cache would be translated again once; maintainer's call.

**@⁠avatarmanz** on GitHub · 2026-11-26 07:36 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/109#issuecomment-7185640718) Left open: same barriers on 64-lane AMD hosts, but the new default (auto) changes the shader cache key, so every AMD cache would be translated again once; maintainer's call.
Author
Owner

@⁠juliptree on GitHub · 2026-11-26 07:50 UTC · original

Independently validated head 23921a7 on Windows with an RTX 5060 Ti 16 GB, driver 616.92. The shader test dispatched on the physical GPU with min/max wave width 32. All five cases (1, 10, 32, 33, and 64 active lanes) completed and returned the expected UAV value of 19.

The victory-gpu clamp filter passed all six matched tests. On the 5060 Ti, small, exact-fit, and overflowing title allocations all left slot 999999 reserved and initialized to null. A shader read from that slot was outside the scope of the test. I used temporary logging in a separate worktree to confirm the adapter and readbacks. No game files were used.

**@⁠juliptree** on GitHub · 2026-11-26 07:50 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/109#issuecomment-7185887552) Independently validated head 23921a7 on Windows with an RTX 5060 Ti 16 GB, driver 616.92. The shader test dispatched on the physical GPU with min/max wave width 32. All five cases (1, 10, 32, 33, and 64 active lanes) completed and returned the expected UAV value of 19. The victory-gpu clamp filter passed all six matched tests. On the 5060 Ti, small, exact-fit, and overflowing title allocations all left slot 999999 reserved and initialized to null. A shader read from that slot was outside the scope of the test. I used temporary logging in a separate worktree to confirm the adapter and readbacks. No game files were used.
This pull request has changes conflicting with the target branch.
  • crates/victory-shader/src/emit/lower.rs
  • crates/victory-shader/src/emit/wave64_tests.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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