GPU: opt-in file-backed CPU mirrors #3824

Manually merged
github merged 1 commit from github-bot/gh-3824 into main 2026-11-30 14:14:46 +00:00 AGit
Owner

@⁠john-9474 on GitHub · 2026-11-30 08:25 UTC · original
john-9474:codex/file-backed-cpu-mirrors → main · +220 −12 · 8 files · 1 commits · merged 2026-11-30 14:12 UTC

What it changes

CPU-only mirrors of two-sided GPU buffers still consume private system commit when allocated from the process heap. VICTORY_CARD_CPU_FILE=1 opts into temporary file-backed storage for those mirrors instead. The default remains off.

The application configures an absolute cache/cpu-mirrors directory through the existing asset-policy check. Each mirror owns its mapping and delete-on-close file. Submission-owned snapshots continue to supply GPU reads; the file mapping is never imported into D3D12. Single-sided buffers and the upload-checker path retain their existing allocation behavior. Failed file allocations fall back to the existing private/shared storage path.

This reduces commit charged to CPU mirrors; it does not reduce all renderer memory usage. Cached file pages still consume RAM and can incur disk I/O. The documentation covers that tradeoff and the required submission-owned-send configuration.

How it was tested

  • Base: current upstream 41adb551 / v2026.11.29.05. Windows 11 build 26100, RTX 3080 Ti 12 GB, driver 610.47, Ryzen 9800X3D, 64 GB RAM.

  • Three fresh processes each allocated and touched eight 32 MiB mirrors:

    CPU storage Added global commit Added DXGI nonlocal usage
    Existing shared buffers 267.051 MiB 261.777 MiB
    Existing private heap 257.105 MiB 0 MiB
    File-backed mirrors 2.047 MiB 0 MiB
  • Real D3D12 round trips passed separately with shared, private and file-backed mirrors: submission-time refresh, GPU copy/writeback, then later CPU writes through a second mapping. Three rounds compare the full output bytes. Temporary-file counts return to zero after each test process exits.

  • Both new storage tests pass, including zero-initialization, a non-page-aligned length, full byte preservation, cleanup and rejection of empty storage.

  • cargo build --locked --release -p victory: passed from the clean contribution branch.

  • Full GPU library suite: 994 passed, 3 failed, 63 ignored. The clean upstream control gives 992 passed, the same 3 failures, 62 ignored. The failures are compose::tests::bgrx_plane_selects_a_typed_view, host::card_steps::tests::places_written_after_sending_are_learned, and shader_cache::tests::every_switch_of_the_translator_is_in_the_key. The ignored new hardware test was also run explicitly and passed in each storage mode.

  • git diff --check and the staged asset-policy check: passed; eight source/documentation files, no title data or dependency changes.

Live comparison on this branch used identical local process-mute and native physical-page file-backing test support on both sides (those harness changes are excluded from this PR): Series X, 2560×1440 output, DLSS Performance, FSR 2×, 30 rendered-FPS cap, builder off, the same restored save/cache and CARD_BUFFERS_MIN_KB=1024.

The figures below were recomputed after correcting the log parser to pair FPS and preparation/workload counts from the same statistics call. The earlier parser attached the next preparation interval to the preceding FPS line; these corrected live figures supersede the earlier ones.

File-backed CPU mirrors Matched samples Rendered FPS median Added steady global commit, GiB
Off, run 1 9 24.10 25.685
On, run 1 11 24.40 24.808
Off, run 2 11 23.90 26.107
On, run 2 12 23.75 24.991

Across the two off and two on runs, the approximate matched steady-commit reduction is 0.69–1.30 GiB. There is no convincing FPS improvement. Scene/workload matching is approximate, this is a small sample, and generated FPS is not independently measured.

Transition-validation limitation. The off controls reached our unchanged 6 GiB headroom guard around 150 seconds. One enabled run failed at command-list Close around 140 seconds, while its repeat completed 240 seconds. A current-head diagnostic run with the faster buffer-placement setting reproduced the exact rejection: BC3_TYPELESS to BC7_TYPELESS CopyTextureRegion (D3D12 message 874). Existing #3043 addresses this format-mismatch class. Its bit-preserving bridge also passes asset-free GPU checks for this exact pair in both directions, through the 1x1 mip and partial regions, with the separate geometry-skipping guard disabled. Gameplay candidates have completed 240 seconds without a logged error, but have not logged a repaired cross-format copy, so full transition stability is still unproven. These unequal endpoints are not a peak-memory comparison. No FPS or crash-fix claim is made for CPU mirror storage.

Checked for overlap

  • Searched open and recently closed PRs, including targeted searches for CPU mirrors, pageable storage and file-backed memory.
  • #1823 supplies the existing private CPU-mirror design. This adds a file-backed option while retaining its immutable submission snapshots.
  • #2215 reduces staging for private RT arenas; it changes a different part of mirror storage and remains separate.
  • #2461 backs the title's physical-page pools with files. This PR backs the layer's CPU mirror copies instead, without changing title allocations or native GPU-import eligibility.
  • #2657 changes budget admission and private-mirror defaults; this option stays off by default and does not change those budgets.
