Clip GPU-read-only PAGE_GRAPHICS_* sub-ranges from shader UAV writes (+16% FPS) #1014

Merged
mikael-jarvinen merged 3 commits from upstream-pr/1014 into main 2026-11-29 08:16:57 +00:00
mikael-jarvinen commented 2026-11-28 11:07:47 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mikael-jarvinen on 2026-11-28T11:07:47Z.


Summary

Tracks Xbox GDK read-only GPU page protections (PAGE_GRAPHICS_READONLY, PAGE_GRAPHICS_EXECUTE, PAGE_GRAPHICS_EXECUTE_READ) from XMemVirtualAlloc (including MEM_REPLACE_PLACEHOLDER) and VirtualProtect, and subtracts those read-only intervals from shader UAV write declarations (Shadow::shader_writes).

Why

On console hardware, a title can reserve a virtual placeholder (MEM_RESERVE_PLACEHOLDER), split it via VirtualFree(..., MEM_PRESERVE_PLACEHOLDER), replace each sub-range via XMemVirtualAlloc(..., MEM_REPLACE_PLACEHOLDER, protect) with different PAGE_GRAPHICS_* protections, and place a single large buffer and raw UAV across adjacent regions of mixed GPU protection.

Specifically, the 174 MiB (0xae00000) heap noted in docs/findings.md spans:

  • 27 MiB (0x1b00000) prefix: PAGE_GRAPHICS_EXECUTE_READ (CPU-written constant/upload ring — hardware GPU-read-only)
  • 147 MiB (0x9300000) suffix: PAGE_GRAPHICS_READWRITE (GPU-writable pools)

Because XMemVirtualAlloc previously returned early on MEM_REPLACE_PLACEHOLDER without noting GPU protection bits, binding one raw UAV over all 174 MiB declared the 27 MiB CPU constant ring as shader-writable. Every CPU upload-buffer fill reading from that prefix then either stalled waiting for in-flight submissions or was diverted into card_steps (~4,000–7,500 fills/frame).

Changes

  • crates/victory-hle/src/modules/xmem.rs: Records read-only GPU protection bits (PAGE_GRAPHICS_READONLY | PAGE_GRAPHICS_EXECUTE | PAGE_GRAPHICS_EXECUTE_READ, without writable bits, and excluding PAGE_GRAPHICS_NOACCESS used on empty placeholder reservations) in XMemVirtualAlloc (both MEM_REPLACE_PLACEHOLDER and normal allocations) and VirtualProtect, aligned to whole 4 KiB host pages; clears stale records on fresh reservations (null-base or fixed-address MEM_RESERVE), writable transitions, and successful MEM_COALESCE_PLACEHOLDERS frees.
  • crates/victory-gpu/src/shadow.rs:
    • Maintains sorted, merged disjoint GPU-read-only intervals (GPU_READONLY) with lock-free atomic min/max bounds for a zero-allocation fast path when a UAV does not overlap any read-only range.
    • Adds Shadow::shader_writes, subtracting GPU-read-only sub-ranges when VICTORY_GPU_RO_SKIP is enabled (on by default; VICTORY_GPU_RO_SKIP=0 disables), while keeping explicit host-recorded CopyBufferRegion destinations on unclipped Shadow::gpu_writes.
    • Adds 4 unit tests (gpu_readonly_tests) covering prefix clipping, middle holes, suffix clipping, merging, splitting, freeing, and zero-length MEM_RELEASE over interior/split sub-ranges.
  • crates/victory-gpu/src/draw.rs & memory.rs: Route root UAV, descriptor-table UAV, and small-buffer shader writes through Shadow::shader_writes.
  • crates/victory-gpu/src/host.rs: Adds VICTORY_GPU_RO_CHECK=1 verification mode (CardPlan::check_gpu_ro) to keep full ranges declared and warn if any compared, non-picked 64 KiB piece that changed on the card overlaps a GPU-read-only region; reports clipped MB/frame (GPU_RO_LEFT) alongside VICTORY_WC_NO_BACK.
  • crates/victory-gpu/src/lib.rs & watch.rs: Exports title_memory_gpu_readonly / title_memory_gpu_writable and resolves zero-length MEM_RELEASE allocation extents via allocation_end (VirtualQuery) before clearing intervals in title_memory_freed.
  • docs/findings.md & docs/README-foxhound.md: Documents the mechanism, switches (VICTORY_GPU_RO_SKIP, VICTORY_GPU_RO_CHECK), and A/B benchmark results.

Verification & A/B Benchmarks

Scope of FPS impact: While card_steps fills drop ~4× across tested profiles, net FPS depends on whether flight waits / card_steps planning are a frame-time bottleneck:

  • High-draw Series X 1440p + DLSS runs with non-trivial flight waits saw +11–16% FPS (and +4–21% on >=7k draw frames).
  • Lower-fill Series S (DLSS off) runs saw ~4× fewer fills with neutral FPS.
  • On setups where waiting for flights is already ~0.1 ms at baseline (e.g., fast GPU + VICTORY_WAIT_RESIDENT=0 on lighter 1k–7k draw frames), moving dirty ring pages from byte-diffed merge_under_writes to whole-page Shadow::copy_stale and moving fills back to CPU copy_mapped can shift work onto CPU steps (VICTORY_GPU_RO_SKIP=0 disables).

Tested on Windows 11, NVIDIA GeForce RTX 3080 10 GB (driver 621.14), Series X profile, 2560×1440 output, release build, warm shader/pipeline cache (0 pipelines compiling), frame generation off, identical scripted startup/cutscene/world sequence (115–120 s per run).

Correctness (VICTORY_GPU_RO_CHECK=1, diagnostics build)

  • Confirmed the exact 3 GPU-read-only regions (0xa00000, 0x100000, and the 0x1b00000 / 27 MiB prefix of the 174 MiB buffer).
  • 0 warnings across boot, menu, cutscene, and gameplay (~320 GPU compare passes/frame): zero GPU writes ever touched any compared, non-picked 64 KiB piece inside a GPU-read-only region. (Note: VICTORY_GPU_RO_CHECK=1 checks compared non-picked card ranges; write-combined and uncompared writes are not covered by this diagnostic.)

DLSS Performance (2560×1440 output, 1280×720 internal — CPU/submission-bound)

Metric (3D world & cutscene) VICTORY_GPU_RO_SKIP=0 VICTORY_GPU_RO_SKIP=1 Delta
Median FPS 20.80 24.15 +16.1%
Median frame time 48.00 ms 41.45 ms −6.55 ms
Steady gameplay (~5,050 draws/frame) 21.7 fps (46.0 ms) 24.6–25.2 fps (39.8–40.6 ms) +15–16%
Total DLSS frames rendered (115 s) 1,547 1,828 +18.2%
Submit-thread preparing (median / late) 44.30 / 49.0 ms 40.00 / 35.5 ms −4.3 to −13.5 ms
waiting for flights (median / gameplay) 2.90 / 8.6 ms 0.90 / 0.4–0.6 ms −69% to −94%
planning card_steps (median) 3.10 ms 1.60 ms −48.4%
card_steps fills/frame (median) 3,986 1,023 −74.3%
merge_under_writes (median) 2.30 ms 1.50 ms −34.8%
Card upload ranges/frame (median) 16,383 4,855 −70.4%
Card pieces compared/frame (median) 6,421 5,555 −13.5%
GPU-RO UAV bytes clipped (median) 0.0 MB/frame 206.4 MB/frame —

Native 2560×1440 (--dlss off — GPU-bound in 5,000-draw scenes)

Metric (3D world & cutscene) VICTORY_GPU_RO_SKIP=0 VICTORY_GPU_RO_SKIP=1 Delta
Median FPS 13.70 14.50 +5.8%
Submit-thread preparing (median) 75.60 ms 65.00 ms −10.60 ms (−14.0%)
waiting for flights (median) 35.70 ms 20.50 ms −15.20 ms (−42.6%)
planning card_steps (median) 4.50 ms 2.40 ms −46.7%
card_steps fills/frame (median) 6,499 1,510 −76.8%
Card upload ranges/frame (median) 3,462 656 −81.0%

Independent Community A/B Results

  • @Bj0rnis (RTX 5070 Ti 16 GB + Ryzen 7 9800X3D, Series X, 1440p DLSS Quality): card_steps fills −76.1% / −85.3% KB (4,494 → 1,072), planning card_steps −53.1% (3.2 → 1.5 ms), preparing −8.3% (32.7 → 30.0 ms), mid-scene gameplay +11.2% FPS (27.6 → 30.7), peak +11.6% (36.3 → 40.5), clean visuals & 0 faults.
  • @urielbeaupre (RTX 4070 Ti 12 GB + Ryzen 9 7900X, Series S, DLSS off, alternated 1/0/1/0): card_steps fills ~4× lower (1,685–1,939 → 375–479), clean visuals, no FPS change (35.2 vs 35.2 cutscene, +0.85 fps after scene change — within noise, as fills are not the bottleneck on Series S with DLSS off).
  • @POMXARK (RTX 5080 16 GB + Ryzen 7 5700X, Series X 1440p DLSS Quality + MFG 4×, VICTORY_WAIT_RESIDENT=0, VICTORY_LAND_SKIP=1, 20-min 3D A/B): 0 errors / clean visuals, card_steps fills −79.7%, upload ranges −66.5%, strong gains on heavy scenes (7k–10k +4.1%, >=10k +21.3%), net regression on 1k–7k draw frames (−4.5% to −11.4%) where waiting for flights was already 0.1 ms and CPU steps grew (refreshes +5.6 ms, copies&fills +2.6 ms).

