shader: static Wave32 LDS alias and lane-private hazard analysis #43

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

@⁠Vladimir-Human on GitHub · 2026-11-27 13:12 UTC · original
Vladimir-Human:shader/wave32-lds-hazard-analysis → main · +4010 −108 · 5 files · 1 commits · open

Summary

Replaces the coarse read+write check in lds_meetings with static LDS alias and lane-private hazard analysis (emit::lds::analyze) for lowering console WaveSize(64) compute shaders onto 32-lane host waves when per-lane branches keep barriers out of a region:

  • Refinement A (Disjoint Byte Ranges): Accepts acyclic !all regions when every access resolves to constant non-wrapping byte offsets on a single group-uniform base, every Kind::Write stores provably group-uniform data across all data dwords (making concurrent writes across both host halves idempotent), and there are zero RMW self-overlaps or RAW/WAR/WAW byte overlaps.
  • Refinement B (Lane-Private Slots): Accepts !all regions where every writing/RMW cluster resolves to exclusive per-thread slots across active thread-group dimensions with proper alignment and non-overlapping half-open cross-cluster footprints (handling partial workgroups n = 33..63, verified by a 48,212-case exhaustive byte-access oracle with 0 false accepts).
  • Default write-only soundness & opt-in switch: Pure write-only !all regions require positive proof (Refinement A or Refinement B) by default; the legacy write-only shortcut stays behind the 32-lane opt-in VICTORY_LDS_WRITE_ONLY_OK=1 switch (keyed in both victory-shader/build.rs and victory-gpu/src/shader_cache.rs, and always disabled on non-32-lane hosts).
  • Linear DAG evaluation & VIctory-NVIDIA integration: Cycle-safe acyclic memoization in eval_val prevents exponential DAG blowup; preserves VIctory-NVIDIA's LdsOrder::unordered skipping under PAIR_MEETINGS; emits specific VICTORY_WAVE_WHY=1 refusal diagnostics without re-running analysis.

Verification

  • cargo clippy -p victory-shader -p xtask --all-targets --locked -- -D warnings (default & --all-features): 0 warnings (0 warnings in touched crates/victory-gpu/src/shader_cache.rs)
  • cargo test -p xtask --locked: 6 passed; 0 failed (repository_passes_policy green)
  • cargo test -p victory-gpu --locked shader_cache -- --test-threads=1: 2 passed; 0 failed
  • Hardware D3D12 (VICTORY_D3D12_DEBUG=1, VICTORY_REQUIRE_HW_GPU=1, --test-threads=1):
    • emit::lds::tests: 21 passed; 0 failed (including 48,212-case exhaustive byte-access oracle, n = 33..63 partial-workgroup byte alias test, 40-step v_add_nc_u32 + 32-step v_add3_u32 shared-DAG O(N) stress tests, Refinement A lane-varying data refusal, 4 unproven write-only default-refusal / opt-in tests, and LdsOrder::unordered test)
    • emit::wave64_tests: 16 passed; 0 failed (all 4 HW Wave32 LDS tests executed on hardware D3D12 with no skip, including default Wave64 refusal + opt-in Wave32 execution for unresolved dynamic WAW)
    • emit::diff_tests: 4/4, emit::tests: 21/21