**@⁠john-9474** on GitHub · 2026-11-30 08:25 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3824) `john-9474:codex/file-backed-cpu-mirrors` → `main` · +220 −12 · 8 files · 1 commits · merged 2026-11-30 14:12 UTC ## What it changes CPU-only mirrors of two-sided GPU buffers still consume private system commit when allocated from the process heap. `VICTORY_CARD_CPU_FILE=1` opts into temporary file-backed storage for those mirrors instead. The default remains off. The application configures an absolute `cache/cpu-mirrors` directory through the existing asset-policy check. Each mirror owns its mapping and delete-on-close file. Submission-owned snapshots continue to supply GPU reads; the file mapping is never imported into D3D12. Single-sided buffers and the upload-checker path retain their existing allocation behavior. Failed file allocations fall back to the existing private/shared storage path. This reduces commit charged to CPU mirrors; it does not reduce all renderer memory usage. Cached file pages still consume RAM and can incur disk I/O. The documentation covers that tradeoff and the required submission-owned-send configuration. ## How it was tested - Base: current upstream `41adb551` / `v2026.11.29.05`. Windows 11 build 26100, RTX 3080 Ti 12 GB, driver 610.47, Ryzen 9800X3D, 64 GB RAM. - Three fresh processes each allocated and touched eight 32 MiB mirrors: | CPU storage | Added global commit | Added DXGI nonlocal usage | | --- | ---: | ---: | | Existing shared buffers | 267.051 MiB | 261.777 MiB | | Existing private heap | 257.105 MiB | 0 MiB | | File-backed mirrors | 2.047 MiB | 0 MiB | - Real D3D12 round trips passed separately with shared, private and file-backed mirrors: submission-time refresh, GPU copy/writeback, then later CPU writes through a second mapping. Three rounds compare the full output bytes. Temporary-file counts return to zero after each test process exits. - Both new storage tests pass, including zero-initialization, a non-page-aligned length, full byte preservation, cleanup and rejection of empty storage. - `cargo build --locked --release -p victory`: passed from the clean contribution branch. - Full GPU library suite: **994 passed, 3 failed, 63 ignored**. The clean upstream control gives **992 passed, the same 3 failures, 62 ignored**. The failures are `compose::tests::bgrx_plane_selects_a_typed_view`, `host::card_steps::tests::places_written_after_sending_are_learned`, and `shader_cache::tests::every_switch_of_the_translator_is_in_the_key`. The ignored new hardware test was also run explicitly and passed in each storage mode. - `git diff --check` and the staged asset-policy check: passed; eight source/documentation files, no title data or dependency changes. Live comparison on this branch used identical local process-mute and native physical-page file-backing test support on both sides (those harness changes are excluded from this PR): Series X, 2560×1440 output, DLSS Performance, FSR 2×, 30 rendered-FPS cap, builder off, the same restored save/cache and `CARD_BUFFERS_MIN_KB=1024`. The figures below were recomputed after correcting the log parser to pair FPS and preparation/workload counts from the same statistics call. The earlier parser attached the next preparation interval to the preceding FPS line; these corrected live figures supersede the earlier ones. | File-backed CPU mirrors | Matched samples | Rendered FPS median | Added steady global commit, GiB | | --- | ---: | ---: | ---: | | Off, run 1 | 9 | 24.10 | 25.685 | | On, run 1 | 11 | 24.40 | 24.808 | | Off, run 2 | 11 | 23.90 | 26.107 | | On, run 2 | 12 | 23.75 | 24.991 | Across the two off and two on runs, the approximate matched steady-commit reduction is **0.69–1.30 GiB**. There is no convincing FPS improvement. Scene/workload matching is approximate, this is a small sample, and generated FPS is not independently measured. **Transition-validation limitation.** The off controls reached our unchanged 6 GiB headroom guard around 150 seconds. One enabled run failed at command-list Close around 140 seconds, while its repeat completed 240 seconds. A current-head diagnostic run with the faster buffer-placement setting reproduced the exact rejection: BC3_TYPELESS to BC7_TYPELESS CopyTextureRegion (D3D12 message 874). Existing #3043 addresses this format-mismatch class. Its bit-preserving bridge also passes asset-free GPU checks for this exact pair in both directions, through the 1x1 mip and partial regions, with the separate geometry-skipping guard disabled. Gameplay candidates have completed 240 seconds without a logged error, but have not logged a repaired cross-format copy, so full transition stability is still unproven. These unequal endpoints are not a peak-memory comparison. No FPS or crash-fix claim is made for CPU mirror storage. ## Checked for overlap - [x] Searched open and recently closed PRs, including targeted searches for CPU mirrors, pageable storage and file-backed memory. - #1823 supplies the existing private CPU-mirror design. This adds a file-backed option while retaining its immutable submission snapshots. - #2215 reduces staging for private RT arenas; it changes a different part of mirror storage and remains separate. - #2461 backs the title's physical-page pools with files. This PR backs the layer's CPU mirror copies instead, without changing title allocations or native GPU-import eligibility. - #2657 changes budget admission and private-mirror defaults; this option stays off by default and does not change those budgets.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 08:28:21 +00:00
Author
Owner

@⁠dyshay on GitHub · 2026-11-30 08:55 UTC · original

Merged into our fork's integration branch for testing (dyshay/VIctory-NVIDIA, branch janus-prs). I read the full diff first: no network access, process spawning, binaries, build or dependency changes, or game data. It builds with --profile diag --features diagnostics, and the CPU tests of the touched code pass. A run on an RTX 4090 is queued. Frame times will follow here.

**@⁠dyshay** on GitHub · 2026-11-30 08:55 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3824#issuecomment-7273515888) Merged into our fork's integration branch for testing ([dyshay/VIctory-NVIDIA](https://github.com/dyshay/VIctory-NVIDIA/tree/janus-prs), branch `janus-prs`). I read the full diff first: no network access, process spawning, binaries, build or dependency changes, or game data. It builds with `--profile diag --features diagnostics`, and the CPU tests of the touched code pass. A run on an RTX 4090 is queued. Frame times will follow here.
github manually merged commit f493ee3433 into main 2026-11-30 14:14:46 +00:00
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!3824
No description provided.