Replace overlapping shadow windows with shared memory backing and page-copy deduplication #2

Open
opened 2026-12-06 00:19:56 +00:00 by github-bot · 0 comments
Owner

@⁠VictoryX-dev on GitHub · 2026-12-03 02:57 UTC · original

Problem

Title GPU accesses outside named buffers are currently backed by independent 4 MiB address windows keyed by request address and length. Because overlapping requests create separate host copies over the same console pages, VictoryX both wastes substantial memory and copies the same dirty pages multiple times per frame.

Known Evidence

  • Confirmed in gameplay diagnostics (Series S, AMD reference system):
    • Duplicate page refreshes: ~42% of stale pages refreshed per frame (468 of 1,105) are copied again by a second overlapping window.
    • Duplicate window memory: ~1,358 MB out of ~3,431 MB in buffer windows is duplicated across overlapping allocations.
    • Re-executed lists: 21,133 of 1,588,022 recorded lists in a diagnostic session were re-executed without reset, keeping root-view window holds alive longer.
    • Memory footprint breakdown: Heavy scenes reach ~22.6–23.8 GB process private bytes (~17–21 GB working set, ~10–13.9 GB dedicated VRAM). Hardware probing (memcensus.rs) proved ~10 GB of that private commit is GPU-local memory charged 1:1 to private bytes, while host RAM-side private memory is ~9.8–11.5 GB (of which windows' cells account for ~3.6–4.9 GB).
  • Experimental (off by default, unmeasured standalone):
    • VICTORY_WINDOW_WITHIN=1: reuses a longer live window in the same 4 MiB cell. Saved ~0.6–1.1 GB private bytes when tested alongside VICTORY_WINDOWS_ORDERED=1, but has not been validated standalone.
  • Engineering target: Eliminate redundant page copies and window duplication to improve both CPU submission time and comfortable operation on 32 GB systems.

Approaches That Did Not Work

  • VICTORY_WINDOW_KB=256 (kept off): Shrinking windows from 4 MiB to 256 KiB multiplied the window count by ~2.5× while saving only ~250–330 MB and worsening frame pacing (7.1% of frames > 33.3 ms).
  • VICTORY_CARD_ALL=1 (kept off): Redundant with VICTORY_CARD_BUFFERS_MIN_KB=64.
  • VICTORY_WINDOWS_ORDERED=1 (kept off): Added ~0.5 GB private bytes and +2.5 ms P99 without resolving geometry corruption.

Relevant Source Modules

  • runtime/crates/victory-gpu/src/shadow.rs
  • runtime/crates/victory-gpu/src/host.rs
  • runtime/crates/victory-gpu/src/watch.rs
  • runtime/crates/victory-gpu/src/land.rs
  • runtime/crates/victory-gpu/src/window_holds.rs
  • runtime/crates/victory-gpu/src/membreak.rs
  • runtime/crates/victory-gpu/src/memcensus.rs
  • runtime/crates/victory-gpu/src/residency.rs

Expected Contribution

  • Design and implement (or review/test) a shared page-store backing architecture where each console page range is backed once and aliased safely by multiple views/buffers while preserving:
    • exact GPU virtual-address offset semantics,
    • fence-safe GPU lifetime and deferred retirement,
    • shader write-back merging (land.rs) and write-combined rules (wc.rs),
    • submission ordering across in-flight command lists.
  • Alternatively, evaluate VICTORY_WINDOW_WITHIN=1 standalone as a near-term mitigation with synthetic aliasing fixtures and release-package measurements.

Acceptance Criteria

  • Synthetic D3D12 fixtures verify overlapping views/buffers read coherent CPU writes and GPU shader write-backs without hazards under the D3D12 debug layer.
  • VICTORY_XFER=1 confirms a substantial drop in duplicate stale-page refreshes per frame and memory split confirms lower host RAM-side window memory.
  • Feature is gated behind an off-by-default VICTORY_* switch until validated in matched gameplay checkpoints.
**@⁠VictoryX-dev** on GitHub · 2026-12-03 02:57 UTC · [original](https://github.com/VictoryX-dev/VictoryX/issues/2) ## Problem Title GPU accesses outside named buffers are currently backed by independent 4 MiB address windows keyed by request address and length. Because overlapping requests create separate host copies over the same console pages, VictoryX both wastes substantial memory and copies the same dirty pages multiple times per frame. ## Known Evidence - **Confirmed in gameplay diagnostics** *(Series S, AMD reference system)*: - **Duplicate page refreshes:** ~42% of stale pages refreshed per frame (`468` of `1,105`) are copied again by a second overlapping window. - **Duplicate window memory:** ~1,358 MB out of ~3,431 MB in buffer windows is duplicated across overlapping allocations. - **Re-executed lists:** `21,133` of `1,588,022` recorded lists in a diagnostic session were re-executed without reset, keeping root-view window holds alive longer. - **Memory footprint breakdown:** Heavy scenes reach ~22.6–23.8 GB process private bytes (~17–21 GB working set, ~10–13.9 GB dedicated VRAM). Hardware probing (`memcensus.rs`) proved ~10 GB of that private commit is GPU-local memory charged 1:1 to private bytes, while host RAM-side private memory is ~9.8–11.5 GB (of which windows' cells account for ~3.6–4.9 GB). - **Experimental (off by default, unmeasured standalone):** - `VICTORY_WINDOW_WITHIN=1`: reuses a longer live window in the same 4 MiB cell. Saved ~0.6–1.1 GB private bytes when tested alongside `VICTORY_WINDOWS_ORDERED=1`, but has not been validated standalone. - **Engineering target:** Eliminate redundant page copies and window duplication to improve both CPU submission time and comfortable operation on 32 GB systems. ## Approaches That Did Not Work - **`VICTORY_WINDOW_KB=256` (kept off):** Shrinking windows from 4 MiB to 256 KiB multiplied the window count by ~2.5× while saving only ~250–330 MB and worsening frame pacing (7.1% of frames > 33.3 ms). - **`VICTORY_CARD_ALL=1` (kept off):** Redundant with `VICTORY_CARD_BUFFERS_MIN_KB=64`. - **`VICTORY_WINDOWS_ORDERED=1` (kept off):** Added ~0.5 GB private bytes and +2.5 ms P99 without resolving geometry corruption. ## Relevant Source Modules - `runtime/crates/victory-gpu/src/shadow.rs` - `runtime/crates/victory-gpu/src/host.rs` - `runtime/crates/victory-gpu/src/watch.rs` - `runtime/crates/victory-gpu/src/land.rs` - `runtime/crates/victory-gpu/src/window_holds.rs` - `runtime/crates/victory-gpu/src/membreak.rs` - `runtime/crates/victory-gpu/src/memcensus.rs` - `runtime/crates/victory-gpu/src/residency.rs` ## Expected Contribution - Design and implement (or review/test) a shared page-store backing architecture where each console page range is backed once and aliased safely by multiple views/buffers while preserving: - exact GPU virtual-address offset semantics, - fence-safe GPU lifetime and deferred retirement, - shader write-back merging (`land.rs`) and write-combined rules (`wc.rs`), - submission ordering across in-flight command lists. - Alternatively, evaluate `VICTORY_WINDOW_WITHIN=1` standalone as a near-term mitigation with synthetic aliasing fixtures and release-package measurements. ## Acceptance Criteria - [ ] Synthetic D3D12 fixtures verify overlapping views/buffers read coherent CPU writes and GPU shader write-backs without hazards under the D3D12 debug layer. - [ ] `VICTORY_XFER=1` confirms a substantial drop in duplicate stale-page refreshes per frame and `memory split` confirms lower host RAM-side window memory. - [ ] Feature is gated behind an off-by-default `VICTORY_*` switch until validated in matched gameplay checkpoints.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-06 00:19:56 +00:00
This discussion has been locked. Commenting is limited to contributors.
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/VictoryX-dev--VictoryX#2
No description provided.