**@⁠Vladimir-Human** on GitHub · 2026-11-27 13:12 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/43) `Vladimir-Human:shader/wave32-lds-hazard-analysis` → `main` · +4010 −108 · 5 files · 1 commits · open ## Summary Replaces the coarse read+write check in `lds_meetings` with static LDS alias and lane-private hazard analysis (`emit::lds::analyze`) for lowering console `WaveSize(64)` compute shaders onto 32-lane host waves when per-lane branches keep barriers out of a region: - **Refinement A (Disjoint Byte Ranges):** Accepts acyclic `!all` regions when every access resolves to constant non-wrapping byte offsets on a single group-uniform base, every `Kind::Write` stores provably group-uniform data across all data dwords (making concurrent writes across both host halves idempotent), and there are zero RMW self-overlaps or RAW/WAR/WAW byte overlaps. - **Refinement B (Lane-Private Slots):** Accepts `!all` regions where every writing/RMW cluster resolves to exclusive per-thread slots across active thread-group dimensions with proper alignment and non-overlapping half-open cross-cluster footprints (handling partial workgroups `n = 33..63`, verified by a 48,212-case exhaustive byte-access oracle with 0 false accepts). - **Default write-only soundness & opt-in switch:** Pure write-only `!all` regions require positive proof (Refinement A or Refinement B) by default; the legacy write-only shortcut stays behind the 32-lane opt-in `VICTORY_LDS_WRITE_ONLY_OK=1` switch (keyed in both `victory-shader/build.rs` and `victory-gpu/src/shader_cache.rs`, and always disabled on non-32-lane hosts). - **Linear DAG evaluation & `VIctory-NVIDIA` integration:** Cycle-safe acyclic memoization in `eval_val` prevents exponential DAG blowup; preserves `VIctory-NVIDIA`'s `LdsOrder::unordered` skipping under `PAIR_MEETINGS`; emits specific `VICTORY_WAVE_WHY=1` refusal diagnostics without re-running analysis. ## Verification - `cargo clippy -p victory-shader -p xtask --all-targets --locked -- -D warnings` (default & `--all-features`): **0 warnings** (`0` warnings in touched `crates/victory-gpu/src/shader_cache.rs`) - `cargo test -p xtask --locked`: **6 passed; 0 failed** (`repository_passes_policy` green) - `cargo test -p victory-gpu --locked shader_cache -- --test-threads=1`: **2 passed; 0 failed** - Hardware D3D12 (`VICTORY_D3D12_DEBUG=1`, `VICTORY_REQUIRE_HW_GPU=1`, `--test-threads=1`): - `emit::lds::tests`: **21 passed; 0 failed** (including 48,212-case exhaustive byte-access oracle, `n = 33..63` partial-workgroup byte alias test, 40-step `v_add_nc_u32` + 32-step `v_add3_u32` shared-DAG O(N) stress tests, Refinement A lane-varying data refusal, 4 unproven write-only default-refusal / opt-in tests, and `LdsOrder::unordered` test) - `emit::wave64_tests`: **16 passed; 0 failed** (all 4 HW Wave32 LDS tests executed on hardware D3D12 with `no skip`, including default Wave64 refusal + opt-in Wave32 execution for unresolved dynamic WAW) - `emit::diff_tests`: **4/4**, `emit::tests`: **21/21**
Replace the coarse read+write check in lds_meetings with static LDS
alias and lane-private hazard analysis (emit::lds::analyze) for
splitting console WaveSize(64) compute shaders into two 32-lane host
waves when lane branches keep barriers out of a region:

- Refinement A: disjoint constant byte ranges on a single group-uniform
  base (non-wrapping, group-uniform stored data on every write, no
  RAW/WAR/WAW or RMW self-overlap, acyclic).
- Refinement B: lane-private slots across active thread-group dimensions
  with half-open footprint overlap checks for partial workgroups
  (n = 33..63) and a 48,212-case exhaustive byte-access oracle (0 false
  accepts).
- Pure write-only `!all` regions require positive proof (Refinement A or
  Refinement B) by default; the legacy write-only shortcut stays behind
  opt-in 32-lane VICTORY_LDS_WRITE_ONLY_OK=1 (keyed in both
  victory-shader/build.rs and victory-gpu/src/shader_cache.rs).
- Cycle-safe acyclic memoization in eval_val keeps shared-DAG evaluation
  O(N) without caching cycle-tainted provisional results.
- Preserves VIctory-NVIDIA's LdsOrder::unordered skipping under
  PAIR_MEETINGS and emits specific VICTORY_WAVE_WHY=1 refusal reasons
  without re-running analysis.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 13:16:26 +00:00
github-bot force-pushed github-bot/gh-43 from d60f009b88 to 075785eba1 2026-11-27 14:30:39 +00:00 Compare
Author
Owner

@⁠Vladimir-Human on GitHub · 2026-11-27 14:27 UTC · original

