GPU/shader perf, DLSS FG 2x fallback, water volumetrics Wave32 fix & faster preload #1313

Closed
github-bot wants to merge 1 commit from github-bot/gh-1313 into main AGit
Owner

@⁠dvGrab on GitHub · 2026-11-28 17:12 UTC · original
dvGrab:main → main · +171 −62 · 7 files · 1 commits · closed without merging

Summary

Tested on AMD Ryzen 7 5800X3D (8C/16T), 32 GB RAM, NVIDIA GeForce RTX 4070 Ti (12 GB, Driver 621.40), Windows 11 (1440p, DLSS Performance, Series S profile, AVX2 + ThinLTO release build).

1. DLSS Frame Generation 2x Fallback (crates/victory-gpu/src/streamline.rs)

  • When Streamline rejects >2x multi-frame generation with code 38 (invalid state, e.g. RTX 40 cards requested at 6x), automatically fall back to 2x (1 generated frame) instead of leaving Frame Generation disabled (on=false) on every present.

2. CPU Refresh & Write-Watch Hot-Path Optimizations (watch.rs, shadow.rs, host.rs)

  • Added lock-free watch::kept() (AtomicBool) and an early return at the top of ask_ahead(), skipping redundant Vec allocations, published() scans, sort_unstable(), and ask_ahead_done() write-locks across ~39 flushes/frame while ask_once() is active.
  • Sorted and merged j.ahead intervals (merge_ahead) and switched lookups in nothing_new(), writes(), asked(), and ask_rest() from O(M) linear scans to O(log M) binary search (ahead_contains), removing O(N^2) work and duplicate kernel queries in ask_rest().
  • Added shadow::wide_each_count() with chunking (chunk = 8 for n >= 64) and thread-local skipped counts to eliminate ~4,380/frame atomic cache-line bounces on next and FLUSHES[2].
  • Added lock-free AtomicBool fast paths (has_pending, has_ranged) on Shadow to skip ~5,441+ mutex lock/unlocks per frame in nothing_new(), update(), writes_pending(), writes_pending_in(), and ranged().

3. Water Volumetrics Wave32 Fix (crates/victory-shader/src/emit/mod.rs)

  • Added the two missing DXBC container digests for TransmissionVolumetrics_bd25dcd5_Wrapped (6871d6e4b3ac9a10) and TransmissionVolumetrics_VolumePortalsOnly_bd25dcd5_Wrapped (a10179ab7eda0dc3) to scene_kernel. Both previously failed to emit on Wave32 (0 emitted); with wave-wide branches they now emit, validate (dxil.dll), and build D3D12 PSOs cleanly (2 emitted, 2 validated, 2 pipelines).

4. Faster Shader & Pipeline Preloading (apps/victory/src/warm.rs, apps/victory/src/translate.rs)

  • Increased AT_ONCE batch size from 40 to 200 (5x fewer child process spawns and D3D12 device re-initializations).
  • Scaled default warm workers from cores * 2 / 3 (10 on 16T) to cores - 1 (15 on 16T).
  • Raised worker process priority from IDLE_PRIORITY_CLASS to BELOW_NORMAL_PRIORITY_CLASS.
  • Buffered warm-done.txt writes with BufWriter flushed per chunk.
  • Skipped non-shader archives/files (.zip, .7z, .rar, .xvd, .pdb, .log, .txt) in translate::precompile.

Measured Results

Metric Before After Delta
Base FPS (gameplay median) 29–32.5 FPS (30.8–33.3 ms) 34–38.6 FPS (25.9–29.2 ms) +15–20 %
Displayed FPS (DLSS FG 2x) 23.6 FPS (FG broken/off) → 60–64 FPS 68–72 FPS (34/68, 36/72) +8–10 FPS
Scene-change stutters (>50 ms) 300–495 ms (2–3.6 FPS) 0 over 50 ms (longest 37.1 ms) Eliminated
PREP lists' steps / refreshes 14.2 ms / 8.6 ms 12.0 ms / 7.0 ms -2.2 ms / -1.6 ms
PREP write-watch asking 4.6 ms 3.8 ms -0.8 ms
GPU utilization 60–69 % 76–80 % Less CPU-bound

Shader & Pipeline Preload Timings (Ryzen 7 5800X3D, 15 workers)

  • Full shader translation cache: 25,762 shaders in 122 s (~2 min)
  • Pipeline warming: ~117 pipelines/s (~7–8 s per 1,000 pipelines across 88,584 known pipelines)
  • Pipeline library packing: 6,752 of 6,763 loading/slow pipelines (87.0 MB) in 9 s