Automated Checks

  • cargo test -p victory-gpu --lib: 457 passed, 0 failed (including 4 gpu_readonly_tests)
  • cargo test -p victory-hle --lib: 189 passed, 0 failed, 3 ignored (including gpu_protection_page_alignment)
  • cargo clippy -p victory-gpu -p victory-hle --all-targets & --all-features: 0 new warnings
  • cargo xtask policy: 294 files ok
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5539482127 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1014). Originally posted by [mikael-jarvinen](https://github.com/mikael-jarvinen) on 2026-11-28T11:07:47Z. --- ## Summary Tracks Xbox GDK read-only GPU page protections (`PAGE_GRAPHICS_READONLY`, `PAGE_GRAPHICS_EXECUTE`, `PAGE_GRAPHICS_EXECUTE_READ`) from `XMemVirtualAlloc` (including `MEM_REPLACE_PLACEHOLDER`) and `VirtualProtect`, and subtracts those read-only intervals from shader UAV write declarations (`Shadow::shader_writes`). ### Why On console hardware, a title can reserve a virtual placeholder (`MEM_RESERVE_PLACEHOLDER`), split it via `VirtualFree(..., MEM_PRESERVE_PLACEHOLDER)`, replace each sub-range via `XMemVirtualAlloc(..., MEM_REPLACE_PLACEHOLDER, protect)` with different `PAGE_GRAPHICS_*` protections, and place a single large buffer and raw UAV across adjacent regions of mixed GPU protection. Specifically, the 174 MiB (`0xae00000`) heap noted in `docs/findings.md` spans: - **27 MiB (`0x1b00000`) prefix:** `PAGE_GRAPHICS_EXECUTE_READ` (CPU-written constant/upload ring — hardware GPU-read-only) - **147 MiB (`0x9300000`) suffix:** `PAGE_GRAPHICS_READWRITE` (GPU-writable pools) Because `XMemVirtualAlloc` previously returned early on `MEM_REPLACE_PLACEHOLDER` without noting GPU protection bits, binding one raw UAV over all 174 MiB declared the 27 MiB CPU constant ring as shader-writable. Every CPU upload-buffer fill reading from that prefix then either stalled waiting for in-flight submissions or was diverted into `card_steps` (~4,000–7,500 fills/frame). ## Changes - **`crates/victory-hle/src/modules/xmem.rs`**: Records read-only GPU protection bits (`PAGE_GRAPHICS_READONLY | PAGE_GRAPHICS_EXECUTE | PAGE_GRAPHICS_EXECUTE_READ`, without writable bits, and excluding `PAGE_GRAPHICS_NOACCESS` used on empty placeholder reservations) in `XMemVirtualAlloc` (both `MEM_REPLACE_PLACEHOLDER` and normal allocations) and `VirtualProtect`, aligned to whole 4 KiB host pages; clears stale records on fresh reservations (null-base or fixed-address `MEM_RESERVE`), writable transitions, and successful `MEM_COALESCE_PLACEHOLDERS` frees. - **`crates/victory-gpu/src/shadow.rs`**: - Maintains sorted, merged disjoint GPU-read-only intervals (`GPU_READONLY`) with lock-free atomic min/max bounds for a zero-allocation fast path when a UAV does not overlap any read-only range. - Adds `Shadow::shader_writes`, subtracting GPU-read-only sub-ranges when `VICTORY_GPU_RO_SKIP` is enabled (on by default; `VICTORY_GPU_RO_SKIP=0` disables), while keeping explicit host-recorded `CopyBufferRegion` destinations on unclipped `Shadow::gpu_writes`. - Adds 4 unit tests (`gpu_readonly_tests`) covering prefix clipping, middle holes, suffix clipping, merging, splitting, freeing, and zero-length `MEM_RELEASE` over interior/split sub-ranges. - **`crates/victory-gpu/src/draw.rs` & `memory.rs`**: Route root UAV, descriptor-table UAV, and small-buffer shader writes through `Shadow::shader_writes`. - **`crates/victory-gpu/src/host.rs`**: Adds `VICTORY_GPU_RO_CHECK=1` verification mode (`CardPlan::check_gpu_ro`) to keep full ranges declared and warn if any compared, non-picked 64 KiB piece that changed on the card overlaps a GPU-read-only region; reports clipped MB/frame (`GPU_RO_LEFT`) alongside `VICTORY_WC_NO_BACK`. - **`crates/victory-gpu/src/lib.rs` & `watch.rs`**: Exports `title_memory_gpu_readonly` / `title_memory_gpu_writable` and resolves zero-length `MEM_RELEASE` allocation extents via `allocation_end` (`VirtualQuery`) before clearing intervals in `title_memory_freed`. - **`docs/findings.md` & `docs/README-foxhound.md`**: Documents the mechanism, switches (`VICTORY_GPU_RO_SKIP`, `VICTORY_GPU_RO_CHECK`), and A/B benchmark results. ## Verification & A/B Benchmarks > **Scope of FPS impact:** While `card_steps` fills drop ~4× across tested profiles, net FPS depends on whether flight waits / `card_steps` planning are a frame-time bottleneck: > - High-draw Series X 1440p + DLSS runs with non-trivial flight waits saw **+11–16% FPS** (and **+4–21%** on `>=7k` draw frames). > - Lower-fill Series S (DLSS off) runs saw **~4× fewer fills with neutral FPS**. > - On setups where `waiting for flights` is already ~0.1 ms at baseline (e.g., fast GPU + `VICTORY_WAIT_RESIDENT=0` on lighter `1k–7k` draw frames), moving dirty ring pages from byte-diffed `merge_under_writes` to whole-page `Shadow::copy_stale` and moving fills back to CPU `copy_mapped` can shift work onto CPU `steps` (`VICTORY_GPU_RO_SKIP=0` disables). Tested on Windows 11, **NVIDIA GeForce RTX 3080 10 GB** (driver 621.14), Series X profile, 2560×1440 output, release build, warm shader/pipeline cache (`0` pipelines compiling), frame generation off, identical scripted startup/cutscene/world sequence (115–120 s per run). ### Correctness (`VICTORY_GPU_RO_CHECK=1`, diagnostics build) - Confirmed the exact 3 GPU-read-only regions (`0xa00000`, `0x100000`, and the `0x1b00000` / 27 MiB prefix of the 174 MiB buffer). - **`0` warnings** across boot, menu, cutscene, and gameplay (~320 GPU compare passes/frame): zero GPU writes ever touched any compared, non-picked 64 KiB piece inside a GPU-read-only region. *(Note: `VICTORY_GPU_RO_CHECK=1` checks compared non-picked card ranges; write-combined and uncompared writes are not covered by this diagnostic.)* ### DLSS Performance (2560×1440 output, 1280×720 internal — CPU/submission-bound) | Metric (3D world & cutscene) | `VICTORY_GPU_RO_SKIP=0` | `VICTORY_GPU_RO_SKIP=1` | Delta | |---|---:|---:|---:| | **Median FPS** | 20.80 | **24.15** | **+16.1%** | | **Median frame time** | 48.00 ms | **41.45 ms** | **−6.55 ms** | | **Steady gameplay (~5,050 draws/frame)** | 21.7 fps (46.0 ms) | **24.6–25.2 fps (39.8–40.6 ms)** | **+15–16%** | | **Total DLSS frames rendered (115 s)** | 1,547 | **1,828** | **+18.2%** | | **Submit-thread `preparing` (median / late)** | 44.30 / 49.0 ms | **40.00 / 35.5 ms** | **−4.3 to −13.5 ms** | | **`waiting for flights` (median / gameplay)** | 2.90 / 8.6 ms | **0.90 / 0.4–0.6 ms** | **−69% to −94%** | | **`planning card_steps` (median)** | 3.10 ms | **1.60 ms** | **−48.4%** | | **`card_steps` fills/frame (median)** | 3,986 | **1,023** | **−74.3%** | | **`merge_under_writes` (median)** | 2.30 ms | **1.50 ms** | **−34.8%** | | **Card upload ranges/frame (median)** | 16,383 | **4,855** | **−70.4%** | | **Card pieces compared/frame (median)** | 6,421 | **5,555** | **−13.5%** | | **GPU-RO UAV bytes clipped (median)** | 0.0 MB/frame | **206.4 MB/frame** | — | ### Native 2560×1440 (`--dlss off` — GPU-bound in 5,000-draw scenes) | Metric (3D world & cutscene) | `VICTORY_GPU_RO_SKIP=0` | `VICTORY_GPU_RO_SKIP=1` | Delta | |---|---:|---:|---:| | **Median FPS** | 13.70 | **14.50** | **+5.8%** | | **Submit-thread `preparing` (median)** | 75.60 ms | **65.00 ms** | **−10.60 ms (−14.0%)** | | **`waiting for flights` (median)** | 35.70 ms | **20.50 ms** | **−15.20 ms (−42.6%)** | | **`planning card_steps` (median)** | 4.50 ms | **2.40 ms** | **−46.7%** | | **`card_steps` fills/frame (median)** | 6,499 | **1,510** | **−76.8%** | | **Card upload ranges/frame (median)** | 3,462 | **656** | **−81.0%** | ### Independent Community A/B Results - **@Bj0rnis** (RTX 5070 Ti 16 GB + Ryzen 7 9800X3D, **Series X, 1440p DLSS Quality**): `card_steps` fills **−76.1% / −85.3% KB** (`4,494 → 1,072`), `planning card_steps` **−53.1%** (`3.2 → 1.5 ms`), `preparing` **−8.3%** (`32.7 → 30.0 ms`), mid-scene gameplay **+11.2% FPS** (`27.6 → 30.7`), peak **+11.6%** (`36.3 → 40.5`), clean visuals & `0` faults. - **@urielbeaupre** (RTX 4070 Ti 12 GB + Ryzen 9 7900X, **Series S, DLSS off**, alternated 1/0/1/0): `card_steps` fills **~4× lower** (`1,685–1,939 → 375–479`), clean visuals, **no FPS change** (`35.2 vs 35.2` cutscene, `+0.85` fps after scene change — within noise, as fills are not the bottleneck on Series S with DLSS off). - **@POMXARK** (RTX 5080 16 GB + Ryzen 7 5700X, **Series X 1440p DLSS Quality + MFG 4×, `VICTORY_WAIT_RESIDENT=0`, `VICTORY_LAND_SKIP=1`, 20-min 3D A/B**): 0 errors / clean visuals, `card_steps` fills **−79.7%**, upload ranges **−66.5%**, strong gains on heavy scenes (`7k–10k` **+4.1%**, `>=10k` **+21.3%**), net regression on `1k–7k` draw frames (`−4.5%` to `−11.4%`) where `waiting for flights` was already `0.1 ms` and CPU `steps` grew (`refreshes +5.6 ms`, `copies&fills +2.6 ms`). ### Automated Checks - `cargo test -p victory-gpu --lib`: 457 passed, 0 failed (including 4 `gpu_readonly_tests`) - `cargo test -p victory-hle --lib`: 189 passed, 0 failed, 3 ignored (including `gpu_protection_page_alignment`) - `cargo clippy -p victory-gpu -p victory-hle --all-targets` & `--all-features`: 0 new warnings - `cargo xtask policy`: 294 files ok
Bj0rnis commented 2026-11-28 12:30:52 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Bj0rnis on 2026-11-28T12:30:52Z.


Independent RTX 5070 Ti 16 GB + Ryzen 7 9800X3D verification on 259c9930 vs main (63b902f), Windows 11, driver 621.24, Rust 1.98.1, --release build from source, Series X profile, 2560×1440, DLSS Quality, Frame Generation off, warm shader/pipeline cache (VICTORY_HOST_WAVE=32), manual opening → prison cell → break room runs.

Metric (log medians across 200+ samples) main (63b902f) PR #1014 (259c9930) Delta
GPU-RO UAV clipped / frame 0.0 MB 311.4 MB (max 368.1 MB) —
card_steps fills / frame 4,494.0 (1,757.3 KB) 1,072.2 (257.9 KB) −76.1% / −85.3% KB
Submit-thread planning card_steps 3.2 ms 1.5 ms −53.1% (−1.7 ms)
Submit-thread waiting for flights 0.8 ms (break room: 2.4–5.8 ms) 0.5 ms (break room: 0.7–0.8 ms) −37.5% (−75%+ in break room)
Submit-thread total preparing 32.7 ms 30.0 ms −8.3% (−2.7 ms)
Mid-scene gameplay (3.5k–6.5k draws, avg ~4.9k) 27.6 fps (36.3 ms) 30.7 fps (33.6 ms) +11.2% FPS
Peak gameplay FPS 36.3 fps 40.5 fps +11.6%
Device removed / OOM 0 / 0 0 / 0 Clean

Visuals rendered cleanly with no new glitches or corruption observed (break-room memory stayed at 27.4 GB RAM / 12.9 of 14.5 GB VRAM; note break-room camera angle had ~10% more draws in the PR run [10,231 vs 9,301], though submit-thread prep still improved from 30.3–35.8 ms to 28.9–30.4 ms).

Automated checks: Clean merge-tree on 63b902f; cargo test --locked -p victory-gpu --lib gpu_readonly_tests 3/3 passed; cargo xtask policy 294 files ok; cargo test --locked -p victory-hle --lib 187 passed (1 NTFS hard-link test failed only due to restricted sandbox temp dir).

Not tested: VICTORY_GPU_RO_CHECK=1 diagnostics build or VICTORY_GPU_RO_SKIP=0 on the PR binary directly (compared against main 63b902f). No game data, logs, or captures attached.

AI-assisted test run and summary.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7239279235 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1014#issuecomment-7239279235). Originally posted by [Bj0rnis](https://github.com/Bj0rnis) on 2026-11-28T12:30:52Z. --- Independent RTX 5070 Ti 16 GB + Ryzen 7 9800X3D verification on `259c9930` vs `main` (`63b902f`), Windows 11, driver `621.24`, Rust 1.98.1, `--release` build from source, Series X profile, 2560×1440, DLSS Quality, Frame Generation off, warm shader/pipeline cache (`VICTORY_HOST_WAVE=32`), manual opening → prison cell → break room runs. | Metric (log medians across 200+ samples) | `main` (`63b902f`) | PR `#1014` (`259c9930`) | Delta | |---|---:|---:|---:| | **GPU-RO UAV clipped / frame** | 0.0 MB | **311.4 MB** (max 368.1 MB) | — | | **`card_steps` fills / frame** | 4,494.0 (1,757.3 KB) | **1,072.2** (257.9 KB) | **−76.1% / −85.3% KB** | | **Submit-thread `planning card_steps`** | 3.2 ms | **1.5 ms** | **−53.1% (−1.7 ms)** | | **Submit-thread `waiting for flights`** | 0.8 ms (break room: 2.4–5.8 ms) | **0.5 ms** (break room: 0.7–0.8 ms) | **−37.5%** (−75%+ in break room) | | **Submit-thread total `preparing`** | 32.7 ms | **30.0 ms** | **−8.3% (−2.7 ms)** | | **Mid-scene gameplay (`3.5k–6.5k` draws, avg ~4.9k)** | 27.6 fps (36.3 ms) | **30.7 fps** (33.6 ms) | **+11.2% FPS** | | **Peak gameplay FPS** | 36.3 fps | **40.5 fps** | **+11.6%** | | **Device removed / OOM** | 0 / 0 | **0 / 0** | Clean | Visuals rendered cleanly with no new glitches or corruption observed (break-room memory stayed at 27.4 GB RAM / 12.9 of 14.5 GB VRAM; note break-room camera angle had ~10% more draws in the PR run [`10,231` vs `9,301`], though submit-thread prep still improved from `30.3–35.8 ms` to `28.9–30.4 ms`). **Automated checks:** Clean merge-tree on `63b902f`; `cargo test --locked -p victory-gpu --lib gpu_readonly_tests` **3/3 passed**; `cargo xtask policy` **294 files ok**; `cargo test --locked -p victory-hle --lib` 187 passed (1 NTFS hard-link test failed only due to restricted sandbox temp dir). *Not tested:* `VICTORY_GPU_RO_CHECK=1` diagnostics build or `VICTORY_GPU_RO_SKIP=0` on the PR binary directly (compared against `main` `63b902f`). No game data, logs, or captures attached. *AI-assisted test run and summary.*
urielbeaupre commented 2026-11-28 12:43:39 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by urielbeaupre on 2026-11-28T12:43:39Z.


An A/B on a different setup: RTX 4070 Ti 12 GB, Ryzen 9 7900X, Series S profile, DLSS off. This PR's head (259c993, based on current main), one build, VICTORY_GPU_RO_SKIP alternated 1/0/1/0, same save, warm cache. Seconds 60–110 after input are a cutscene; 110–165 come after the scene change. About 10 readings each.

Run VICTORY_GPU_RO_SKIP cutscene fps CPU preparing after scene change card_steps fills/frame
1 1 35.3 27.8 ms 23.1 375
2 0 34.5 23.2 ms 22.8 1,685
3 1 35.1 24.2 ms 23.9 479
4 0 35.9 22.1 ms 22.5 1,939
  • The mechanism does what you describe here too: card_steps fills drop about 4×.
  • No fps change on this setup. The cutscene averages are 35.2 vs 35.2. After the scene change it's +0.85 fps, within run-to-run noise. The CPU preparing time didn't go down.
  • No visual problems. Draw counts match between on and off runs (about 1,400 in the cutscene, 2,900–3,700 after), and the same scenes look the same by eye.

So the gain looks tied to setups where those fills are expensive, like Series X at 1440p with DLSS on your RTX 3080. With Series S and DLSS off, the fills don't seem to be the limit. That might be worth a line in the description.

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7239425143 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1014#issuecomment-7239425143). Originally posted by [urielbeaupre](https://github.com/urielbeaupre) on 2026-11-28T12:43:39Z. --- An A/B on a different setup: RTX 4070 Ti 12 GB, Ryzen 9 7900X, **Series S profile, DLSS off**. This PR's head (259c993, based on current main), one build, `VICTORY_GPU_RO_SKIP` alternated 1/0/1/0, same save, warm cache. Seconds 60–110 after input are a cutscene; 110–165 come after the scene change. About 10 readings each. | Run | `VICTORY_GPU_RO_SKIP` | cutscene fps | CPU preparing | after scene change | `card_steps` fills/frame | |---|---|---|---|---|---| | 1 | 1 | 35.3 | 27.8 ms | 23.1 | 375 | | 2 | 0 | 34.5 | 23.2 ms | 22.8 | 1,685 | | 3 | 1 | 35.1 | 24.2 ms | 23.9 | 479 | | 4 | 0 | 35.9 | 22.1 ms | 22.5 | 1,939 | - The mechanism does what you describe here too: `card_steps` fills drop about 4×. - **No fps change on this setup.** The cutscene averages are 35.2 vs 35.2. After the scene change it's +0.85 fps, within run-to-run noise. The CPU preparing time didn't go down. - No visual problems. Draw counts match between on and off runs (about 1,400 in the cutscene, 2,900–3,700 after), and the same scenes look the same by eye. So the gain looks tied to setups where those fills are expensive, like Series X at 1440p with DLSS on your RTX 3080. With Series S and DLSS off, the fills don't seem to be the limit. That might be worth a line in the description. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
CuteBooty commented 2026-11-28 13:39:54 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by CuteBooty on 2026-11-28T13:39:54Z.


A review note from reading the diff, before I run it. I have not tested it.

shadow.rs:gpu_readonly_freed(at, len) with len == 0 only drops intervals that start exactly at at:

all.retain(|&(a, _)| a != start);

A zero length is the normal case: xmem.rs's free path calls victory_gpu::title_memory_freed(address, size), and a MEM_RELEASE passes size 0 for "the whole allocation at at" (the comment on watch.rs:title_memory_freed says so). So a read-only interval that sits inside a released reservation, but does not start at its base, survives the release. That covers a read-only sub-range replaced into the middle of a placeholder, or one left after title_memory_gpu_writable split a merged interval.

If the title then maps writable memory at that address, through an allocation without GPU protection bits, or a fixed-address reuse that doesn't pass the null-base clear in XMemVirtualAlloc, Shadow::shader_writes would still subtract the stale interval. A real UAV write there would then lose its hazard tracking and copy-back, and the CPU would read stale bytes.

The test gpu_readonly_freed(base + 0x2_0000, 0) frees at the interval's own start, so it doesn't cover this.

A test that should fail as written:

  1. Mark an interior page read-only.
  2. Call gpu_readonly_freed(base, 0) for the whole reservation.
  3. Assert that writable_subranges(base, total) gives back the whole range.

Possible fixes:

  • Keep each reservation's extent, so that a zero-length release can clear [base, base + extent).
  • Or have the release path pass the real size it freed. The HLE knows it from its own allocation book.

Two smaller points from the same read:

  • title_virtual_protect notes the requested bytes, not the whole pages a protection change affects.
  • CardPlan::check_gpu_ro (VICTORY_GPU_RO_CHECK=1) runs only on non-picked, compared card ranges. Write-combined and uncompared writes would not trip it, so zero warnings don't rule this case out.

(Read with my AI assistants, Claude Code and Codex; nothing run yet.)

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7240096866 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1014#issuecomment-7240096866). Originally posted by [CuteBooty](https://github.com/CuteBooty) on 2026-11-28T13:39:54Z. --- A review note from reading the diff, before I run it. I have not tested it. `shadow.rs:gpu_readonly_freed(at, len)` with `len == 0` only drops intervals that start exactly at `at`: ```rust all.retain(|&(a, _)| a != start); ``` A zero length is the normal case: `xmem.rs`'s free path calls `victory_gpu::title_memory_freed(address, size)`, and a `MEM_RELEASE` passes size 0 for "the whole allocation at `at`" (the comment on `watch.rs:title_memory_freed` says so). So a read-only interval that sits inside a released reservation, but does not start at its base, survives the release. That covers a read-only sub-range replaced into the middle of a placeholder, or one left after `title_memory_gpu_writable` split a merged interval. If the title then maps writable memory at that address, through an allocation without GPU protection bits, or a fixed-address reuse that doesn't pass the null-base clear in `XMemVirtualAlloc`, `Shadow::shader_writes` would still subtract the stale interval. A real UAV write there would then lose its hazard tracking and copy-back, and the CPU would read stale bytes. The test `gpu_readonly_freed(base + 0x2_0000, 0)` frees at the interval's own start, so it doesn't cover this. **A test that should fail as written:** 1. Mark an interior page read-only. 2. Call `gpu_readonly_freed(base, 0)` for the whole reservation. 3. Assert that `writable_subranges(base, total)` gives back the whole range. **Possible fixes:** - Keep each reservation's extent, so that a zero-length release can clear `[base, base + extent)`. - Or have the release path pass the real size it freed. The HLE knows it from its own allocation book. Two smaller points from the same read: - `title_virtual_protect` notes the requested bytes, not the whole pages a protection change affects. - `CardPlan::check_gpu_ro` (`VICTORY_GPU_RO_CHECK=1`) runs only on non-picked, compared card ranges. Write-combined and uncompared writes would not trip it, so zero warnings don't rule this case out. (Read with my AI assistants, Claude Code and Codex; nothing run yet.)
POMXARK commented 2026-11-28 13:41:06 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by POMXARK on 2026-11-28T13:41:06Z.


Tested this PR in a full 20-minute 3D A/B run on Windows 11 (8C/16T CPU + RTX 5080 + DLSS Quality + MFG 4x) — mixed result: 0 errors and strong gains on heavy draw workloads (7k–10k +4.1%, >=10k +21.3%) with -79.7% card_steps fills and -66.5% upload ranges, but a net regression on lighter/mid draw workloads (1k–7k) and 1s frame_times tails because CPU steps (refreshes + copies and fills) grew by +10.0 ms.

Setup

  • Hardware: AMD Ryzen 7 5700X (8C/16T), NVIDIA RTX 5080 16 GB, 32 GB RAM, Windows 11.
  • Profile / flags: Series X 1440p, DLSS Quality + DLSS MFG 4x (tearing=true), default 4 MiB windows, VICTORY_GPU_BCPACK=0, VICTORY_WAIT_RESIDENT=0, VICTORY_TEXTURE_ROOM_PERCENT=70, VICTORY_LAND_SKIP=1, default VICTORY_GPU_RO_SKIP=1.
  • Base: Local fork based on v2026.11.27.10 (8fc2254) + AVX2/ThinLTO + PR #516 + PR #340 + PR #81 + PR #666 + AVX2 Shadow::take / PR #498 + PR #801 + PR #834 + lock-free nothing_new_with / wide_chunks(32) (6df0ae5).
  • Unit tests: shadow:: (42/42 including all 3 gpu_readonly_tests) and victory-hle (188/188) passed.

20-Minute 3D A/B Results (Strict 3D-only, Draw-Count-Matched)

Metric Baseline (6df0ae5, 20m) + PR #1014 (VICTORY_GPU_RO_SKIP=1, 20m) Delta
Errors / DevRem / Exceptions 0 / 0 / 0 0 / 0 / 0 Clean
GPU-RO UAV bytes clipped (p50) 0.0 MB/frame 311.4 MB/frame (28.3 MB prefix) Active
card_steps fills/frame (p50) 3,514 714 -79.7%
Card upload ranges/frame (p50) 38,862 13,034 -66.5%
Card pieces compared/frame (p50) 6,325 5,449 -13.9%
planning card_steps / under (p50) 4.2 ms / 4.4 ms 1.7 ms / 2.7 ms -2.5 ms / -1.7 ms
steps: refreshes / copies&fills (p50) 22.5 ms / 2.4 ms 28.1 ms / 5.0 ms +5.6 ms / +2.6 ms
Card upload volume (p50) 22.5 MB/frame 26.4 MB/frame +3.9 MB
1s frame_times (3D) 65.4 med / 85.9 p95 / 97.7 p99 (1,354 >100ms) 68.8 med / 93.2 p95 / 105.0 p99 (1,764 >100ms) p95 +7.3 ms, >100ms +30.3%
ALL 3D (n=167 / 170) 13.9 p50 / 13.91 mean (Prep 58.1 ms) 12.2 p50 / 12.73 mean (Prep 67.8 ms) -12.2% p50 (Prep +9.7 ms)
1k–4k draws/frame (n=103 / 96) 17.50 p50 (copies 19.6 ms) 15.50 p50 (copies 28.8 ms) -11.4% (copies +9.2 ms)
4k–7k draws/frame (n=46 / 46) 13.40 p50 (copies 29.9 ms) 12.80 p50 (copies 34.8 ms) -4.5%
7k–10k draws/frame (n=34 / 37) 11.05 p50 / 11.06 mean (90.4 ms) 11.50 p50 / 11.54 mean (86.9 ms) +4.1%
>=10k draws/frame (n=5 / 6) 8.00 p50 (copies 73.3 ms) 9.70 p50 (copies 55.5 ms) +21.3% (copies -17.8 ms)

Key Observation

  • On this setup, waiting for flights was already 0.1 ms at baseline (with VICTORY_WAIT_RESIDENT=0 and fast RTX 5080), so clipping the 28.3 MB GPU-RO prefix did not recover large flight-wait time here.
  • Instead, diverting ~2,800 fills/frame away from card_steps shifted work back onto CPU steps (refreshes 22.5 -> 28.1 ms, copies&fills 2.4 -> 5.0 ms, card_up_MB 22.5 -> 26.4 MB). That is a clear win in heavy >=7k draw workloads (+4.1% / +21.3%), but slowed 1k–7k draw workloads on an 8C/16T CPU.
  • Correctness was spotless across the full 20 minutes (0 errors, 0 visual glitches).
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7240111205 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1014#issuecomment-7240111205). Originally posted by [POMXARK](https://github.com/POMXARK) on 2026-11-28T13:41:06Z. --- Tested this PR in a full 20-minute 3D A/B run on Windows 11 (8C/16T CPU + RTX 5080 + DLSS Quality + MFG 4x) — **mixed result: 0 errors and strong gains on heavy draw workloads (`7k–10k` `+4.1%`, `>=10k` `+21.3%`) with `-79.7%` `card_steps` fills and `-66.5%` upload ranges, but a net regression on lighter/mid draw workloads (`1k–7k`) and `1s frame_times` tails because CPU `steps` (`refreshes` + `copies and fills`) grew by `+10.0 ms`**. ### Setup - **Hardware:** AMD Ryzen 7 5700X (8C/16T), NVIDIA RTX 5080 16 GB, 32 GB RAM, Windows 11. - **Profile / flags:** Series X 1440p, DLSS Quality + DLSS MFG 4x (`tearing=true`), default `4 MiB` windows, `VICTORY_GPU_BCPACK=0`, `VICTORY_WAIT_RESIDENT=0`, `VICTORY_TEXTURE_ROOM_PERCENT=70`, `VICTORY_LAND_SKIP=1`, default `VICTORY_GPU_RO_SKIP=1`. - **Base:** Local fork based on `v2026.11.27.10` (`8fc2254`) + AVX2/ThinLTO + PR #516 + PR #340 + PR #81 + PR #666 + AVX2 `Shadow::take` / PR #498 + PR #801 + PR #834 + lock-free `nothing_new_with` / `wide_chunks(32)` (`6df0ae5`). - **Unit tests:** `shadow::` (42/42 including all 3 `gpu_readonly_tests`) and `victory-hle` (188/188) passed. ### 20-Minute 3D A/B Results (Strict 3D-only, Draw-Count-Matched) | Metric | Baseline (`6df0ae5`, 20m) | + PR #1014 (`VICTORY_GPU_RO_SKIP=1`, 20m) | Delta | | :--- | ---: | ---: | ---: | | **Errors / DevRem / Exceptions** | `0 / 0 / 0` | `0 / 0 / 0` | Clean | | **GPU-RO UAV bytes clipped (p50)** | `0.0 MB/frame` | `311.4 MB/frame` (`28.3 MB` prefix) | Active | | **`card_steps` fills/frame (p50)** | `3,514` | `714` | **`-79.7%`** | | **Card upload ranges/frame (p50)** | `38,862` | `13,034` | **`-66.5%`** | | **Card pieces compared/frame (p50)** | `6,325` | `5,449` | **`-13.9%`** | | **`planning card_steps` / `under` (p50)** | `4.2 ms` / `4.4 ms` | `1.7 ms` / `2.7 ms` | **`-2.5 ms`** / **`-1.7 ms`** | | **`steps`: `refreshes` / `copies&fills` (p50)** | `22.5 ms` / `2.4 ms` | `28.1 ms` / `5.0 ms` | **`+5.6 ms`** / **`+2.6 ms`** | | **Card upload volume (p50)** | `22.5 MB/frame` | `26.4 MB/frame` | `+3.9 MB` | | **1s `frame_times` (3D)** | `65.4` med / `85.9` p95 / `97.7` p99 (`1,354` >100ms) | `68.8` med / `93.2` p95 / `105.0` p99 (`1,764` >100ms) | `p95 +7.3 ms`, `>100ms +30.3%` | | **ALL 3D** (`n=167 / 170`) | `13.9` p50 / `13.91` mean (`Prep 58.1 ms`) | `12.2` p50 / `12.73` mean (`Prep 67.8 ms`) | `-12.2%` p50 (`Prep +9.7 ms`) | | **1k–4k draws/frame** (`n=103 / 96`) | `17.50` p50 (`copies 19.6 ms`) | `15.50` p50 (`copies 28.8 ms`) | `-11.4%` (`copies +9.2 ms`) | | **4k–7k draws/frame** (`n=46 / 46`) | `13.40` p50 (`copies 29.9 ms`) | `12.80` p50 (`copies 34.8 ms`) | `-4.5%` | | **7k–10k draws/frame** (`n=34 / 37`) | `11.05` p50 / `11.06` mean (`90.4 ms`) | `11.50` p50 / `11.54` mean (`86.9 ms`) | **`+4.1%`** | | **>=10k draws/frame** (`n=5 / 6`) | `8.00` p50 (`copies 73.3 ms`) | `9.70` p50 (`copies 55.5 ms`) | **`+21.3%`** (`copies -17.8 ms`) | ### Key Observation - On this setup, `waiting for flights` was already `0.1 ms` at baseline (with `VICTORY_WAIT_RESIDENT=0` and fast RTX 5080), so clipping the `28.3 MB` GPU-RO prefix did not recover large flight-wait time here. - Instead, diverting ~2,800 fills/frame away from `card_steps` shifted work back onto CPU `steps` (`refreshes 22.5 -> 28.1 ms`, `copies&fills 2.4 -> 5.0 ms`, `card_up_MB 22.5 -> 26.4 MB`). That is a clear win in heavy `>=7k` draw workloads (`+4.1%` / `+21.3%`), but slowed `1k–7k` draw workloads on an 8C/16T CPU. - Correctness was spotless across the full 20 minutes (`0` errors, `0` visual glitches).
sawetco commented 2026-11-28 13:55:39 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by sawetco on 2026-11-28T13:55:39Z.


I reproduced the interior-range case in a synthetic unit test on 259c993 using native Windows and Rust 1.98.1. The three existing gpu_readonly_tests passed. The new case reached the whole-allocation release through watch::title_memory_freed(base, 0). After the release, writable_subranges still returned Some([]) for the interior range. The expected result is None, which would leave that range eligible for GPU write tracking. Earlier review

// In shadow.rs, inside gpu_readonly_tests
#[test]
fn zero_length_release_clears_readonly_range_inside_reservation() {
    let base = 0x7e40_0000_0000usize;
    let inner = base + 0x1_0000;
    title_memory_gpu_readonly(inner, 0x1_0000);
    assert_eq!(writable_subranges(inner as u64, 0x1_0000), Some(vec![]));
    crate::watch::title_memory_freed(base, 0);
    let after_release = writable_subranges(inner as u64, 0x1_0000);
    gpu_readonly_freed(inner, 0x1_0000);
    assert_eq!(after_release, None, "the released range must no longer mask writes");
}

This checks the range bookkeeping with the game closed.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7240284822 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1014#issuecomment-7240284822). Originally posted by [sawetco](https://github.com/sawetco) on 2026-11-28T13:55:39Z. --- I reproduced the interior-range case in a synthetic unit test on `259c993` using native Windows and Rust 1.98.1. The three existing `gpu_readonly_tests` passed. The new case reached the whole-allocation release through `watch::title_memory_freed(base, 0)`. After the release, `writable_subranges` still returned `Some([])` for the interior range. The expected result is `None`, which would leave that range eligible for GPU write tracking. [Earlier review](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1014#issuecomment-7240096866) ```rust // In shadow.rs, inside gpu_readonly_tests #[test] fn zero_length_release_clears_readonly_range_inside_reservation() { let base = 0x7e40_0000_0000usize; let inner = base + 0x1_0000; title_memory_gpu_readonly(inner, 0x1_0000); assert_eq!(writable_subranges(inner as u64, 0x1_0000), Some(vec![])); crate::watch::title_memory_freed(base, 0); let after_release = writable_subranges(inner as u64, 0x1_0000); gpu_readonly_freed(inner, 0x1_0000); assert_eq!(after_release, None, "the released range must no longer mask writes"); } ``` This checks the range bookkeeping with the game closed.
tippythetaidum commented 2026-11-28 14:54:00 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by tippythetaidum on 2026-11-28T14:54:00Z.


Tested on an RTX 5080 + Ryzen 7 9800X3D (8 cores, one CCD), 32 GB, Windows 11 26200. This PR is cherry-picked onto 63b902f with #393, Series X, DLSS Quality 2560x1440, frame generation off, warm pipeline cache, standing indoors (Jason's house, the same save restored before every run, about 5,000 to 7,500 draws a frame).

Verification: VICTORY_GPU_RO_CHECK=1, one run of about 4 minutes from start to the world, 0 warnings. The three read-only ranges were noted at start (0x5eb70000+0xa00000, 0x5f570000+0x100000, 0x5f670000+0x1b00000).

A/B in one process. A local switch turned gpu_ro_skip() off every other 30 s, so both sides saw the same scenes. This was 4 minutes, with 5-second frame lines cut at the switches:

skip on skip off
card-step fills per frame ~2,100 ~4,650 (6,200 in an earlier run without this PR)
submitting thread, preparing (median) 31.2 ms 31.1 ms
the same per 1,000 draws 4.83 ms 5.07 ms
fps (mean of the lines) 20.8 21.9

So the fills drop as described (about -55 to -65 %), and the submitting thread's cost per draw drops about 5 %. The frame rate here didn't change beyond the noise. In this scene the title waits 11 to 16 ms a frame at presents either way, and the PC was paging (32 GB, 0.4 to 0.8 GB free). The frame isn't set by the preparing alone on this machine, unlike the RTX 3080 numbers in findings.md. No visual change was seen.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7241023217 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1014#issuecomment-7241023217). Originally posted by [tippythetaidum](https://github.com/tippythetaidum) on 2026-11-28T14:54:00Z. --- Tested on an RTX 5080 + Ryzen 7 9800X3D (8 cores, one CCD), 32 GB, Windows 11 26200. This PR is cherry-picked onto `63b902f` with #393, Series X, DLSS Quality 2560x1440, frame generation off, warm pipeline cache, standing indoors (Jason's house, the same save restored before every run, about 5,000 to 7,500 draws a frame). **Verification:** `VICTORY_GPU_RO_CHECK=1`, one run of about 4 minutes from start to the world, **0 warnings**. The three read-only ranges were noted at start (`0x5eb70000+0xa00000`, `0x5f570000+0x100000`, `0x5f670000+0x1b00000`). **A/B in one process.** A local switch turned `gpu_ro_skip()` off every other 30 s, so both sides saw the same scenes. This was 4 minutes, with 5-second frame lines cut at the switches: | | skip on | skip off | |---|---:|---:| | card-step fills per frame | ~2,100 | ~4,650 (6,200 in an earlier run without this PR) | | submitting thread, preparing (median) | 31.2 ms | 31.1 ms | | the same per 1,000 draws | 4.83 ms | 5.07 ms | | fps (mean of the lines) | 20.8 | 21.9 | So the fills drop as described (about -55 to -65 %), and the submitting thread's cost per draw drops about 5 %. The frame rate here didn't change beyond the noise. In this scene the title waits 11 to 16 ms a frame at presents either way, and the PC was paging (32 GB, 0.4 to 0.8 GB free). The frame isn't set by the preparing alone on this machine, unlike the RTX 3080 numbers in `findings.md`. No visual change was seen.
mikael-jarvinen commented 2026-11-28 15:02:06 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mikael-jarvinen on 2026-11-28T15:02:06Z.