Rebased cleanly onto main (d12eb1b, PR #30 pr-thread-ticket) at 075785e and guarded run_wave32_lds_on_hardware so 4-lane WARP skips only unsupported WaveSize(32) PSO creation after validating DXIL (still strict under VICTORY_REQUIRE_HW_GPU=1).
Re-verified: clippy (-D warnings, default & --all-features) 0 warnings, xtask policy 280 files ok / 6/6, HW emit::lds:: 21/21 & emit::wave64_tests:: 17/17 (no skip), WARP emit::lds:: 21/21 & lds_ 6/6, shader_cache 2/2.

**@⁠Vladimir-Human** on GitHub · 2026-11-27 14:27 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/43#issuecomment-7220804993) Rebased cleanly onto `main` (`d12eb1b`, PR #30 `pr-thread-ticket`) at `075785e` and guarded `run_wave32_lds_on_hardware` so 4-lane WARP skips only unsupported `WaveSize(32)` PSO creation after validating DXIL (still strict under `VICTORY_REQUIRE_HW_GPU=1`). Re-verified: `clippy` (`-D warnings`, default & `--all-features`) 0 warnings, `xtask` policy 280 files ok / 6/6, HW `emit::lds::` 21/21 & `emit::wave64_tests::` 17/17 (`no skip`), WARP `emit::lds::` 21/21 & `lds_` 6/6, `shader_cache` 2/2.
Author
Owner

@⁠jptorres96 on GitHub · 2026-11-27 16:14 UTC · original

Independent run on RTX 4080 SUPER 16 GB (Ada, 32-lane waves), driver 621.01, Ryzen 5 5600X, Windows build 26300, toolchain 1.98.1, DXIL validator from DXC 1.9.2609.5, VICTORY_REQUIRE_HW_GPU=1. Head 075785e.

  • cargo test -p victory-shader --lib execute_wave32_on_hardware -- --nocapture: both tests passed and ran on the card:
    lds_disjoint_ranges: ran recovered WaveSize(32) on hardware D3D12 device (no skip)
    lds_dual_and_b128_disjoint: ran recovered WaveSize(32) on hardware D3D12 device (no skip)
    
  • lds_lane_private_with_rtn_atomic_executes_wave32_on_hardware (not matched by that filter) passed in the full run below; I did not capture its output there.
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean
  • cargo test -p victory-shader --lib -- --test-threads=1: 314 passed, 0 failed, 4 ignored

No game dump here, so nothing in-game.

**@⁠jptorres96** on GitHub · 2026-11-27 16:14 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/43#issuecomment-7223033843) Independent run on RTX 4080 SUPER 16 GB (Ada, 32-lane waves), driver 621.01, Ryzen 5 5600X, Windows build 26300, toolchain 1.98.1, DXIL validator from DXC 1.9.2609.5, `VICTORY_REQUIRE_HW_GPU=1`. Head `075785e`. - `cargo test -p victory-shader --lib execute_wave32_on_hardware -- --nocapture`: both tests passed and ran on the card: ``` lds_disjoint_ranges: ran recovered WaveSize(32) on hardware D3D12 device (no skip) lds_dual_and_b128_disjoint: ran recovered WaveSize(32) on hardware D3D12 device (no skip) ``` - `lds_lane_private_with_rtn_atomic_executes_wave32_on_hardware` (not matched by that filter) passed in the full run below; I did not capture its output there. - `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean - `cargo test -p victory-shader --lib -- --test-threads=1`: 314 passed, 0 failed, 4 ignored No game dump here, so nothing in-game.
Author
Owner

@⁠Aniseto on GitHub · 2026-11-27 18:01 UTC · original

Ran the Wave32 LDS analyzer tests on an NVIDIA Blackwell part at 075785e: 21 unit tests plus three hardware-executed Wave32 cases.

System

  • GPU: NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, mesh shaders), 16 GB, driver 32.0.16.2124
  • CPU: Intel Core i5-12400F, 64 GB RAM
  • OS: Windows 11 Pro build 26200
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 19.44.35230, DXC 1.9.2609.5
  • Build: debug (test profile), VICTORY_REQUIRE_HW_GPU=1, VICTORY_DXIL from DXC 1.9.2609.5

