shader: opt-in first-lane uniformity (VICTORY_FIRSTLANE_UNIFORM=1, default off) #166

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

@⁠SovietBearz0r on GitHub · 2026-12-05 19:31 UTC · original
SovietBearz0r:shader-opt-first-lane → main · +81 −12 · 6 files · 1 commits · draft

First-lane uniformity split out of #126, per the review there. Default off; existing output unchanged.

What

  • VICTORY_FIRSTLANE_UNIFORM=1 (off): a lowering pass that makes first-lane (WaveReadLaneFirst) reads uniform where the source value is wave-uniform, so the wave plan can carry it instead of a per-lane read. No VICTORY_SHADER_OPT bit; switch appended to the shader-cache key when on.
  • Split cleanliness: touches wave_plan.rs/valu.rs/lower/mod.rs, independent of the DXIL pass branches; only the shared emit/mod.rs/cache-key anchors are adjacent.
  • Includes a focused test the umbrella branch lacked: lane_uniform's LDS-read rule is only used for the exchange caller (a_first_lane_read_of_an_alike_value_is_only_lds_alike_when_asked).

Verification

  • cargo test -p victory-dxil 21 passed; cargo test -p victory-shader --lib 324 passed / 2 ignored, and 324 passed with VICTORY_FIRSTLANE_UNIFORM=1; cargo check -p victory; policy 442 files; clippy -D warnings clean.
  • In-game A/B owed: wave64 compute programs (NVIDIA 32-lane host waves and AMD wave64) — count WaveReadLaneFirst elisions, confirm parity with VICTORY_FIRSTLANE_OWN, visual equality and frame time.

Source: MiniVI/sixmoon via longroad lineage.

