Shader: pair form for tiled shadows, guard-select liveness, one-half LDS batching (all opt-in) #12

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

@⁠adib-cyber007 on GitHub · 2026-12-02 17:09 UTC · original
adib-cyber007:pr/11-shader-tiled-shadows-and-lds-batch → main · +537 −3 · 5 files · 1 commits · open

Port of trustno1-coder/VIctory-NVIDIA 398fdaff (GPL-3.0), adapted cleanly onto main with all three switches keyed into shader_cache.rs.

Why (large GPU shader-instruction & barrier reductions on NVIDIA)

All three optimizations are off by default so existing runs and caches stay untouched until enabled:

  1. VICTORY_PAIR_FIRST=1 (or =<text>,...): Gives CS_ShadowRenderTiled* (Cascades, CascadesAlpha, Misc) the pair-wave form (lower::pair) before folding, cutting DXIL instruction counts by >50% (38,919 → 17,904, 46,857 → 21,923, 29,292 → 13,544).
  2. VICTORY_GUARD_LIVENESS=1 (emit/lower/keep_old.rs): Omits keep-old select instructions on guarded VGPR writes whenever conservative per-lane SSA liveness proves no lane can read the old value (combined with VICTORY_PAIR_FIRST, cuts tiled shadow totals further to 16,137 / 18,429 / 12,031).
  3. VICTORY_LDS_BATCH=1 (emit/lower/lds_batch.rs): Shares a single host-wave meeting across contiguous runs of LDS accesses proven to run in only one console half (cuts CS_WriteRasterClassificationResults from 20,223 → 5,823 instructions and 1,637 → 37 barriers).

Cache & Toggles

  • All three switches (VICTORY_PAIR_FIRST, VICTORY_GUARD_LIVENESS, VICTORY_LDS_BATCH) are included in shader_cache::build(), so enabling/disabling them never serves stale cached translations.
  • Test individually or together with VICTORY_PAIR_FIRST=1 VICTORY_GUARD_LIVENESS=1 VICTORY_LDS_BATCH=1.

Verification

  • All 45 pair_first_tests + wave64_tests (live RTX 3050 D3D12 wave64 hardware tests) and shader_cache::tests passed.
  • Default workspace check and --features diagnostics check passed with zero new warnings.
  • Live GPU frame-time impact needs measurement on your RTX 3050 walk run.
**@⁠adib-cyber007** on GitHub · 2026-12-02 17:09 UTC · [original](https://github.com/ImTaneax/VIctory-RTX3050-4gb/pull/12) `adib-cyber007:pr/11-shader-tiled-shadows-and-lds-batch` → `main` · +537 −3 · 5 files · 1 commits · open Port of `trustno1-coder/VIctory-NVIDIA` `398fdaff` (GPL-3.0), adapted cleanly onto `main` with all three switches keyed into `shader_cache.rs`. ### Why (large GPU shader-instruction & barrier reductions on NVIDIA) All three optimizations are **off by default** so existing runs and caches stay untouched until enabled: 1. **`VICTORY_PAIR_FIRST=1`** (or `=<text>,...`): Gives `CS_ShadowRenderTiled*` (`Cascades`, `CascadesAlpha`, `Misc`) the pair-wave form (`lower::pair`) before folding, cutting DXIL instruction counts by >50% (`38,919 → 17,904`, `46,857 → 21,923`, `29,292 → 13,544`). 2. **`VICTORY_GUARD_LIVENESS=1`** (`emit/lower/keep_old.rs`): Omits keep-old `select` instructions on guarded VGPR writes whenever conservative per-lane SSA liveness proves no lane can read the old value (combined with `VICTORY_PAIR_FIRST`, cuts tiled shadow totals further to `16,137 / 18,429 / 12,031`). 3. **`VICTORY_LDS_BATCH=1`** (`emit/lower/lds_batch.rs`): Shares a single host-wave meeting across contiguous runs of LDS accesses proven to run in only one console half (cuts `CS_WriteRasterClassificationResults` from `20,223 → 5,823` instructions and `1,637 → 37` barriers). ### Cache & Toggles - All three switches (`VICTORY_PAIR_FIRST`, `VICTORY_GUARD_LIVENESS`, `VICTORY_LDS_BATCH`) are included in `shader_cache::build()`, so enabling/disabling them never serves stale cached translations. - Test individually or together with `VICTORY_PAIR_FIRST=1 VICTORY_GUARD_LIVENESS=1 VICTORY_LDS_BATCH=1`. ### Verification - All 45 `pair_first_tests` + `wave64_tests` (live RTX 3050 D3D12 wave64 hardware tests) and `shader_cache::tests` passed. - Default workspace check and `--features diagnostics` check passed with zero new warnings. - Live GPU frame-time impact needs measurement on your RTX 3050 walk run.
Port of trustno1-coder/VIctory-NVIDIA 398fdaff (GPL-3.0). Adds three opt-in shader optimization switches keyed into shader_cache.rs:
- VICTORY_PAIR_FIRST=1 (or =<text>,...): lowers CS_ShadowRenderTiled* into pair-wave form before folding (>50% DXIL reduction: ~39k-47k -> ~18k-22k instructions).
- VICTORY_GUARD_LIVENESS=1: drops keep-old guard selects where per-lane SSA liveness proves no lane can read the old VGPR value.
- VICTORY_LDS_BATCH=1: collapses runs of one-half LDS accesses into a single host-wave meeting (cutting 1,637 -> 37 barriers in init kernels).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 18:26:12 +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/12/head:github-bot/gh-12'
git switch 'github-bot/gh-12'

Merge

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