Results

  • cargo test -p victory-shader --lib emit::lds -- --test-threads=4: 21 passed, 0 failed, 0 ignored (exit 0)
  • cargo test -p victory-shader --lib execute_wave32_on_hardware -- --nocapture with VICTORY_REQUIRE_HW_GPU=1: 2 passed, 0 failed, 0 ignored (exit 0). Both printed "ran recovered WaveSize(32) on hardware D3D12 device (no skip)".
  • cargo test -p victory-shader --lib lds_lane_private_with_rtn_atomic_executes_wave32_on_hardware -- --nocapture with VICTORY_REQUIRE_HW_GPU=1: 1 passed, 0 failed, 0 ignored (exit 0). Same hardware line.

What this adds
The independent run already in the thread is an Ada RTX 4080 SUPER. This adds a Blackwell part on a newer driver and Windows build, with VICTORY_REQUIRE_HW_GPU set so a silent skip would have failed the run. None of the three Wave32 cases skipped here: they executed on the real D3D12 device, including the returning-atomic lane-private case. No game data was used.

Not tested
Native wave64, AMD and Intel adapters, Wine, release profile, frame generation, retail titles. The full suite at this head was not run here; the unit filter covers emit::lds only.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR head in a detached worktree, ran the commands above and wrote this report; no game data was used.

**@⁠Aniseto** on GitHub · 2026-11-27 18:01 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/43#issuecomment-7225041020) Ran the Wave32 LDS analyzer tests on an NVIDIA Blackwell part at 075785e: 21 unit tests plus three hardware-executed Wave32 cases. **System** - GPU: NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, mesh shaders), 16 GB, driver 32.0.16.2124 - CPU: Intel Core i5-12400F, 64 GB RAM - OS: Windows 11 Pro build 26200 - Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 19.44.35230, DXC 1.9.2609.5 - Build: debug (test profile), VICTORY_REQUIRE_HW_GPU=1, VICTORY_DXIL from DXC 1.9.2609.5 **Results** - `cargo test -p victory-shader --lib emit::lds -- --test-threads=4`: 21 passed, 0 failed, 0 ignored (exit 0) - `cargo test -p victory-shader --lib execute_wave32_on_hardware -- --nocapture` with VICTORY_REQUIRE_HW_GPU=1: 2 passed, 0 failed, 0 ignored (exit 0). Both printed "ran recovered WaveSize(32) on hardware D3D12 device (no skip)". - `cargo test -p victory-shader --lib lds_lane_private_with_rtn_atomic_executes_wave32_on_hardware -- --nocapture` with VICTORY_REQUIRE_HW_GPU=1: 1 passed, 0 failed, 0 ignored (exit 0). Same hardware line. **What this adds** The independent run already in the thread is an Ada RTX 4080 SUPER. This adds a Blackwell part on a newer driver and Windows build, with VICTORY_REQUIRE_HW_GPU set so a silent skip would have failed the run. None of the three Wave32 cases skipped here: they executed on the real D3D12 device, including the returning-atomic lane-private case. No game data was used. **Not tested** Native wave64, AMD and Intel adapters, Wine, release profile, frame generation, retail titles. The full suite at this head was not run here; the unit filter covers emit::lds only. AI-assisted (OpenCode), model: **DeepSeek V4.1 Flash Free** - checked out the PR head in a detached worktree, ran the commands above and wrote this report; no game data was used.
Author
Owner

@⁠CaitoV4 on GitHub · 2026-11-27 18:05 UTC · original

I'm testing VIctory-NVIDIA with an RTX 5070 and a Ryzen 7 7800X3D.

I'm still experiencing shader-related graphical issues during gameplay.

Some shaders and visual effects appear to be missing, incorrectly rendered, or visually broken. This affects the overall visual quality and makes certain scenes look different from how they should.

Performance and Frame Generation have improved significantly in the latest build, but shader rendering still needs some work.

Are these shader issues already known? Is there any specific diagnostic information I can provide to help identify and fix them?

I'm happy to share screenshots, logs, and additional test results.

Thanks for your work on this project!

