gpu(shadow): add VICTORY_WC_BAR=3 (smart) for small read-only WC buffers #4528

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

@⁠tikD1337 on GitHub · 2026-11-30 21:59 UTC · original
tikD1337:feat/wc-bar-smart → main · +42 −8 · 2 files · 1 commits · closed without merging

Adds VICTORY_WC_BAR=3 (smart), an opt-in mode authored by @⁠POMXARK in #3556 and contributed under GPL-3.0-or-later.

What it does

  • Small buffers (len < wc_no_back_cutoff(), default < 64 KiB): placed directly in CPU-mapped ReBAR VRAM (GPU_UPLOAD) only when (desc.flags & 0x4) == 0 (!D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, i.e., shader read-only buffers). Small UAV-capable buffers (allow_uav == true, such as mip feedback or compute hair) stay two-sided so GPU→CPU write-backs remain intact.
  • Large buffers (len >= wc_no_back_cutoff(), default >= 64 KiB): same policy as VICTORY_WC_BAR=1 regardless of allow_uav.
  • Safety net in gpu_writes / shader_writes: under smart, self.mapped buffers below the cutoff skip the wc_no_back early-drop branch in case a non-UAV buffer receives a GPU copy write.
  • Cleaned up 3 dead_code warnings from the draft diff (#[cfg(test)] on wc_bar_allowed and Buffers::insert, removed unused Shadow::is_guarded).

Discussion #3556 context & acknowledgements

Thank you to everyone in #3556 who investigated, tested, and isolated the bottlenecks leading to this PR:

  • @⁠POMXARK — authored VICTORY_WC_BAR=3 (smart), victory-city-bench, the D3D12Core.dll (23H2) ReBAR finding, FRESH_FIRST, EMISSIVE_FALLBACK, and ran the RTX 5080 (Win 11 22631) --release benchmarks (SUBMIT_SPLIT=1: 73.7 ms frame / 58.5 ms prep -> SUBMIT_SPLIT=1 + WC_BAR=3: 57.5 ms frame / 50.0 ms prep, 23–24 peak / 18–20 interior fps).
  • @⁠Marsietiss — tested MEM_WRITE_WATCH, verified the 23H2 D3D12Core.dll finding, reviewed the memory/copy-back constraints (#4516), and offered to run paired 5080 A/B + picture checks on this PR.
  • @⁠zonehammer — ran the live RTX 4090 VICTORY_GUARD_LEARN A/B tests (48 -> 110 ms / 85 -> 850 MB/f at every asking; 47 -> 52 ms / 85 -> 134 MB/f once per frame), independently confirming the dynamic-buffer over-copy wall and showing that ~43 ms of submitting-thread time sits in per-frame dynamic refreshes/copies/copy-backs.
  • @⁠tikD1337 — tested 0001–0003 (41adb551), WC_BAR=1 / SUBMIT_SPLIT=1 / FRESH_FIRST=1 (84bd61e2), isolated SUBMIT_SPLIT=1 alone (73.5 -> 33.6 ms diag), and verified SUBMIT_SPLIT=1 + WC_BAR=3 in --release (e1251c31).

Local --release verification (RTX 4070 Ti SUPER / Ryzen 5 7600 / 32 GB, Windows 11 26300, driver 621.1.0)

Same binary (e1251c31 + this diff), --console series-s, --dlss quality, warm shader cache, 90 s runs reaching 3D at frame=16384:

Run Frames after 16384 (elapsed) Submit prep median (last 4) refreshes med card_copies / send SUBMIT_SPLIT thread med Texture wait VRAM / Shared
VICTORY_SUBMIT_SPLIT=1 4,402 in 61.3 s (~71.8 f/s) 181.7 ms (135–210) 58.1 ms 42.2 / 0.1 ms 13.4 ms 0.19 f / 8 f 9,441 / 2,450 MB
VICTORY_SUBMIT_SPLIT=1 + VICTORY_WC_BAR=3 5,608 in 57.2 s (~98.1 f/s) 38.8 ms (25.5–28.8) 15.5 ms 0.8 / 0.0 ms 5.9 ms 0.40 f / 30 f 9,147 / 2,179 MB

(Note: visual inspection of meshes/hair/mip feedback in-game with WC_BAR=3 was not captured in that headless log run — @⁠Marsietiss noted they will check the picture on 5080.)

Checks run on this branch (87aae32c)

  • cargo check -p victory-gpu — clean (0 new warnings)
  • cargo test -p victory-gpu --lib -- write_combined_tests — 2 passed, 0 failed (1,197 filtered)
  • cargo test -p victory-gpu --lib -- land_tests — 2 passed, 0 failed, 1 ignored (1,196 filtered)

(AI-assisted PR preparation, cleanup, and log analysis.)

**@⁠tikD1337** on GitHub · 2026-11-30 21:59 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4527) `tikD1337:feat/wc-bar-smart` → `main` · +42 −8 · 2 files · 1 commits · closed without merging Adds `VICTORY_WC_BAR=3` (`smart`), an opt-in mode authored by @⁠POMXARK in #3556 and contributed under `GPL-3.0-or-later`. ### What it does - **Small buffers (`len < wc_no_back_cutoff()`, default `< 64 KiB`):** placed directly in CPU-mapped ReBAR VRAM (`GPU_UPLOAD`) only when `(desc.flags & 0x4) == 0` (`!D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS`, i.e., shader read-only buffers). Small UAV-capable buffers (`allow_uav == true`, such as mip feedback or compute hair) stay two-sided so GPU→CPU write-backs remain intact. - **Large buffers (`len >= wc_no_back_cutoff()`, default `>= 64 KiB`):** same policy as `VICTORY_WC_BAR=1` regardless of `allow_uav`. - **Safety net in `gpu_writes` / `shader_writes`:** under `smart`, `self.mapped` buffers below the cutoff skip the `wc_no_back` early-drop branch in case a non-UAV buffer receives a GPU copy write. - Cleaned up 3 `dead_code` warnings from the draft diff (`#[cfg(test)]` on `wc_bar_allowed` and `Buffers::insert`, removed unused `Shadow::is_guarded`). ### Discussion #3556 context & acknowledgements Thank you to everyone in #3556 who investigated, tested, and isolated the bottlenecks leading to this PR: - **@⁠POMXARK** — authored `VICTORY_WC_BAR=3` (`smart`), `victory-city-bench`, the `D3D12Core.dll` (23H2) ReBAR finding, `FRESH_FIRST`, `EMISSIVE_FALLBACK`, and ran the `RTX 5080` (`Win 11 22631`) `--release` benchmarks (`SUBMIT_SPLIT=1`: `73.7 ms` frame / `58.5 ms` prep -> `SUBMIT_SPLIT=1 + WC_BAR=3`: `57.5 ms` frame / `50.0 ms` prep, `23–24` peak / `18–20` interior fps). - **@⁠Marsietiss** — tested `MEM_WRITE_WATCH`, verified the 23H2 `D3D12Core.dll` finding, reviewed the memory/copy-back constraints (#4516), and offered to run paired 5080 A/B + picture checks on this PR. - **@⁠zonehammer** — ran the live `RTX 4090` `VICTORY_GUARD_LEARN` A/B tests (`48 -> 110 ms` / `85 -> 850 MB/f` at every asking; `47 -> 52 ms` / `85 -> 134 MB/f` once per frame), independently confirming the dynamic-buffer over-copy wall and showing that `~43 ms` of submitting-thread time sits in per-frame dynamic refreshes/copies/copy-backs. - **@⁠tikD1337** — tested `0001`–`0003` (`41adb551`), `WC_BAR=1` / `SUBMIT_SPLIT=1` / `FRESH_FIRST=1` (`84bd61e2`), isolated `SUBMIT_SPLIT=1` alone (`73.5 -> 33.6 ms` diag), and verified `SUBMIT_SPLIT=1 + WC_BAR=3` in `--release` (`e1251c31`). ### Local `--release` verification (`RTX 4070 Ti SUPER / Ryzen 5 7600 / 32 GB`, Windows 11 `26300`, driver `621.1.0`) Same binary (`e1251c31` + this diff), `--console series-s`, `--dlss quality`, warm shader cache, 90 s runs reaching 3D at `frame=16384`: | Run | Frames after `16384` (elapsed) | Submit `prep` median (last 4) | `refreshes` med | `card_copies` / `send` | `SUBMIT_SPLIT` thread med | Texture wait | VRAM / Shared | |---|---:|---:|---:|---:|---:|---:|---:| | `VICTORY_SUBMIT_SPLIT=1` | 4,402 in 61.3 s (`~71.8 f/s`) | 181.7 ms (`135–210`) | 58.1 ms | 42.2 / 0.1 ms | 13.4 ms | **0.19 f / 8 f** | 9,441 / 2,450 MB | | **`VICTORY_SUBMIT_SPLIT=1` + `VICTORY_WC_BAR=3`** | **5,608 in 57.2 s (`~98.1 f/s`)** | **38.8 ms (`25.5–28.8`)** | **15.5 ms** | **0.8 / 0.0 ms** | **5.9 ms** | 0.40 f / 30 f | **9,147 / 2,179 MB** | *(Note: visual inspection of meshes/hair/mip feedback in-game with `WC_BAR=3` was not captured in that headless log run — @⁠Marsietiss noted they will check the picture on 5080.)* ### Checks run on this branch (`87aae32c`) - `cargo check -p victory-gpu` — clean (0 new warnings) - `cargo test -p victory-gpu --lib -- write_combined_tests` — **2 passed, 0 failed** (1,197 filtered) - `cargo test -p victory-gpu --lib -- land_tests` — **2 passed, 0 failed, 1 ignored** (1,196 filtered) *(AI-assisted PR preparation, cleanup, and log analysis.)*
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 22:02:42 +00:00
github-bot force-pushed github-bot/gh-4527 from 87aae32ce6 to 38303dfcf1 2026-12-01 00:35:18 +00:00 Compare
github-bot force-pushed github-bot/gh-4527 from 38303dfcf1 to 5bb09130ec 2026-12-01 00:46:43 +00:00 Compare
Author
Owner

@⁠tikD1337 on GitHub · 2026-12-01 12:34 UTC · original

Quick re-verification & compatibility check on current origin/main (5fabb46e):

  • Clean apply & build: commit 5bb09130 (VICTORY_WC_BAR=3 smart) applies with 0 conflicts onto 5fabb46e even when stacked together with PR #4855 (THIN_PEEPHOLE=1 / SUBMIT_STAGE_SPLIT=1) and #3556's 01/03/04 patches, and builds cleanly in --release.
  • Unit tests: victory-gpu (watch::tests 43/43, peep_ 4/4, host::pipeline::tests 5/5) and victory-hle (xmem::tests::private_32_bit 1/1) PASS.
  • Runtime stability & perf note (RTX 4070 Ti SUPER, Driver 621.1.0, ReBAR ON + Ryzen 5 7600, Win11 26300, DLSS Quality, 105 s steady 3D runs):
    When combined with VICTORY_THIN_PEEPHOLE=1 and LOW_L0_DMA / GUARD_SHARDED / DESC_MIRROR_CAP + SOFT_BATCH (VICTORY_PORT_CONSTANTS=0), the stacked build hit 27.52 FPS steady (36.34 ms/f), 27.90 FPS at 5.5k–6.5k draws (5 s peaks 28.8 FPS), 21.7 FPS at ~10.9k draws, card=21.1 ms (75% busy), card_cp=0.7 ms, across 3/3 105 s runs with 0 crashes.

Cross-notes posted in #3556 and #4856.

**@⁠tikD1337** on GitHub · 2026-12-01 12:34 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4527#issuecomment-7311325899) Quick re-verification & compatibility check on current `origin/main` (`5fabb46e`): - **Clean apply & build:** commit `5bb09130` (`VICTORY_WC_BAR=3` smart) applies with 0 conflicts onto `5fabb46e` even when stacked together with PR `#4855` (`THIN_PEEPHOLE=1` / `SUBMIT_STAGE_SPLIT=1`) and `#3556`'s `01/03/04` patches, and builds cleanly in `--release`. - **Unit tests:** `victory-gpu` (`watch::tests` `43/43`, `peep_` `4/4`, `host::pipeline::tests` `5/5`) and `victory-hle` (`xmem::tests::private_32_bit` `1/1`) **PASS**. - **Runtime stability & perf note (RTX 4070 Ti SUPER, Driver `621.1.0`, ReBAR ON + Ryzen 5 7600, Win11 `26300`, DLSS Quality, 105 s steady 3D runs):** When combined with `VICTORY_THIN_PEEPHOLE=1` and `LOW_L0_DMA` / `GUARD_SHARDED` / `DESC_MIRROR_CAP` + `SOFT_BATCH` (`VICTORY_PORT_CONSTANTS=0`), the stacked build hit **27.52 FPS steady (`36.34 ms/f`)**, **27.90 FPS** at `5.5k–6.5k` draws (5 s peaks **28.8 FPS**), **21.7 FPS** at `~10.9k` draws, `card=21.1 ms` (`75%` busy), `card_cp=0.7 ms`, across 3/3 105 s runs with **0 crashes**. Cross-notes posted in [#3556](https://github.com/trustno1-coder/VIctory-NVIDIA/discussions/3556#discussioncomment-20052952) and [#4856](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/pulls/4856).
github-bot closed this pull request 2026-12-01 18:43:10 +00:00
Author
Owner

@⁠trustno1-coder on GitHub · 2026-12-01 18:38 UTC · original

Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

**@⁠trustno1-coder** on GitHub · 2026-12-01 18:38 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4527#issuecomment-7321263682) Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

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