fix(shader): structural wave-wide lowering for cascade-shadow rasters (VICTORY_WAVE_WIDE_AUTO) #281

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

@⁠Mikey970 on GitHub · 2026-11-27 20:40 UTC · original
Mikey970:pr/wave-wide-auto → main · +337 −18 · 5 files · 1 commits · open

Problem

On 32-lane hosts, VICTORY_WAVE_WIDE is off globally because widening shaders that place translator barriers inside loops (e.g. ptfx_CS_lightAtlas_Sprite / _Trail) causes device loss. As a result, the 18 cascadeshadows_rendering:CS_ShadowRenderTiled* raster variants fall back to without skips, scalars followed, where a cross-half exchange runs after per-lane branching with no barrier—producing an 8-px sun-shadow staircase and lit-through tiles on walls and hair.

Fix

  • Splits ir::without_skips into skips_left_out and adds ir::deep_skip_holds to detect when earlier forms stop at a cross-half exchange kept from every lane only by a deep-only s_cbranch_execz skip (an inner skip sharing its join with an outer skip).
  • Adds lower::watch_loop_barriers / reset_loop_barriers / note_barrier to reject any wave-wide lowering that places a translator group barrier inside a CFG cycle (keeping ptfx_CS_lightAtlas_* safe).
  • Adds VICTORY_WAVE_WIDE_AUTO (on by default when VICTORY_WAVE_WIDE is unset; =0 restores old order): tries wave-wide before without skips, scalars followed when deep_skip_holds matches and no translator barrier lands in a loop.
  • Extends VICTORY_WAVE_WIDE to accept a comma-separated list of container digest hex prefixes (>= 8 digits) for targeted testing without affecting 0/1, and adds diagnostic VICTORY_WAVE_BALLOT_SYNC=1 (off by default).
  • Keys both VICTORY_WAVE_WIDE_AUTO and VICTORY_WAVE_BALLOT_SYNC in shader_cache.rs.

Testing

  • Added unit tests emit::wave64_tests::a_count_behind_a_skip_that_ends_with_an_outer_one_takes_the_wave_wide_form (validates DXIL and covers deep-skip selection, own-join skip, and loop-barrier rejection) and emit::barycentric_tests::wide_digest_list_matches_prefixes_and_leaves_flags_alone (both passed).
  • Verified cargo check -p victory-gpu passes.
  • Validated in-game: removes the window-wall/hair shadow staircase with ~0 ms release frame-time overhead and no device loss.
**@⁠Mikey970** on GitHub · 2026-11-27 20:40 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/281) `Mikey970:pr/wave-wide-auto` → `main` · +337 −18 · 5 files · 1 commits · open ## Problem On 32-lane hosts, `VICTORY_WAVE_WIDE` is off globally because widening shaders that place translator barriers inside loops (e.g. `ptfx_CS_lightAtlas_Sprite` / `_Trail`) causes device loss. As a result, the 18 `cascadeshadows_rendering:CS_ShadowRenderTiled*` raster variants fall back to `without skips, scalars followed`, where a cross-half exchange runs after per-lane branching with no barrier—producing an 8-px sun-shadow staircase and lit-through tiles on walls and hair. ## Fix - Splits `ir::without_skips` into `skips_left_out` and adds `ir::deep_skip_holds` to detect when earlier forms stop at a cross-half exchange kept from every lane only by a deep-only `s_cbranch_execz` skip (an inner skip sharing its join with an outer skip). - Adds `lower::watch_loop_barriers` / `reset_loop_barriers` / `note_barrier` to reject any wave-wide lowering that places a translator group barrier inside a CFG cycle (keeping `ptfx_CS_lightAtlas_*` safe). - Adds `VICTORY_WAVE_WIDE_AUTO` (on by default when `VICTORY_WAVE_WIDE` is unset; `=0` restores old order): tries wave-wide before `without skips, scalars followed` when `deep_skip_holds` matches and no translator barrier lands in a loop. - Extends `VICTORY_WAVE_WIDE` to accept a comma-separated list of container digest hex prefixes (>= 8 digits) for targeted testing without affecting `0`/`1`, and adds diagnostic `VICTORY_WAVE_BALLOT_SYNC=1` (off by default). - Keys both `VICTORY_WAVE_WIDE_AUTO` and `VICTORY_WAVE_BALLOT_SYNC` in `shader_cache.rs`. ## Testing - Added unit tests `emit::wave64_tests::a_count_behind_a_skip_that_ends_with_an_outer_one_takes_the_wave_wide_form` (validates DXIL and covers deep-skip selection, own-join skip, and loop-barrier rejection) and `emit::barycentric_tests::wide_digest_list_matches_prefixes_and_leaves_flags_alone` (both passed). - Verified `cargo check -p victory-gpu` passes. - Validated in-game: removes the window-wall/hair shadow staircase with ~0 ms release frame-time overhead and no device loss.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 20:42:53 +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/281/head:github-bot/gh-281'
git switch 'github-bot/gh-281'

Merge

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