Verification

  • cargo test -p victory-gpu --lib streamline: 14 passed, 0 failed
  • cargo test -p victory-gpu --lib watch: 47 passed, 0 failed
  • cargo test -p victory-gpu --lib shadow: 36 passed, 0 failed (2 ignored)
  • translate --jobs 1 --validate --pipelines on TransmissionVolumetrics_bd25dcd5_Wrapped & TransmissionVolumetrics_VolumePortalsOnly_bd25dcd5_Wrapped: 2 emitted, 2 validated, 2 pipelines
**@⁠dvGrab** on GitHub · 2026-11-28 17:12 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1313) `dvGrab:main` → `main` · +171 −62 · 7 files · 1 commits · closed without merging ## Summary Tested on **AMD Ryzen 7 5800X3D (8C/16T), 32 GB RAM, NVIDIA GeForce RTX 4070 Ti (12 GB, Driver 621.40), Windows 11** (1440p, DLSS Performance, Series S profile, AVX2 + ThinLTO release build). ### 1. DLSS Frame Generation 2x Fallback (`crates/victory-gpu/src/streamline.rs`) - When Streamline rejects >2x multi-frame generation with `code 38` (`invalid state`, e.g. RTX 40 cards requested at 6x), automatically fall back to **2x** (`1` generated frame) instead of leaving Frame Generation disabled (`on=false`) on every present. ### 2. CPU Refresh & Write-Watch Hot-Path Optimizations (`watch.rs`, `shadow.rs`, `host.rs`) - Added lock-free `watch::kept()` (`AtomicBool`) and an early return at the top of `ask_ahead()`, skipping redundant `Vec` allocations, `published()` scans, `sort_unstable()`, and `ask_ahead_done()` write-locks across ~39 flushes/frame while `ask_once()` is active. - Sorted and merged `j.ahead` intervals (`merge_ahead`) and switched lookups in `nothing_new()`, `writes()`, `asked()`, and `ask_rest()` from `O(M)` linear scans to `O(log M)` binary search (`ahead_contains`), removing `O(N^2)` work and duplicate kernel queries in `ask_rest()`. - Added `shadow::wide_each_count()` with chunking (`chunk = 8` for `n >= 64`) and thread-local skipped counts to eliminate ~4,380/frame atomic cache-line bounces on `next` and `FLUSHES[2]`. - Added lock-free `AtomicBool` fast paths (`has_pending`, `has_ranged`) on `Shadow` to skip ~5,441+ mutex lock/unlocks per frame in `nothing_new()`, `update()`, `writes_pending()`, `writes_pending_in()`, and `ranged()`. ### 3. Water Volumetrics Wave32 Fix (`crates/victory-shader/src/emit/mod.rs`) - Added the two missing DXBC container digests for `TransmissionVolumetrics_bd25dcd5_Wrapped` (`6871d6e4b3ac9a10`) and `TransmissionVolumetrics_VolumePortalsOnly_bd25dcd5_Wrapped` (`a10179ab7eda0dc3`) to `scene_kernel`. Both previously failed to emit on Wave32 (`0 emitted`); with wave-wide branches they now emit, validate (`dxil.dll`), and build D3D12 PSOs cleanly (`2 emitted, 2 validated, 2 pipelines`). ### 4. Faster Shader & Pipeline Preloading (`apps/victory/src/warm.rs`, `apps/victory/src/translate.rs`) - Increased `AT_ONCE` batch size from `40` to `200` (5x fewer child process spawns and D3D12 device re-initializations). - Scaled default warm workers from `cores * 2 / 3` (`10` on 16T) to `cores - 1` (`15` on 16T). - Raised worker process priority from `IDLE_PRIORITY_CLASS` to `BELOW_NORMAL_PRIORITY_CLASS`. - Buffered `warm-done.txt` writes with `BufWriter` flushed per chunk. - Skipped non-shader archives/files (`.zip`, `.7z`, `.rar`, `.xvd`, `.pdb`, `.log`, `.txt`) in `translate::precompile`. --- ## Measured Results | Metric | Before | After | Delta | | --- | --- | --- | --- | | **Base FPS (gameplay median)** | 29–32.5 FPS (`30.8–33.3 ms`) | **34–38.6 FPS (`25.9–29.2 ms`)** | **+15–20 %** | | **Displayed FPS (DLSS FG 2x)** | 23.6 FPS (FG broken/off) → 60–64 FPS | **68–72 FPS** (`34/68`, `36/72`) | **+8–10 FPS** | | **Scene-change stutters (`>50 ms`)** | 300–495 ms (2–3.6 FPS) | **0 over 50 ms** (`longest 37.1 ms`) | **Eliminated** | | **`PREP` lists' steps / refreshes** | `14.2 ms` / `8.6 ms` | **`12.0 ms` / `7.0 ms`** | **-2.2 ms / -1.6 ms** | | **`PREP` write-watch asking** | `4.6 ms` | **`3.8 ms`** | **-0.8 ms** | | **GPU utilization** | 60–69 % | **76–80 %** | Less CPU-bound | ### Shader & Pipeline Preload Timings (Ryzen 7 5800X3D, 15 workers) - **Full shader translation cache**: `25,762` shaders in **122 s** (~2 min) - **Pipeline warming**: **~117 pipelines/s** (~7–8 s per 1,000 pipelines across 88,584 known pipelines) - **Pipeline library packing**: `6,752` of `6,763` loading/slow pipelines (`87.0 MB`) in **9 s** ## Verification - `cargo test -p victory-gpu --lib streamline`: **14 passed, 0 failed** - `cargo test -p victory-gpu --lib watch`: **47 passed, 0 failed** - `cargo test -p victory-gpu --lib shadow`: **36 passed, 0 failed** (2 ignored) - `translate --jobs 1 --validate --pipelines` on `TransmissionVolumetrics_bd25dcd5_Wrapped` & `TransmissionVolumetrics_VolumePortalsOnly_bd25dcd5_Wrapped`: **2 emitted, 2 validated, 2 pipelines**
Summary of changes (tested on Ryzen 7 5800X3D, 32 GB RAM, RTX 4070 Ti 12 GB, driver 621.40):

