memory: recycle a 512 MB budget of ray-tracing fault pages #401

Closed
Kikoarl wants to merge 1 commit from upstream-pr/401 into main
Kikoarl commented 2026-11-27 21:55:13 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Kikoarl on 2026-11-27T21:55:13Z.


Summary

Ports the 512 MB recycled ray-tracing fault-page budget and fault-miss breakdown from fxceless/victory-fork commit 3e573d2556adc5a5b22ccd2d6d92231a72ee55bb (GPL-3.0-or-later), rebased onto main (df2daaf).

Changes

  • crates/victory-gpu/src/memory.rs:
    • Tracks fault-allocated ray-tracing pages separately under a 512 MB budget, recycles oldest fault pages first when pressure hits (goes_first, fault_room, give_back), and reports the per-frame fault-miss breakdown while preserving merged PR #88 (Memory::another).

Distinct from PR #181 (shadow::exact() buffer pooling) and PR #295 (placed-page write-watch stamps).

Verification

Verified on Windows (x86_64-pc-windows-msvc) against main (df2daaf):

  • git diff --check main..HEAD — clean
  • cargo test -p xtask --locked — 6 passed, 0 failed (asset policy: 287 files ok)
  • cargo clippy -p victory-gpu --all-targets --locked — exit 0, 0 warnings in changed files (main has pre-existing clippy warnings in untouched files)
  • cargo test -p victory-gpu --locked memory:: — 5 passed, 0 failed
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5533587445 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/401). Originally posted by [Kikoarl](https://github.com/Kikoarl) on 2026-11-27T21:55:13Z. --- ### Summary Ports the 512 MB recycled ray-tracing fault-page budget and fault-miss breakdown from `fxceless/victory-fork` commit `3e573d2556adc5a5b22ccd2d6d92231a72ee55bb` (`GPL-3.0-or-later`), rebased onto `main` (`df2daaf`). ### Changes - **`crates/victory-gpu/src/memory.rs`**: - Tracks fault-allocated ray-tracing pages separately under a 512 MB budget, recycles oldest fault pages first when pressure hits (`goes_first`, `fault_room`, `give_back`), and reports the per-frame fault-miss breakdown while preserving merged PR #88 (`Memory::another`). Distinct from PR #181 (`shadow::exact()` buffer pooling) and PR #295 (placed-page write-watch stamps). ### Verification Verified on Windows (`x86_64-pc-windows-msvc`) against `main` (`df2daaf`): - `git diff --check main..HEAD` — clean - `cargo test -p xtask --locked` — 6 passed, 0 failed (`asset policy: 287 files ok`) - `cargo clippy -p victory-gpu --all-targets --locked` — exit 0, 0 warnings in changed files (`main` has pre-existing clippy warnings in untouched files) - `cargo test -p victory-gpu --locked memory::` — 5 passed, 0 failed
Mumogg commented 2026-11-28 16:59:16 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Mumogg on 2026-11-28T16:59:16Z.


Data point from Linux (Wine + GE vkd3d-proton, RTX 5070 Ti 16 GB, Series X profile, title ray tracing on with VICTORY_BVH_BUILDER=1). Two 8-minute runs on the same save, without and with fxceless 3e573d25 (the same change as this PR):

  • Without: "faults in all" reached the run-wide cap of 2048 about 35 s after ray tracing started and stayed there for the rest of the run. Every fault warning after that point said made=0, with about 150-330 pages a frame left without a copy. Cars turned lime green about when the cap was reached.
  • With: "faults in all" kept climbing (15,700 by the end of the run), and pages kept being made late in the run, so the cap no longer runs out.

On frame rate: ray tracing stays expensive on this card (9-12 fps at 4K output), but that cost is separate from this change. The builder dispatches (150-1500 a frame) account for most of it. (AI-assisted test and write-up.)

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7242665762 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/401#issuecomment-7242665762). Originally posted by [Mumogg](https://github.com/Mumogg) on 2026-11-28T16:59:16Z. --- Data point from Linux (Wine + GE vkd3d-proton, RTX 5070 Ti 16 GB, Series X profile, title ray tracing on with VICTORY_BVH_BUILDER=1). Two 8-minute runs on the same save, without and with fxceless 3e573d25 (the same change as this PR): - **Without:** "faults in all" reached the run-wide cap of 2048 about 35 s after ray tracing started and stayed there for the rest of the run. Every fault warning after that point said `made=0`, with about 150-330 pages a frame left without a copy. Cars turned lime green about when the cap was reached. - **With:** "faults in all" kept climbing (15,700 by the end of the run), and pages kept being made late in the run, so the cap no longer runs out. On frame rate: ray tracing stays expensive on this card (9-12 fps at 4K output), but that cost is separate from this change. The builder dispatches (150-1500 a frame) account for most of it. (AI-assisted test and write-up.)
trustno1-coder commented 2026-11-28 20:23:16 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-11-28T20:23:16Z.


Thanks for this. I'm closing it without merging because #722 covers the same problem (#688: the faulted-page budget ran out and never came back) and is going into main: faulted pages are kept under a reusable budget (VICTORY_RT_FAULT_MB, VICTORY_RT_FAULT_KEEP). The two conflict throughout memory.rs. If yours does something #722 doesn't, please rebase it on main once #722 is in and open a new pull request.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7245248652 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/401#issuecomment-7245248652). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-11-28T20:23:16Z. --- Thanks for this. I'm closing it without merging because #722 covers the same problem (#688: the faulted-page budget ran out and never came back) and is going into main: faulted pages are kept under a reusable budget (`VICTORY_RT_FAULT_MB`, `VICTORY_RT_FAULT_KEEP`). The two conflict throughout memory.rs. If yours does something #722 doesn't, please rebase it on main once #722 is in and open a new pull request.

Pull request closed

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