Thanks @CuteBooty and @sawetco for catching and reproducing the zero-length release bug, and @Bj0rnis, @urielbeaupre, and @POMXARK for the independent A/B runs.

Review fixes pushed

  • Zero-length MEM_RELEASE clearing (watch.rs, shadow.rs): watch::title_memory_freed(at, 0) now resolves the live Windows allocation extent via allocation_end(at, at) (VirtualQuery, gated behind a lock-free shadow::has_gpu_readonly_from(at) check) before calling gpu_readonly_freed. Because title_virtual_free notifies victory-gpu before calling VirtualFree, this clears interior GPU-read-only sub-ranges and split tails across the whole reservation without touching adjacent separate reservations.
  • Whole-page alignment & reuse paths (xmem.rs): note_gpu_protection now aligns ranges to whole 4 KiB host pages (page_aligned_range), matching Windows VirtualProtect / VirtualAlloc2 granularity. Fresh fixed-address MEM_RESERVE calls (not only null-base reservations) and successful MEM_COALESCE_PLACEHOLDERS frees now also clear stale GPU-read-only records over the affected pages.
  • Unit tests: Added shadow::gpu_readonly_tests::zero_length_release_clears_readonly_range_inside_reservation (using real VirtualAlloc reservations with committed interior sub-regions, a split RO tail, and a second unrelated reservation to verify isolation) and xmem::tests::gpu_protection_page_alignment.
  • Verification: victory-gpu --lib (457 passed, including 4/4 gpu_readonly_tests), victory-hle --lib (189 passed, including gpu_protection_page_alignment), clippy (default + --all-features, 0 new warnings), cargo xtask policy (294 files ok).
  • Diagnostic caveat: Noted in the PR description that VICTORY_GPU_RO_CHECK=1 inspects compared, non-picked card ranges (so write-combined / uncompared writes are outside its check).