1. DLSS Frame Generation 2x fallback (crates/victory-gpu/src/streamline.rs):
   - When Streamline rejects >2x multi-frame generation with code 38 (invalid state, e.g. RTX 40 cards asked for 6x), automatically fall back to 2x (1 generated frame) instead of leaving FG disabled (on=false) on every present.

2. CPU refresh & write-watch hot-path optimizations (watch.rs, shadow.rs, host.rs):
   - Add lock-free watch::kept() (AtomicBool) and early-return at the top of ask_ahead() to skip redundant Vec allocations, published() scans, sort_unstable(), and ask_ahead_done() write-locks when ask_once() is active (~39 flushes/frame).
   - Sort and merge j.ahead intervals (merge_ahead) and switch ahead lookups in nothing_new(), writes(), asked(), and ask_rest() from O(M) linear scans to O(log M) binary search (ahead_contains), removing O(N^2) work and duplicate kernel queries in ask_rest().
   - Add shadow::wide_each_count() with chunking (chunk=8 for n>=64) and thread-local skipped counts to eliminate ~4,380/frame atomic cache-line bounces on next and FLUSHES[2].
   - Add lock-free AtomicBool fast paths (has_pending, has_ranged) on Shadow to skip ~5,441+ mutex locks/frame in nothing_new(), update(), writes_pending(), writes_pending_in(), and ranged().

3. Water volumetrics Wave32 fix (crates/victory-shader/src/emit/mod.rs):
   - Add missing DXBC digests for TransmissionVolumetrics_bd25dcd5_Wrapped (6871d6e4b3ac9a10) and TransmissionVolumetrics_VolumePortalsOnly_bd25dcd5_Wrapped (a10179ab7eda0dc3) to scene_kernel so both lower cleanly via wave-wide branches on Wave32 hosts (verified: 2 emitted, 2 validated via dxil.dll, 2 D3D12 PSOs built on RTX 4070 Ti).

4. Faster shader & pipeline preloading (apps/victory/src/warm.rs, translate.rs):
   - Increase warm batch size AT_ONCE from 40 to 200 (5x fewer process spawns & D3D12 device re-inits).
   - Scale default warm workers from cores*2/3 (10 on 16T) to cores-1 (15 on 16T).
   - Raise worker priority from IDLE_PRIORITY_CLASS to BELOW_NORMAL_PRIORITY_CLASS.
   - Buffer warm-done.txt writes with BufWriter flushed per chunk.
   - Skip non-shader archives/files (.zip, .7z, .rar, .xvd, .pdb, .log, .txt) in translate::precompile.

Measured results (1440p, DLSS Performance, Series S profile, AVX2+ThinLTO release build):
- Base FPS (median): 29-32.5 FPS (30.8-33.3 ms) -> 34-38.6 FPS (25.9-29.2 ms) (+15-20%)
- Displayed FPS (DLSS FG 2x): 23.6 FPS (FG broken/off) -> 60-64 FPS -> 68-72 FPS
- Scene-change stutters (>50 ms): 300-495 ms (2-3.6 FPS) -> 0 over 50 ms (longest 37.1 ms after preload)
- Submitting thread PREP breakdown:
  - Lists' steps: 14.2 ms -> 12.0 ms (refreshes: 8.6 ms -> 7.0 ms)
  - Write-watch asking: 4.6 ms -> 3.8 ms
  - GPU busy: 60-69% -> 76-80%