**@⁠SovietBearz0r** on GitHub · 2026-12-05 19:31 UTC · [original](https://github.com/ReTerryDavis/ReVIctory/pull/165) `SovietBearz0r:shader-opt-first-lane` → `main` · +81 −12 · 6 files · 1 commits · draft First-lane uniformity split out of #126, per the review there. Default off; existing output unchanged. ## What - `VICTORY_FIRSTLANE_UNIFORM=1` (off): a lowering pass that makes first-lane (`WaveReadLaneFirst`) reads uniform where the source value is wave-uniform, so the wave plan can carry it instead of a per-lane read. No `VICTORY_SHADER_OPT` bit; switch appended to the shader-cache key when on. - Split cleanliness: touches `wave_plan.rs`/`valu.rs`/`lower/mod.rs`, independent of the DXIL pass branches; only the shared `emit/mod.rs`/cache-key anchors are adjacent. - Includes a focused test the umbrella branch lacked: `lane_uniform`'s LDS-read rule is only used for the exchange caller (`a_first_lane_read_of_an_alike_value_is_only_lds_alike_when_asked`). ## Verification - `cargo test -p victory-dxil` **21 passed**; `cargo test -p victory-shader --lib` **324 passed / 2 ignored**, and **324 passed** with `VICTORY_FIRSTLANE_UNIFORM=1`; `cargo check -p victory`; policy 442 files; clippy `-D warnings` clean. - **In-game A/B owed**: wave64 compute programs (NVIDIA 32-lane host waves and AMD wave64) — count `WaveReadLaneFirst` elisions, confirm parity with `VICTORY_FIRSTLANE_OWN`, visual equality and frame time. Source: MiniVI/sixmoon via longroad lineage.
A v_readfirstlane_b32 of a VGPR value every lane holds alike
(lane_uniform without the ordered-LDS rule) is lowered as the lane's own
value, so no WaveReadLaneFirst/cross-lane call is emitted. Exact for
wave64 programs whose console waves are runs of 64 lanes: the first lane's
value is every lane's; not used where threads past a dispatch count run
(partial_active). The LDS-read uniformity rule is compiled out of the
exchange-less call (a new lane_uniform parameter) because only the ordered
LDS analysis proves those reads alike. Ported from sixmoon 1.3.0 (Darner
d3fa32bd1a, GPL-3.0-or-later).

Switch: VICTORY_FIRSTLANE_UNIFORM=1 (default off; this pass is in the
lowering, so it has no VICTORY_SHADER_OPT bit). A default run's output,
behaviour and cache keys are unchanged; when on, the switch is appended to
the shader cache's key.

Split out of draft #125 into one pass per PR. VICTORY_LEGACY_FINITE
(unsound) is dropped, not shipped.

Tests: cargo test -p victory-shader --lib: 324 passed, 2 ignored (new: an
LDS read at an alike address is taken as one value per lane only when the
caller allows LDS reads), and again 324 passed with
VICTORY_FIRSTLANE_UNIFORM=1. cargo test -p victory-dxil: 21 passed. cargo
check -p victory; cargo xtask policy (442 files ok); clippy
-p victory-shader -p victory-dxil -p victory-gpu --all-targets -- -D
warnings; git diff --check: clean.

Still needs in-game A/B on the target cards before any promotion to
default (see the PR description).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 19:36:01 +00:00
Author
Owner

@⁠Saksukella on GitHub · 2026-12-05 21:55 UTC · original

Tested combined with PR #163 (LICM) + VICTORY_BATCH_PFP=1 on AMD Radeon RX 9070 XT (RDNA 4, 16 GB) / Ryzen 9 7900X / Windows 11, production --release build on 8bff52b + PR #81 (DXR 1.1 HWRT) + PR #87, fixed deterministic route (motel_strip, 10s idle + 15s 67 mph cruise, locked noon clear weather, FSR 4.1.2 Balanced 4K, FG off, VICTORY_WIDE_THREADS=8, fully warmed pipe=0 via play.ps1 -Warm):

Mode Baseline (8bff52b + #81 + #87, --release, opt=255) With #166 (VICTORY_FIRSTLANE_UNIFORM=1) + #163 (opt=511) + BATCH_PFP=1 Delta
DXR 1.1 HWRT (idle / cruise) 38.3 / 37.8 FPS 40.2 / 39.2 FPS +1.9 / +1.4 FPS
Non-RT (idle / cruise) 41.4 / 41.5 FPS 41.8 / 43.7 FPS (49.1 peak) +0.4 / +2.2 FPS
  • CPU tests: ictory-dxil 22/22 passed, ictory-shader --lib 329/329 passed, cargo xtask policy 446/446 ok.
  • All 5/5 benchmark runs exited cleanly (
**@⁠Saksukella** on GitHub · 2026-12-05 21:55 UTC · [original](https://github.com/ReTerryDavis/ReVIctory/pull/165#issuecomment-7446143202) Tested combined with PR #163 (LICM) + VICTORY_BATCH_PFP=1 on **AMD Radeon RX 9070 XT (RDNA 4, 16 GB) / Ryzen 9 7900X / Windows 11**, production --release build on 8bff52b + PR #81 (DXR 1.1 HWRT) + PR #87, fixed deterministic route (motel_strip, 10s idle + 15s 67 mph cruise, locked noon clear weather, FSR 4.1.2 Balanced 4K, FG off, VICTORY_WIDE_THREADS=8, fully warmed pipe=0 via play.ps1 -Warm): | Mode | Baseline (8bff52b + #81 + #87, --release, opt=255) | With #166 (VICTORY_FIRSTLANE_UNIFORM=1) + #163 (opt=511) + BATCH_PFP=1 | Delta | |---|---:|---:|---:| | **DXR 1.1 HWRT** (idle / cruise) | 38.3 / 37.8 FPS | **40.2 / 39.2 FPS** | **+1.9 / +1.4 FPS** | | **Non-RT** (idle / cruise) | 41.4 / 41.5 FPS | **41.8 / 43.7 FPS** (49.1 peak) | **+0.4 / +2.2 FPS** | - CPU tests: ictory-dxil 22/22 passed, ictory-shader --lib 329/329 passed, cargo xtask policy 446/446 ok. - All 5/5 benchmark runs exited cleanly (
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/166/head:github-bot/gh-165'
git switch 'github-bot/gh-165'

Merge

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