shader(opt): update barrier state on Op::VolatileLoad #3106

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

@⁠RanoGames on GitHub · 2026-11-29 20:02 UTC · original
RanoGames:fix/opt-barriers-volatile-load → main · +47 −0 · 1 files · 1 commits · open

What it changes

Fixes BARRIERS pass handling of Op::VolatileLoad in crates/victory-shader/src/emit/bitcode/opt.rs:

  • Module::merge previously had no match arm for Op::VolatileLoad(ptr), so it fell through to _ => {} instead of updating barriers like Op::Load(ptr).
  • Because barriers.adj was not cleared across Op::VolatileLoad, an intervening volatile load between two barriers (such as barrier(11); VolatileLoad(lds); barrier(9);) falsely triggered adjacent-barrier elimination and deleted the second barrier, while barriers.rar also missed SharedGlobal loads and Unknown resets.
  • Added an Op::VolatileLoad(ptr) arm that traces the pointer and calls barriers.on_load(root) when BARRIERS is enabled (or barriers.reset() otherwise), without participating in LOADS deduplication.
  • Added unit test emit::bitcode::opt::tests::volatile_load_resets_barrier_adjacency_without_deduplicating.

How it was tested

  • GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): N/A (unit-tested bitcode optimizer pass)
  • Before: BARRIERS eliminated barrier(9) after barrier(11); Op::VolatileLoad(lds);.
  • After: Op::VolatileLoad clears barriers.adj and updates barriers.rar without being deduplicated by LOADS.
  • For shader changes, the wave sizes tested (32 and/or 64 lanes): N/A (target-independent DXIL bitcode pass)
  • cargo test passed for the crates it touches: yes (cargo test --locked -p victory-shader --lib barrier tests: 3 passed, 0 failed; cargo xtask policy --staged passed)

Checked for overlap

  • I searched the open and closed pull requests for VolatileLoad (0 PRs).
**@⁠RanoGames** on GitHub · 2026-11-29 20:02 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3106) `RanoGames:fix/opt-barriers-volatile-load` → `main` · +47 −0 · 1 files · 1 commits · open ## What it changes Fixes `BARRIERS` pass handling of `Op::VolatileLoad` in `crates/victory-shader/src/emit/bitcode/opt.rs`: - `Module::merge` previously had no match arm for `Op::VolatileLoad(ptr)`, so it fell through to `_ => {}` instead of updating `barriers` like `Op::Load(ptr)`. - Because `barriers.adj` was not cleared across `Op::VolatileLoad`, an intervening volatile load between two barriers (such as `barrier(11); VolatileLoad(lds); barrier(9);`) falsely triggered adjacent-barrier elimination and deleted the second barrier, while `barriers.rar` also missed `SharedGlobal` loads and `Unknown` resets. - Added an `Op::VolatileLoad(ptr)` arm that traces the pointer and calls `barriers.on_load(root)` when `BARRIERS` is enabled (or `barriers.reset()` otherwise), without participating in `LOADS` deduplication. - Added unit test `emit::bitcode::opt::tests::volatile_load_resets_barrier_adjacency_without_deduplicating`. ## How it was tested - GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): N/A (unit-tested bitcode optimizer pass) - Before: `BARRIERS` eliminated `barrier(9)` after `barrier(11); Op::VolatileLoad(lds);`. - After: `Op::VolatileLoad` clears `barriers.adj` and updates `barriers.rar` without being deduplicated by `LOADS`. - For shader changes, the wave sizes tested (32 and/or 64 lanes): N/A (target-independent DXIL bitcode pass) - `cargo test` passed for the crates it touches: yes (`cargo test --locked -p victory-shader --lib` barrier tests: 3 passed, 0 failed; `cargo xtask policy --staged` passed) ## Checked for overlap - [x] I searched the open and closed pull requests for `VolatileLoad` (0 PRs).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 20:06:51 +00:00
Author
Owner

@⁠dyshay on GitHub · 2026-11-29 20:46 UTC · original

Merged into our fork's integration branch for testing (dyshay/VIctory-NVIDIA, branch janus-prs). I read the full diff first: no network access, process spawning, binaries, build or dependency changes, or game data. It builds with --profile diag --features diagnostics, and the CPU tests of the touched crates pass. A run on an RTX 4090 is queued (Series S with ray tracing, DLSS Quality). Frame times will follow here.

**@⁠dyshay** on GitHub · 2026-11-29 20:46 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3106#issuecomment-7262352321) Merged into our fork's integration branch for testing ([dyshay/VIctory-NVIDIA](https://github.com/dyshay/VIctory-NVIDIA/tree/janus-prs), branch `janus-prs`). I read the full diff first: no network access, process spawning, binaries, build or dependency changes, or game data. It builds with `--profile diag --features diagnostics`, and the CPU tests of the touched crates pass. A run on an RTX 4090 is queued (Series S with ray tracing, DLSS Quality). Frame times will follow here.
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/3106/head:github-bot/gh-3106'
git switch 'github-bot/gh-3106'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3106'
git switch 'github-bot/gh-3106'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3106'
git switch 'github-bot/gh-3106'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3106'
git switch 'main'
git merge --squash 'github-bot/gh-3106'
git switch 'main'
git merge --ff-only 'github-bot/gh-3106'
git switch 'main'
git merge 'github-bot/gh-3106'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!3106
No description provided.