- Preload timings (5800X3D, 15 workers):
  - Full shader translation cache: 25,762 shaders in 122 s
  - Pipeline warming: ~117 pipelines/s (~7-8 s per 1,000 pipelines)
  - Pipeline library pack: 6,752 of 6,763 loading/slow pipelines (87.0 MB) in 9 s
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 17:14:25 +00:00
Author
Owner

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

Ran the frame-generation fallback and hot-path test groups at a0ddd05 on an NVIDIA Blackwell desktop part:

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, Rust 1.98.1 (48a229cea 2026-09-01, pinned by rust-toolchain.toml), MSVC 14.44.35207, DXC 1.9.2609.5 (shared env), debug build.

VICTORY_D3D12_ADAPTER=NVIDIA cargo test -p victory-gpu --lib streamline -- --test-threads=1
14 passed; 0 failed; 0 ignored; 0 measured; 476 filtered out      (exit 0)

VICTORY_D3D12_ADAPTER=NVIDIA cargo test -p victory-gpu --lib watch -- --test-threads=1
47 passed; 0 failed; 0 ignored; 0 measured; 443 filtered out      (exit 0)

VICTORY_D3D12_ADAPTER=NVIDIA cargo test -p victory-gpu --lib shadow -- --test-threads=1
36 passed; 0 failed; 2 ignored; 0 measured; 452 filtered out      (exit 0)

All three groups pass with the same counts the author reports from an RTX 4070 Ti. They cover the Streamline/multi-frame fallback, the lock-free kept() and ask_ahead() early return, the merged ahead-intervals, and the shadow merge paths. These are correctness tests; I did not repeat the author's 1440p release A/B, so no FPS number is claimed here. The PR has no comments yet, so this is the first datapoint in the thread and the first from an RTX 5070 Ti.

Not tested: a retail title, FPS/latency A/B, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data.

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

**@⁠Aniseto** on GitHub · 2026-11-28 18:01 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1313#issuecomment-7243474267) Ran the frame-generation fallback and hot-path test groups at `a0ddd05` on an NVIDIA Blackwell desktop part: Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, Rust 1.98.1 (48a229cea 2026-09-01, pinned by `rust-toolchain.toml`), MSVC 14.44.35207, DXC 1.9.2609.5 (shared env), debug build. ``` VICTORY_D3D12_ADAPTER=NVIDIA cargo test -p victory-gpu --lib streamline -- --test-threads=1 14 passed; 0 failed; 0 ignored; 0 measured; 476 filtered out (exit 0) VICTORY_D3D12_ADAPTER=NVIDIA cargo test -p victory-gpu --lib watch -- --test-threads=1 47 passed; 0 failed; 0 ignored; 0 measured; 443 filtered out (exit 0) VICTORY_D3D12_ADAPTER=NVIDIA cargo test -p victory-gpu --lib shadow -- --test-threads=1 36 passed; 0 failed; 2 ignored; 0 measured; 452 filtered out (exit 0) ``` All three groups pass with the same counts the author reports from an RTX 4070 Ti. They cover the Streamline/multi-frame fallback, the lock-free `kept()` and `ask_ahead()` early return, the merged ahead-intervals, and the shadow merge paths. These are correctness tests; I did not repeat the author's 1440p release A/B, so no FPS number is claimed here. The PR has no comments yet, so this is the first datapoint in the thread and the first from an RTX 5070 Ti. Not tested: a retail title, FPS/latency A/B, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data. AI-assisted (OpenCode), model: **DeepSeek V4.1 Flash Free** - checked out the PR's head commit in a detached worktree, built it, ran the commands above, wrote this report; the worktree was not modified; no game data was used.
github-bot closed this pull request 2026-11-28 19:25:05 +00:00
Author
Owner

@⁠trustno1-coder on GitHub · 2026-11-28 19:23 UTC · original

Thanks for this. I'm closing it without merging because it conflicts with the current main in several places (main has moved a lot since it was opened, with about 100 pull requests merged today), and I can't resolve that safely on your behalf. If you'd still like it in, please rebase it on the current main and open a new pull request.

**@⁠trustno1-coder** on GitHub · 2026-11-28 19:23 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1313#issuecomment-7244504871) Thanks for this. I'm closing it without merging because it conflicts with the current main in several places (main has moved a lot since it was opened, with about 100 pull requests merged today), and I can't resolve that safely on your behalf. If you'd still like it in, please rebase it on the current main and open a new pull request.

Pull request closed

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!1313
No description provided.