Note on @POMXARK's mixed light- vs heavy-scene result

Traced why 1k–7k draw frames regressed on your 5080 + VICTORY_WAIT_RESIDENT=0 + 8C/16T stack while >=7k draw frames gained +4.1% to +21.3%:

  • Clipping the 27 MiB GPU-RO ring removes it from Shadow::pending, so dirty ring pages move from byte-diffed Shadow::merge_under_writes (under −1.7 ms, upload ranges −66.5%) to whole-page Shadow::copy_stale (refreshes +5.6 ms, +3.9 MB uploaded), while ~2,800 fills/frame move from card_steps planning (−2.5 ms) back to CPU copy_mapped fills (copies&fills +2.6 ms).
  • When waiting for flights is non-trivial (3–35 ms on RTX 3080, 2.4–5.8 ms in the break room on 5070 Ti) or in heavy >=7k draw scenes, avoiding false UAV hazards and flight waits clearly wins; when waiting for flights is already 0.1 ms at baseline on lighter scenes, there is no wait time left to recover on an 8-core CPU. Updated the PR description to note this tradeoff (and VICTORY_GPU_RO_SKIP=0 remains available to toggle it off).
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7241147078 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1014#issuecomment-7241147078). Originally posted by [mikael-jarvinen](https://github.com/mikael-jarvinen) on 2026-11-28T15:02:06Z. --- Thanks @CuteBooty and @sawetco for catching and reproducing the zero-length release bug, and @Bj0rnis, @urielbeaupre, and @POMXARK for the independent A/B runs. ### Review fixes pushed - **Zero-length `MEM_RELEASE` clearing (`watch.rs`, `shadow.rs`):** `watch::title_memory_freed(at, 0)` now resolves the live Windows allocation extent via `allocation_end(at, at)` (`VirtualQuery`, gated behind a lock-free `shadow::has_gpu_readonly_from(at)` check) before calling `gpu_readonly_freed`. Because `title_virtual_free` notifies `victory-gpu` before calling `VirtualFree`, this clears interior GPU-read-only sub-ranges and split tails across the whole reservation without touching adjacent separate reservations. - **Whole-page alignment & reuse paths (`xmem.rs`):** `note_gpu_protection` now aligns ranges to whole 4 KiB host pages (`page_aligned_range`), matching Windows `VirtualProtect` / `VirtualAlloc2` granularity. Fresh fixed-address `MEM_RESERVE` calls (not only null-base reservations) and successful `MEM_COALESCE_PLACEHOLDERS` frees now also clear stale GPU-read-only records over the affected pages. - **Unit tests:** Added `shadow::gpu_readonly_tests::zero_length_release_clears_readonly_range_inside_reservation` (using real `VirtualAlloc` reservations with committed interior sub-regions, a split RO tail, and a second unrelated reservation to verify isolation) and `xmem::tests::gpu_protection_page_alignment`. - **Verification:** `victory-gpu --lib` (457 passed, including 4/4 `gpu_readonly_tests`), `victory-hle --lib` (189 passed, including `gpu_protection_page_alignment`), `clippy` (default + `--all-features`, 0 new warnings), `cargo xtask policy` (294 files ok). - **Diagnostic caveat:** Noted in the PR description that `VICTORY_GPU_RO_CHECK=1` inspects compared, non-picked card ranges (so write-combined / uncompared writes are outside its check). ### Note on @POMXARK's mixed light- vs heavy-scene result Traced why `1k–7k` draw frames regressed on your 5080 + `VICTORY_WAIT_RESIDENT=0` + 8C/16T stack while `>=7k` draw frames gained `+4.1%` to `+21.3%`: - Clipping the 27 MiB GPU-RO ring removes it from `Shadow::pending`, so dirty ring pages move from byte-diffed `Shadow::merge_under_writes` (`under` −1.7 ms, upload ranges −66.5%) to whole-page `Shadow::copy_stale` (`refreshes` +5.6 ms, `+3.9 MB` uploaded), while ~2,800 fills/frame move from `card_steps` planning (−2.5 ms) back to CPU `copy_mapped` fills (`copies&fills` +2.6 ms). - When `waiting for flights` is non-trivial (`3–35 ms` on RTX 3080, `2.4–5.8 ms` in the break room on 5070 Ti) or in heavy `>=7k` draw scenes, avoiding false UAV hazards and flight waits clearly wins; when `waiting for flights` is already `0.1 ms` at baseline on lighter scenes, there is no wait time left to recover on an 8-core CPU. Updated the PR description to note this tradeoff (and `VICTORY_GPU_RO_SKIP=0` remains available to toggle it off).
bigboss22869 commented 2026-11-28 20:35:13 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by bigboss22869 on 2026-11-28T20:35:13Z.