**@⁠CaitoV4** on GitHub · 2026-11-27 18:05 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/43#issuecomment-7225118309) I'm testing VIctory-NVIDIA with an RTX 5070 and a Ryzen 7 7800X3D. I'm still experiencing shader-related graphical issues during gameplay. Some shaders and visual effects appear to be missing, incorrectly rendered, or visually broken. This affects the overall visual quality and makes certain scenes look different from how they should. Performance and Frame Generation have improved significantly in the latest build, but shader rendering still needs some work. Are these shader issues already known? Is there any specific diagnostic information I can provide to help identify and fix them? I'm happy to share screenshots, logs, and additional test results. Thanks for your work on this project!
Author
Owner

@⁠Vladimir-Human on GitHub · 2026-11-27 20:30 UTC · original

@⁠CaitoV4 Thanks for testing on your RTX 5070 and offering to collect diagnostics!

One quick clarification on scope: PR #43 only covers static Wave32 LDS hazard analysis for compute shaders (allowing certain branched/disjoint-LDS compute shaders to run in 32-lane waves instead of falling back to slow Wave64 emulation). It does not alter general pixel/graphics shader translation.

To track down the missing/broken visual effects you are seeing:

  1. Check whether they occur on main vs #43: If the artifacts also happen on a plain main build, opening a dedicated GitHub issue in trustno1-coder/VIctory-NVIDIA will reach everyone working on shader translation. (If something breaks only when #43 is applied on top of main, please reply here with that difference!)
  2. Useful diagnostics to attach (please do not attach any game files or raw shader dumps publicly):
    • The exact build commit SHA or release tag, launcher options used (e.g., DLSS / FrameGen / Series S vs Series X / VICTORY_* overrides), and your NVIDIA driver version.
    • Both logs from %LOCALAPPDATA%\victory:
      • Play log in %LOCALAPPDATA%\victory\logs\ (victory-nvidia-play-*.log or victory-nvidia-*.log), and
      • Crash log if any in %LOCALAPPDATA%\VIctory\data\7952987A\crashes.log (plus any newest *.crash.log in temp\).
    • Before/after screenshots showing the exact broken scene/effect, and if testing with -Build diag, F3 panel stats or VICTORY_DUMP_TARGETS=1 / VICTORY_SHADER_CENSUS notes are also helpful locally.
**@⁠Vladimir-Human** on GitHub · 2026-11-27 20:30 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/43#issuecomment-7227568852) @⁠CaitoV4 Thanks for testing on your RTX 5070 and offering to collect diagnostics! One quick clarification on scope: **PR `#43` only covers static Wave32 LDS hazard analysis for compute shaders** (allowing certain branched/disjoint-LDS compute shaders to run in 32-lane waves instead of falling back to slow Wave64 emulation). It does not alter general pixel/graphics shader translation. To track down the missing/broken visual effects you are seeing: 1. **Check whether they occur on `main` vs `#43`:** If the artifacts also happen on a plain `main` build, opening a dedicated GitHub issue in `trustno1-coder/VIctory-NVIDIA` will reach everyone working on shader translation. (If something breaks *only* when `#43` is applied on top of `main`, please reply here with that difference!) 2. **Useful diagnostics to attach** (please do **not** attach any game files or raw shader dumps publicly): - The exact build commit SHA or release tag, launcher options used (e.g., DLSS / FrameGen / Series S vs Series X / `VICTORY_*` overrides), and your NVIDIA driver version. - **Both logs** from `%LOCALAPPDATA%\victory`: - Play log in `%LOCALAPPDATA%\victory\logs\` (`victory-nvidia-play-*.log` or `victory-nvidia-*.log`), and - Crash log if any in `%LOCALAPPDATA%\VIctory\data\7952987A\crashes.log` (plus any newest `*.crash.log` in `temp\`). - Before/after screenshots showing the exact broken scene/effect, and if testing with `-Build diag`, F3 panel stats or `VICTORY_DUMP_TARGETS=1` / `VICTORY_SHADER_CENSUS` notes are also helpful locally.
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/43/head:github-bot/gh-43'
git switch 'github-bot/gh-43'

Merge

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