Tried the PR's single commit on trustno1 main of 2026-11-28: RTX 5070 Ti 16 GB, Ryzen 7 7800X3D, 64 GB, Windows 11, Series X profile, native 1440p, no DLSS. Same save at a pier, camera still, scripted 4-minute runs.

Run Median frame Draws a frame
without the PR, VICTORY_CARD_STEPS=2 50.1 ms ~8,470
without the PR, VICTORY_CARD_STEPS=1 56.4 ms ~8,340
with the PR, CARD_STEPS=2 48.9 ms ~6,050
with the PR, CARD_STEPS=1 48.7 ms ~5,250
with the PR, VICTORY_GPU_RO_CHECK=1, CARD_STEPS=1 53.2 ms ~8,070
  • With the clipping on, a third of the draws are gone at the same place and camera, and the person watching saw a ship drawn black in one run and buoys (red ones) black in the other. The log said 396 MB declared written in GPU-read-only memory clipped a frame.
  • VICTORY_GPU_RO_CHECK=1 logged no changed bytes in 2.5 minutes, and the draw count was back. So the check mode does not catch whatever goes wrong.
  • The frame time gain looks like lost scene, not saved work. In our fork (https://github.com/bigboss22869/VIctory-RTX5070Ti, branch rtx5070ti) the clipping is off unless VICTORY_GPU_RO_SKIP=1.

AI-assisted (Claude Code); runs and observations by me; no game data.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7245394937 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1014#issuecomment-7245394937). Originally posted by [bigboss22869](https://github.com/bigboss22869) on 2026-11-28T20:35:13Z. --- Tried the PR's single commit on trustno1 main of 2026-11-28: RTX 5070 Ti 16 GB, Ryzen 7 7800X3D, 64 GB, Windows 11, Series X profile, native 1440p, no DLSS. Same save at a pier, camera still, scripted 4-minute runs. | Run | Median frame | Draws a frame | |---|---|---| | without the PR, `VICTORY_CARD_STEPS=2` | 50.1 ms | ~8,470 | | without the PR, `VICTORY_CARD_STEPS=1` | 56.4 ms | ~8,340 | | with the PR, `CARD_STEPS=2` | 48.9 ms | ~6,050 | | with the PR, `CARD_STEPS=1` | 48.7 ms | ~5,250 | | with the PR, `VICTORY_GPU_RO_CHECK=1`, `CARD_STEPS=1` | 53.2 ms | ~8,070 | - With the clipping on, a third of the draws are gone at the same place and camera, and the person watching saw a ship drawn black in one run and buoys (red ones) black in the other. The log said `396 MB declared written in GPU-read-only memory clipped` a frame. - `VICTORY_GPU_RO_CHECK=1` logged no changed bytes in 2.5 minutes, and the draw count was back. So the check mode does not catch whatever goes wrong. - The frame time gain looks like lost scene, not saved work. In our fork (https://github.com/bigboss22869/VIctory-RTX5070Ti, branch `rtx5070ti`) the clipping is off unless `VICTORY_GPU_RO_SKIP=1`. AI-assisted (Claude Code); runs and observations by me; no game data.
futurepro62 commented 2026-11-28 20:44:49 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by futurepro62 on 2026-11-28T20:44:49Z.


Tested on main 9300875 + this PR. System: RTX 5070 Ti 16 GB (driver 621.40), Ryzen 7 9800X3D (SMT on, 16 threads), 32 GB DDR5, Windows 11 build 26300, pagefile C: 32–64 GB (custom). Title 1.0.2.1. Script launcher, mode 6, Series X, DLSS + DLSS frame generation 4x. Built from source.. Output 3840x2160 + DLSS Performance.

  • The read-only ranges were noted (MEASURED):
INFO victory_gpu::shadow: GPU-read-only title memory noted (VICTORY_GPU_RO_SKIP=1) start=0x178d0000 len=0x1b00000
  • Rendered fps 20–32 vs 21–25 on main: maybe +2–4 fps (MEASURED, different scenes).
  • But textures broke: rainbow/multicolour noise on character arms (in a cutscene), and much more popping. a texture picked by index changed after its upload reached the log's cap of 200 lines 85 s into the run, compared with 96 lines in 5 min on main without the PR (MEASURED). So the skipped range may hold texture data the GPU does write (ASSUMED). VICTORY_GPU_RO_CHECK=1 wasn't tried.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7245509754 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1014#issuecomment-7245509754). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-28T20:44:49Z. --- Tested on main `9300875` + this PR. System: RTX 5070 Ti 16 GB (driver 621.40), Ryzen 7 9800X3D (SMT on, 16 threads), 32 GB DDR5, Windows 11 build 26300, pagefile C: 32–64 GB (custom). Title 1.0.2.1. Script launcher, mode 6, Series X, DLSS + DLSS frame generation 4x. Built from source.. Output 3840x2160 + DLSS Performance. - The read-only ranges were noted (MEASURED): ``` INFO victory_gpu::shadow: GPU-read-only title memory noted (VICTORY_GPU_RO_SKIP=1) start=0x178d0000 len=0x1b00000 ``` - Rendered fps 20–32 vs 21–25 on main: maybe +2–4 fps (MEASURED, different scenes). - But textures broke: rainbow/multicolour noise on character arms (in a cutscene), and much more popping. `a texture picked by index changed after its upload` reached the log's cap of 200 lines **85 s** into the run, compared with **96 lines in 5 min** on main without the PR (MEASURED). So the skipped range may hold texture data the GPU does write (ASSUMED). `VICTORY_GPU_RO_CHECK=1` wasn't tried.
mikael-jarvinen commented 2026-11-28 21:45:14 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mikael-jarvinen on 2026-11-28T21:45:14Z.


Rebased cleanly onto main (923e38c, head 537584f; 4/4 gpu_readonly + 23/23 xmem tests pass, 0 new warnings) and re-measured on RTX 3080 10 GB + Ryzen 7 7800X3D (diag build, warm shader cache, 1440p DLSS Performance, FG off, 115 s scripted run):

Metric main (923e38c) This PR (537584f) Delta
Steady 3D FPS (med / peak) 15.7 / 17.3 19.0 / 20.5 +21.0% FPS (−11.0 ms/fr)
GPU busy (%) / idle behind CPU (ms) 66.0% / 21.65 ms 90.0% / 5.30 ms +24.0 pp / −75.5% idle
Submit prep TOTAL 58.50 ms 46.55 ms −11.95 ms (−20.4%)
planning card_steps 12.65 ms 4.70 ms −62.8%
merge_under_writes 3.15 ms 2.00 ms −36.5%
asking write watch 5.10 ms 3.70 ms −27.5%
Card pieces compared / frame 9,222 7,908 −14.2% (254.8 MB/fr clipped)
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7246246665 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1014#issuecomment-7246246665). Originally posted by [mikael-jarvinen](https://github.com/mikael-jarvinen) on 2026-11-28T21:45:14Z. --- Rebased cleanly onto `main` (`923e38c`, head `537584f`; 4/4 `gpu_readonly` + 23/23 `xmem` tests pass, 0 new warnings) and re-measured on RTX 3080 10 GB + Ryzen 7 7800X3D (`diag` build, warm shader cache, 1440p DLSS Performance, FG off, 115 s scripted run): | Metric | `main` (`923e38c`) | This PR (`537584f`) | Delta | |---|---:|---:|---:| | Steady 3D FPS (med / peak) | 15.7 / 17.3 | **19.0 / 20.5** | **+21.0% FPS (−11.0 ms/fr)** | | GPU busy (%) / idle behind CPU (ms) | 66.0% / 21.65 ms | **90.0% / 5.30 ms** | **+24.0 pp / −75.5% idle** | | Submit prep TOTAL | 58.50 ms | **46.55 ms** | **−11.95 ms (−20.4%)** | | `planning card_steps` | 12.65 ms | **4.70 ms** | **−62.8%** | | `merge_under_writes` | 3.15 ms | **2.00 ms** | **−36.5%** | | `asking write watch` | 5.10 ms | **3.70 ms** | **−27.5%** | | Card pieces compared / frame | 9,222 | **7,908** | **−14.2%** (`254.8 MB/fr` clipped) |
Luqueze commented 2026-11-28 21:48:23 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Luqueze on 2026-11-28T21:48:23Z.


Heads-up: this no longer applies to current main (77df871). The two commits conflict in crates/victory-gpu/src/draw.rs and docs/findings.md.

In draw.rs, main now has, in the root-UAV ready closure:

#[cfg(feature = "diagnostics")]
crate::host::wide_write(a, len, pipeline);
s.gpu_writes(list, a, len);

with let pipeline = self.pipeline; declared only under #[cfg(feature = "diagnostics")]. Taking this PR's s.shader_writes(list, a, len, self.pipeline) there doesn't build: self is borrowed by the closure. What builds and passes cargo test -p victory-gpu --lib (564 passed) is to keep main's diagnostics line, call s.shader_writes(list, a, len, pipeline), and drop the cfg on let pipeline. docs/findings.md only needs both sections kept.

For the record, I ran it in a bundle with #799, #1279, #666, #1497, #1442, #1397, #1358 and #1417 on that main: RTX 4070 SUPER, Ryzen 7 5700X3D, Series X, native 1440p, DLSS off. The ranges were noted (GPU-read-only title memory noted ... len=0x1b00000) and there was no crash. I can't give a number for this PR alone, because the bundle changed too much at once.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7246286692 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1014#issuecomment-7246286692). Originally posted by [Luqueze](https://github.com/Luqueze) on 2026-11-28T21:48:23Z. --- Heads-up: this no longer applies to current `main` (`77df871`). The two commits conflict in `crates/victory-gpu/src/draw.rs` and `docs/findings.md`. In `draw.rs`, `main` now has, in the root-UAV `ready` closure: ```rust #[cfg(feature = "diagnostics")] crate::host::wide_write(a, len, pipeline); s.gpu_writes(list, a, len); ``` with `let pipeline = self.pipeline;` declared only under `#[cfg(feature = "diagnostics")]`. Taking this PR's `s.shader_writes(list, a, len, self.pipeline)` there doesn't build: `self` is borrowed by the closure. What builds and passes `cargo test -p victory-gpu --lib` (564 passed) is to keep `main`'s diagnostics line, call `s.shader_writes(list, a, len, pipeline)`, and drop the `cfg` on `let pipeline`. `docs/findings.md` only needs both sections kept. For the record, I ran it in a bundle with #799, #1279, #666, #1497, #1442, #1397, #1358 and #1417 on that `main`: RTX 4070 SUPER, Ryzen 7 5700X3D, Series X, native 1440p, DLSS off. The ranges were noted (`GPU-read-only title memory noted ... len=0x1b00000`) and there was no crash. I can't give a number for this PR alone, because the bundle changed too much at once.
POMXARK commented 2026-11-28 22:18:54 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by POMXARK on 2026-11-28T22:18:54Z.


@mikael-jarvinen — ran a full 20-minute gameplay A/B of the updated 537584f head on Windows 11 (RTX 5080 16 GB, Ryzen 7 5700X 8C/16T, 32 GB RAM, Series X 1440p, DLSS Quality + MFG 4x, release build, matched save & switches, stacked on #1038 + #1094 + #516 with VICTORY_WC_NO_BACK=1, VICTORY_LAND_SKIP=1, VICTORY_CARD_STEPS=2):

Verification

  • Unit tests: gpu_readonly 4/4 PASS (0.00s, including zero_length_release_clears_readonly_range_inside_reservation), xmem 24/24 PASS (0.11s).
  • 20-minute gameplay: 0 errors, refused=2, clean visuals throughout; VICTORY_GPU_RO_SKIP=1 engaged cleanly (~141–342 MB/frame clipped on top of ~2.9–83.6 GB/frame already skipped by VICTORY_WC_NO_BACK).

20-minute A/B (matched draw buckets)

Metric Baseline (#1038, no #1014) PR #1014 (537584f) Delta
ALL 3D p50 14.80 FPS (67.4 ms) 12.95 FPS (77.5 ms) -12.5% (+10.1 ms)
1k–4k draws 16.05 FPS (cop 17.8 ms / 34.7 MB) 15.25 FPS (cop 25.9 ms / 43.9 MB) -5.0% (+8.1 ms copies)
4k–7k draws 14.80 FPS (cop 21.9 ms / 40.1 MB) 12.45 FPS (cop 31.9 ms / 54.8 MB) -15.9% (+10.0 ms copies)
7k–10k draws 11.50 FPS (cop 35.9 ms / 65.9 MB) 8.20 FPS (cop 51.3 ms / 89.5 MB) -28.7% (+15.4 ms copies)
Submitting thread med 59.3 ms (steps 28.3 ms) 70.6 ms (steps 38.7 ms) +11.3 ms (+10.4 ms steps)
Copy-back med 13.6 ms 11.4 ms -2.2 ms
Frame p95 / >100ms (5s bins) 117.3 ms / 31 156.9 ms / 52 +39.6 ms
Peak WS / Shared / Commit 20,950 / 9,156 / 30,932 MB 22,593 / 9,786 / 31,521 MB +1.6 GB WS

Observation

  • Copy-back improved by -2.2 ms (13.6 -> 11.4 ms) and CPU time dropped (5,850 -> 5,460 s), with 0 errors and clean visuals (the MEM_RELEASE fix is solid).
  • However, on a 1440p Series X stack that already runs #1038 + VICTORY_WC_NO_BACK=1 + VICTORY_LAND_SKIP=1, clipping ~140–340 MB/f of RO sub-ranges increased preparing: copies (22.1 -> 31.4 ms, 40.7 -> 53.7 MB/f) and submitting steps (28.3 -> 38.7 ms), plus peak Working Set rose +1.6 GB — likely from extra interval-splitting / buffer-copy fragmentation when sub-ranges are clipped on the CARD_STEPS=2 path.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7246648633 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1014#issuecomment-7246648633). Originally posted by [POMXARK](https://github.com/POMXARK) on 2026-11-28T22:18:54Z. --- @mikael-jarvinen — ran a full 20-minute gameplay A/B of the updated `537584f` head on Windows 11 (RTX 5080 16 GB, Ryzen 7 5700X 8C/16T, 32 GB RAM, Series X 1440p, DLSS Quality + MFG 4x, release build, matched save & switches, stacked on `#1038` + `#1094` + `#516` with `VICTORY_WC_NO_BACK=1`, `VICTORY_LAND_SKIP=1`, `VICTORY_CARD_STEPS=2`): ### Verification - **Unit tests:** `gpu_readonly` **4/4 PASS** (`0.00s`, including `zero_length_release_clears_readonly_range_inside_reservation`), `xmem` **24/24 PASS** (`0.11s`). - **20-minute gameplay:** `0` errors, `refused=2`, clean visuals throughout; `VICTORY_GPU_RO_SKIP=1` engaged cleanly (~141–342 MB/frame clipped on top of ~2.9–83.6 GB/frame already skipped by `VICTORY_WC_NO_BACK`). ### 20-minute A/B (matched draw buckets) | Metric | Baseline (`#1038`, no `#1014`) | PR #1014 (`537584f`) | Delta | |---|---:|---:|---:| | **ALL 3D p50** | **14.80 FPS** (`67.4 ms`) | 12.95 FPS (`77.5 ms`) | -12.5% (`+10.1 ms`) | | **1k–4k draws** | **16.05 FPS** (`cop 17.8 ms / 34.7 MB`) | 15.25 FPS (`cop 25.9 ms / 43.9 MB`) | -5.0% (`+8.1 ms` copies) | | **4k–7k draws** | **14.80 FPS** (`cop 21.9 ms / 40.1 MB`) | 12.45 FPS (`cop 31.9 ms / 54.8 MB`) | -15.9% (`+10.0 ms` copies) | | **7k–10k draws** | **11.50 FPS** (`cop 35.9 ms / 65.9 MB`) | 8.20 FPS (`cop 51.3 ms / 89.5 MB`) | -28.7% (`+15.4 ms` copies) | | Submitting thread med | **59.3 ms** (`steps 28.3 ms`) | 70.6 ms (`steps 38.7 ms`) | +11.3 ms (`+10.4 ms` steps) | | Copy-back med | 13.6 ms | **11.4 ms** | **-2.2 ms** | | Frame p95 / `>100ms` (5s bins) | **117.3 ms / 31** | 156.9 ms / 52 | +39.6 ms | | Peak WS / Shared / Commit | 20,950 / 9,156 / 30,932 MB | 22,593 / 9,786 / 31,521 MB | +1.6 GB WS | ### Observation - Copy-back improved by `-2.2 ms` (`13.6 -> 11.4 ms`) and CPU time dropped (`5,850 -> 5,460 s`), with `0` errors and clean visuals (the `MEM_RELEASE` fix is solid). - However, on a 1440p Series X stack that already runs `#1038` + `VICTORY_WC_NO_BACK=1` + `VICTORY_LAND_SKIP=1`, clipping ~140–340 MB/f of RO sub-ranges increased `preparing: copies` (`22.1 -> 31.4 ms`, `40.7 -> 53.7 MB/f`) and `submitting steps` (`28.3 -> 38.7 ms`), plus peak Working Set rose `+1.6 GB` — likely from extra interval-splitting / buffer-copy fragmentation when sub-ranges are clipped on the `CARD_STEPS=2` path.
mikael-jarvinen commented 2026-11-28 22:23:53 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mikael-jarvinen on 2026-11-28T22:23:53Z.


Thanks for the detailed reports @bigboss22869, @futurepro62, and @Luqueze — I investigated all three and pushed an update rebased onto main (d4b5d51, head 0575055):

1. Rebase conflict (@Luqueze)

Resolved against main (d4b5d51): let pipeline = self.pipeline; is unconditional and passed into s.shader_writes(list, a, len, pipeline), and docs/findings.md merges cleanly.

2. VICTORY_GPU_RO_CHECK=1 blind spots & GPU protection clearing (@bigboss22869)

Auditing why VICTORY_GPU_RO_CHECK=1 could log 0 warnings turned up three real gaps, now fixed in 0575055:

  • Synchronous / non-relay card copy-back: Host::card_back did not call plan.check_gpu_ro(differs) (only Host::relay_card_back did).
  • Non-card shadows (< 64 KiB / windows) & uncompared card ranges: VICTORY_GPU_RO_CHECK=1 only inspected compared CardPlan ranges. Added Shadow::check_gpu_ro_merge across all six GPU-to-title merge paths (copy_back_with, relay_merge, card_merge, card_merge_relay, land_card, land_back) with zero overhead when the check is off.
  • Stale GPU-RO entries on release / plain re-protect: Note that the single-commit cherry-pick (259c9930) lacked commit 2 (33a9ee7, fixing zero-length MEM_RELEASE extent resolution, MEM_COALESCE_PLACEHOLDERS, MEM_RESERVE reuse, and 4 KiB page alignment). In 0575055, xmem::note_gpu_protection also conservatively clears GPU_READONLY when plain CPU protection (no PAGE_GRAPHICS_* bits) is passed.

3. Live verification (RTX 3080, Series X, native 1440p --dlss off, VICTORY_CARD_STEPS=1)

  • VICTORY_UPCOPY_CHECK=1 + VICTORY_CARD_STEPS=1 + VICTORY_GPU_RO_SKIP=1: 0 differing words on the 174 MiB buffer (0x1b00000 prefix + 0x9300000 suffix) or any other 32-bit / GPU-RO region at both send time and whole-buffer rest checks.
  • Native 1440p VICTORY_CARD_STEPS=1 A/B (same scripted sequence):
    • VICTORY_GPU_RO_CHECK=1 (SKIP=0): 10.5–12.1 fps (90.6–92.3 ms prep, 51.1–55.0 ms waiting for flights on 1.00 a buffer copy refused/fr), 7,803–9,308 draws/frame (ending 8,041), 0 VICTORY_GPU_RO_CHECK warnings with all blind spots closed, 23 texture-recheck warnings.
    • VICTORY_GPU_RO_SKIP=1: 16.0–17.8 fps (43.0–48.9 ms prep, 0.0 ms waiting for flights), 7,726–8,373 draws/frame (ending 8,197), 14 texture-recheck warnings.
  • Regarding @futurepro62's texture warnings: a texture picked by index changed after its upload hits 64-bit dynamic texture addresses (e.g. 0x7..., 0xb...), disjoint from the 32-bit 0x1b00000 GPU-RO region, and varies 0–26 across runs both with and without this PR (and coloured skin/cloth noise in the opening is a known intermittent race documented in card_steps.rs / list/thin.rs).

@bigboss22869 if you get a chance to re-test 0575055 on the pier save — especially with the expanded VICTORY_GPU_RO_CHECK=1 (and/or VICTORY_UPCOPY_CHECK=1) — any warning hit or draw-count log from that save would immediately pinpoint if something pier-specific is still slipping through.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7246707129 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1014#issuecomment-7246707129). Originally posted by [mikael-jarvinen](https://github.com/mikael-jarvinen) on 2026-11-28T22:23:53Z. --- Thanks for the detailed reports @bigboss22869, @futurepro62, and @Luqueze — I investigated all three and pushed an update rebased onto `main` (`d4b5d51`, head `0575055`): ### 1. Rebase conflict (@Luqueze) Resolved against `main` (`d4b5d51`): `let pipeline = self.pipeline;` is unconditional and passed into `s.shader_writes(list, a, len, pipeline)`, and `docs/findings.md` merges cleanly. ### 2. `VICTORY_GPU_RO_CHECK=1` blind spots & GPU protection clearing (@bigboss22869) Auditing why `VICTORY_GPU_RO_CHECK=1` could log 0 warnings turned up three real gaps, now fixed in `0575055`: - **Synchronous / non-relay card copy-back:** `Host::card_back` did not call `plan.check_gpu_ro(differs)` (only `Host::relay_card_back` did). - **Non-card shadows (`< 64 KiB` / windows) & uncompared card ranges:** `VICTORY_GPU_RO_CHECK=1` only inspected compared `CardPlan` ranges. Added `Shadow::check_gpu_ro_merge` across all six GPU-to-title merge paths (`copy_back_with`, `relay_merge`, `card_merge`, `card_merge_relay`, `land_card`, `land_back`) with zero overhead when the check is off. - **Stale GPU-RO entries on release / plain re-protect:** Note that the single-commit cherry-pick (`259c9930`) lacked commit 2 (`33a9ee7`, fixing zero-length `MEM_RELEASE` extent resolution, `MEM_COALESCE_PLACEHOLDERS`, `MEM_RESERVE` reuse, and 4 KiB page alignment). In `0575055`, `xmem::note_gpu_protection` also conservatively clears `GPU_READONLY` when plain CPU protection (no `PAGE_GRAPHICS_*` bits) is passed. ### 3. Live verification (RTX 3080, Series X, native 1440p `--dlss off`, `VICTORY_CARD_STEPS=1`) - **`VICTORY_UPCOPY_CHECK=1` + `VICTORY_CARD_STEPS=1` + `VICTORY_GPU_RO_SKIP=1`:** **0** differing words on the 174 MiB buffer (`0x1b00000` prefix + `0x9300000` suffix) or any other 32-bit / GPU-RO region at both send time and whole-buffer rest checks. - **Native 1440p `VICTORY_CARD_STEPS=1` A/B (same scripted sequence):** - `VICTORY_GPU_RO_CHECK=1` (`SKIP=0`): **10.5–12.1 fps** (`90.6–92.3 ms` prep, `51.1–55.0 ms` waiting for flights on `1.00 a buffer copy` refused/fr), **7,803–9,308 draws/frame** (ending `8,041`), **0 `VICTORY_GPU_RO_CHECK` warnings** with all blind spots closed, `23` texture-recheck warnings. - `VICTORY_GPU_RO_SKIP=1`: **16.0–17.8 fps** (`43.0–48.9 ms` prep, `0.0 ms` waiting for flights), **7,726–8,373 draws/frame** (ending `8,197`), `14` texture-recheck warnings. - Regarding @futurepro62's texture warnings: `a texture picked by index changed after its upload` hits 64-bit dynamic texture addresses (e.g. `0x7...`, `0xb...`), disjoint from the 32-bit `0x1b00000` GPU-RO region, and varies `0–26` across runs both with and without this PR (and coloured skin/cloth noise in the opening is a known intermittent race documented in `card_steps.rs` / `list/thin.rs`). @bigboss22869 if you get a chance to re-test `0575055` on the pier save — especially with the expanded `VICTORY_GPU_RO_CHECK=1` (and/or `VICTORY_UPCOPY_CHECK=1`) — any warning hit or draw-count log from that save would immediately pinpoint if something pier-specific is still slipping through.
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
trustno1-coder/VIctory-NVIDIA!1014
No description provided.