Iter 18: Recycle RT/BVH fault-mapped arena pages with 8 GiB VRAM scaling #3

Merged
Androtim merged 1 commit from upstream-pr/3 into main 2026-11-28 21:16:53 +00:00
Androtim commented 2026-11-28 00:37:38 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T00:37:38Z.


Summary

Ports fxceless/victory-fork 3e573d2 ("Ray tracing: pages for the ray programs are a recycled budget, not a limit for the run") into crates/victory-gpu/src/memory.rs while preserving MiniVI's 8 GiB VRAM scaling and upstream 64d4931 protections:

  • Replaces the permanent whole-run FAULTS_ALL cap (where later faulted RT/BVH pages read zeros for the rest of the session) with a rolling FIFO fault-page budget that recycles pages older than FAULT_YOUNG (128 frames), splits walker vs. builder fault notes into a 2x fault buffer, prioritizes re-faulted evicted pages, and adopts fault pages touched by command lists or unpacked structures.
  • Scales the recycled fault budget by adapter VRAM budget via fault_pages_for() (128 MiB on <= 6 GiB, 256 MiB on <= 9 GiB, 512 MiB on > 9 GiB; overridable via VICTORY_BVH_FAULTS_ALL), while keeping most_pages() / spare_pages() VRAM scaling and card_room_for() safety headroom (90% on <= 9 GiB GPUs, 97% on > 9 GiB).
  • Preserves Memory::another()'s per-frame FAILED lockout guard and VirtualFree cleanup from 64d4931.
  • Touches only crates/victory-gpu/src/memory.rs (+470/-92) — zero merge conflicts with open PR #1 and PR #2.

Rig Specs Tested On

  • CPU: Intel Core i7-13700F (13th Gen)
  • GPU & VRAM: NVIDIA GeForce RTX 4060 Ti (8 GiB VRAM)
  • System RAM: 32 GiB (33,304,932 KiB visible)
  • OS & GPU Driver: Windows 11 Home (10.0.26300), NVIDIA driver 32.0.16.2124

Run Settings & Profile

  • Build & Commit SHA: diag / release @ f9de875
  • Console Profile & Internal Resolution / Scale: series-s (unattended live runtime smoke verification; CI & unit tests)
  • Ray Tracing: unit-tested logic; standalone live boot/menu/device smoke verification pending follow-up comment
  • Upscaling: off (unattended smoke test)
  • Frame Generation: off
  • Launcher Command / Preset & Extra VICTORY_* Overrides: default (VICTORY_BVH_FAULTS_ALL unset -> 256 MiB / 4,096 recycled fault pages on 8 GiB GPU)
  • Scene / Area & Session Length: Automated unit/policy/clippy suite + live unattended smoke check (in progress)

Measurements & Verification

  • Base FPS (without Frame Gen): N/A (automated offline + unattended boot smoke validation; standalone verify-live.ps1 + CI results will be posted below)
  • Frame-Gen FPS (if enabled): N/A
  • VRAM / RAM Usage: Scaled fault-page cap (256 MiB default on 8 GiB, 128 MiB on <= 6 GiB, 512 MiB on > 9 GiB) + 90% card_room_for() arena threshold on <= 9 GiB GPUs
  • Crashes / DRED Resets: 0
  • Automated Checks:
    • cargo clippy --workspace --all-targets -- -D warnings (0 warnings)
    • cargo clippy --workspace --all-targets --all-features -- -D warnings (0 warnings)
    • cargo test -p xtask (6 passed) + xtask policy (294 files ok)
    • Relevant crate unit tests (cargo test -p victory-gpu -- --test-threads=1: 452 passed; 0 failed; 36 ignored, including all 7 memory::tests::*)
<!-- greyfinch-sync:Androtim/MiniVI:issue:5534995114 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/3). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-28T00:37:38Z. --- ## Summary Ports `fxceless/victory-fork` `3e573d2` ("Ray tracing: pages for the ray programs are a recycled budget, not a limit for the run") into [`crates/victory-gpu/src/memory.rs`](crates/victory-gpu/src/memory.rs) while preserving MiniVI's 8 GiB VRAM scaling and upstream `64d4931` protections: - Replaces the permanent whole-run `FAULTS_ALL` cap (where later faulted RT/BVH pages read zeros for the rest of the session) with a rolling FIFO fault-page budget that recycles pages older than `FAULT_YOUNG` (128 frames), splits walker vs. builder fault notes into a 2x fault buffer, prioritizes re-faulted evicted pages, and adopts fault pages touched by command lists or unpacked structures. - Scales the recycled fault budget by adapter VRAM budget via `fault_pages_for()` (`128 MiB` on <= 6 GiB, `256 MiB` on <= 9 GiB, `512 MiB` on > 9 GiB; overridable via `VICTORY_BVH_FAULTS_ALL`), while keeping `most_pages()` / `spare_pages()` VRAM scaling and `card_room_for()` safety headroom (90% on <= 9 GiB GPUs, 97% on > 9 GiB). - Preserves `Memory::another()`'s per-frame `FAILED` lockout guard and `VirtualFree` cleanup from `64d4931`. - Touches only `crates/victory-gpu/src/memory.rs` (`+470/-92`) — zero merge conflicts with open PR #1 and PR #2. ## Rig Specs Tested On - **CPU:** Intel Core i7-13700F (13th Gen) - **GPU & VRAM:** NVIDIA GeForce RTX 4060 Ti (8 GiB VRAM) - **System RAM:** 32 GiB (`33,304,932` KiB visible) - **OS & GPU Driver:** Windows 11 Home (`10.0.26300`), NVIDIA driver `32.0.16.2124` ## Run Settings & Profile - **Build & Commit SHA:** `diag` / `release` @ `f9de875` - **Console Profile & Internal Resolution / Scale:** `series-s` (unattended live runtime smoke verification; CI & unit tests) - **Ray Tracing:** unit-tested logic; standalone live boot/menu/device smoke verification pending follow-up comment - **Upscaling:** `off` (unattended smoke test) - **Frame Generation:** `off` - **Launcher Command / Preset & Extra `VICTORY_*` Overrides:** default (`VICTORY_BVH_FAULTS_ALL` unset -> 256 MiB / 4,096 recycled fault pages on 8 GiB GPU) - **Scene / Area & Session Length:** Automated unit/policy/clippy suite + live unattended smoke check (in progress) ## Measurements & Verification - **Base FPS (without Frame Gen):** N/A (automated offline + unattended boot smoke validation; standalone `verify-live.ps1` + CI results will be posted below) - **Frame-Gen FPS (if enabled):** N/A - **VRAM / RAM Usage:** Scaled fault-page cap (`256 MiB` default on 8 GiB, `128 MiB` on <= 6 GiB, `512 MiB` on > 9 GiB) + 90% `card_room_for()` arena threshold on <= 9 GiB GPUs - **Crashes / DRED Resets:** `0` - **Automated Checks:** - [x] `cargo clippy --workspace --all-targets -- -D warnings` (0 warnings) - [x] `cargo clippy --workspace --all-targets --all-features -- -D warnings` (0 warnings) - [x] `cargo test -p xtask` (`6 passed`) + `xtask policy` (`294 files ok`) - [x] Relevant crate unit tests (`cargo test -p victory-gpu -- --test-threads=1`: `452 passed; 0 failed; 36 ignored`, including all 7 `memory::tests::*`)
Androtim commented 2026-11-28 00:43:14 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T00:43:14Z.


Automated triage for the maintainers (not an approval).

Verdict: needs-gpu-test · CI (check): passing

Automated Review Summary

Verdict: needs-gpu-test — Logic, memory-safety invariants, and VRAM-scaling integration look solid and CI is passing, but the PR modifies the D3D12 RT/BVH fault buffer layout and runtime VRAM eviction policy in crates/victory-gpu/src/memory.rs, which warrants a real-GPU ray-tracing smoke test before merging.

What Was Verified

  • Split fault buffer & GPU VA offset: Memory::new() doubles faults to MEMORY_FAULTS * 8 bytes (zeroed in full), ready() offsets Ready::faults by MEMORY_FAULTS * 4 bytes when builds is true, and Memory::take_faults() scans both halves while skipping dword 0 of each half (i == 0 and i == MEMORY_FAULTS). noted() deduplicates pages per frame while preserving builder ownership (first.1 |= same && later.1).
  • Recycling & ABA/adoption safety: Held::serial + Memory::holdings prevent stale order / fault_order entries from evicting or sweeping re-mapped pages. Memory::adopt() clears Held::fault and decrements fault_held whenever a list names a page (map_for(..., None)) or a packed structure unpacks into it (land()), preventing eviction of GPU-only builder state. When a recycled arena slot is reused, hold() initializes taken: 0, so bring() unconditionally merges and calls shadow.resend(...) for the full 64 KiB page.
  • VRAM scaling & existing guards preserved: fault_pages_for() scales the fault budget (128 MiB <= 6 GiB, 256 MiB <= 9 GiB, 512 MiB > 9 GiB, clamped to MOST on VICTORY_BVH_FAULTS_ALL override) and card_room_for() enforces 90% headroom on <= 9 GiB GPUs (97% on > 9 GiB). most_pages(), spare_pages(), and Memory::another()'s per-frame FAILED lockout + VirtualFree cleanup remain intact.
  • Scope & tests: Isolated to crates/victory-gpu/src/memory.rs with 4 new unit tests covering noted, goes_first, mark, fault_pages_for, and card_room_for. (Minor non-blocking note: give_back() only checks the queue chosen by goes_first() and returns false if its front entry is younger than FAULT_YOUNG, which is reasonable to avoid prematurely evicting builder pages.)

Run a live ray-tracing session on the 8 GiB RTX 4060 Ti with default settings (VICTORY_BVH_FAULTS_ALL unset -> 256 MiB / 4,096 fault pages) long enough to exceed FAULT_YOUNG (128+ frames) and trigger fault-page recycling:

  1. Confirm title memory by address: reports show from faults ... (<= 256 MB), non-zero given back for others once saturated, and bounded wanted again within 4 frames without runaway thrashing.
  2. Confirm VRAM usage stays within the 90% card_room_for() threshold without spilling arenas to system memory or triggering DRED/device removal.
  3. Verify no visual corruption or missing RT reflections/shadows compared to baseline.

Generated with Antigravity CLI (agy).

<!-- greyfinch-sync:Androtim/MiniVI:comment:7231141650 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/3#issuecomment-7231141650). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-28T00:43:14Z. --- <!-- minivi-triage v1 head=f9de87567dcb2a9f15c93d35b4f5710094f7b3c3 verdict=needs-gpu-test ci=passing at=2026-11-28T00:45:55Z --> Automated triage for the maintainers (not an approval). **Verdict:** `needs-gpu-test` · **CI (`check`):** `passing` ### Automated Review Summary **Verdict:** `needs-gpu-test` — Logic, memory-safety invariants, and VRAM-scaling integration look solid and CI is passing, but the PR modifies the D3D12 RT/BVH fault buffer layout and runtime VRAM eviction policy in `crates/victory-gpu/src/memory.rs`, which warrants a real-GPU ray-tracing smoke test before merging. ### What Was Verified - **Split fault buffer & GPU VA offset:** `Memory::new()` doubles `faults` to `MEMORY_FAULTS * 8` bytes (zeroed in full), `ready()` offsets `Ready::faults` by `MEMORY_FAULTS * 4` bytes when `builds` is true, and `Memory::take_faults()` scans both halves while skipping dword 0 of each half (`i == 0` and `i == MEMORY_FAULTS`). `noted()` deduplicates pages per frame while preserving builder ownership (`first.1 |= same && later.1`). - **Recycling & ABA/adoption safety:** `Held::serial` + `Memory::holdings` prevent stale `order` / `fault_order` entries from evicting or sweeping re-mapped pages. `Memory::adopt()` clears `Held::fault` and decrements `fault_held` whenever a list names a page (`map_for(..., None)`) or a packed structure unpacks into it (`land()`), preventing eviction of GPU-only builder state. When a recycled arena slot is reused, `hold()` initializes `taken: 0`, so `bring()` unconditionally merges and calls `shadow.resend(...)` for the full 64 KiB page. - **VRAM scaling & existing guards preserved:** `fault_pages_for()` scales the fault budget (`128 MiB` <= 6 GiB, `256 MiB` <= 9 GiB, `512 MiB` > 9 GiB, clamped to `MOST` on `VICTORY_BVH_FAULTS_ALL` override) and `card_room_for()` enforces 90% headroom on <= 9 GiB GPUs (97% on > 9 GiB). `most_pages()`, `spare_pages()`, and `Memory::another()`'s per-frame `FAILED` lockout + `VirtualFree` cleanup remain intact. - **Scope & tests:** Isolated to `crates/victory-gpu/src/memory.rs` with 4 new unit tests covering `noted`, `goes_first`, `mark`, `fault_pages_for`, and `card_room_for`. (Minor non-blocking note: `give_back()` only checks the queue chosen by `goes_first()` and returns `false` if its front entry is younger than `FAULT_YOUNG`, which is reasonable to avoid prematurely evicting builder pages.) ### Recommended Local GPU Test Run a live ray-tracing session on the 8 GiB RTX 4060 Ti with default settings (`VICTORY_BVH_FAULTS_ALL` unset -> 256 MiB / 4,096 fault pages) long enough to exceed `FAULT_YOUNG` (128+ frames) and trigger fault-page recycling: 1. Confirm `title memory by address:` reports show `from faults ... (<= 256 MB)`, non-zero `given back for others` once saturated, and bounded `wanted again within 4 frames` without runaway thrashing. 2. Confirm VRAM usage stays within the 90% `card_room_for()` threshold without spilling arenas to system memory or triggering DRED/device removal. 3. Verify no visual corruption or missing RT reflections/shadows compared to baseline. --- _Generated with Antigravity CLI (`agy`)._
Androtim commented 2026-11-28 00:47:03 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T00:47:03Z.


Verification summary for feat/iter18-rt-fault-page-recycling @ f9de875:

  • GitHub Actions CI: Run 46088894625 completed with success.
  • Policy & Tests:
    • cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- policy: asset policy: 294 files ok
    • cargo +1.98.1-x86_64-pc-windows-gnu test -p xtask: 6 passed; 0 failed
    • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings: 0 warnings
    • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-features --all-targets -- -D warnings: 0 warnings
    • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu -- --test-threads=1: 452 passed; 0 failed; 36 ignored (all 7 memory::tests::* including rt_fault_budget_and_card_room_scale_with_vram passed)
  • Standalone Binaries: Built diag\victory.exe, diag\victory_sm.exe, and release\victory.exe into D:\victory-build\minivi with RUSTFLAGS='-C link-self-contained=yes' (non_system_mingw_dlls=0 on all 3).
  • Live Unattended Smoke (verify-live.ps1): 32s, 3 active windows (max_draws=11), 30.0 fps (33.3 ms/frame), dropped=0, 6/7 [PASS]:
    • [PASS] Watchdog hook applied=2
    • [PASS] Active rendering reached
    • [PASS] 0 crashes or DRED resets
    • [PASS] DLSS / Streamline clean (loaded=2, fails=0)
    • [PASS] Process ran cleanly (exited_early=False)
    • [PASS] 0 lingering processes
    • [FAIL] $badWave64 list (untranslated_total=2, critical_fails=1): logged 6b82bc7d22016cb5 and 926c46bab3b86bd6 (no wave32 lowering for this wave64 program), plus 8 pre-existing ERROR victory_gpu::pool lines from book.rs. Both are pre-existing on main (f3c0c33) prior to open PR #1 (wave32 recovery) and open PR #2 (book.rs NVIDIA guard), unrelated to memory.rs.
<!-- greyfinch-sync:Androtim/MiniVI:comment:7231188450 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/3#issuecomment-7231188450). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-28T00:47:03Z. --- Verification summary for `feat/iter18-rt-fault-page-recycling` @ `f9de875`: - **GitHub Actions CI:** Run `46088894625` completed with `success`. - **Policy & Tests:** - `cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- policy`: `asset policy: 294 files ok` - `cargo +1.98.1-x86_64-pc-windows-gnu test -p xtask`: `6 passed; 0 failed` - `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings`: `0` warnings - `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-features --all-targets -- -D warnings`: `0` warnings - `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu -- --test-threads=1`: `452 passed; 0 failed; 36 ignored` (all 7 `memory::tests::*` including `rt_fault_budget_and_card_room_scale_with_vram` passed) - **Standalone Binaries:** Built `diag\victory.exe`, `diag\victory_sm.exe`, and `release\victory.exe` into `D:\victory-build\minivi` with `RUSTFLAGS='-C link-self-contained=yes'` (`non_system_mingw_dlls=0` on all 3). - **Live Unattended Smoke (`verify-live.ps1`):** `32s`, 3 active windows (`max_draws=11`), `30.0 fps` (`33.3 ms/frame`), `dropped=0`, **6/7 `[PASS]`**: - `[PASS]` Watchdog hook `applied=2` - `[PASS]` Active rendering reached - `[PASS]` `0` crashes or DRED resets - `[PASS]` DLSS / Streamline clean (`loaded=2, fails=0`) - `[PASS]` Process ran cleanly (`exited_early=False`) - `[PASS]` `0` lingering processes - `[FAIL]` `$badWave64` list (`untranslated_total=2, critical_fails=1`): logged `6b82bc7d22016cb5` and `926c46bab3b86bd6` (`no wave32 lowering for this wave64 program`), plus 8 pre-existing `ERROR victory_gpu::pool` lines from `book.rs`. Both are pre-existing on `main` (`f3c0c33`) prior to open PR #1 (`wave32` recovery) and open PR #2 (`book.rs` NVIDIA guard), unrelated to `memory.rs`.
Androtim commented 2026-11-28 21:11:17 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T21:11:17Z.


Real-GPU Playtest Report (Combined Build 1 Stack — RT ON)

Tested in combined Build 1 (origin/main + Build 1 PRs including #3, #4, #7, #10) on NVIDIA GeForce RTX 4060 Ti (8 GB), Windows, Series S (quality-720p, DLSS Quality, -RayTracing):

  • Duration & Stability: 7-minute RT-ON open-world session (1c-build1-rt.log) — 0 crashes, 0 DRED resets, clean exit.
  • Performance: 7.6 fps (132.2 ms/frame, 4,022 draws/frame).
  • RT / Memory Telemetry:
    • Active RT/BVH builds (12,653 pages / 790 MB across 13 arenas, 98 build dispatches/frame).
    • 0 "a shader reads view addresses without a view heap set" warnings.
    • 1,374 DLSS upscalings (0 failed); VRAM stayed bounded (6,460 MB in use, 554 MB free across 27 texture blocks).
<!-- greyfinch-sync:Androtim/MiniVI:comment:7245835285 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/3#issuecomment-7245835285). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-28T21:11:17Z. --- ### Real-GPU Playtest Report (Combined Build 1 Stack — RT ON) Tested in combined Build 1 (`origin/main` + Build 1 PRs including `#3, #4, #7, #10`) on **NVIDIA GeForce RTX 4060 Ti (8 GB), Windows, Series S (`quality-720p`, DLSS Quality, `-RayTracing`)**: - **Duration & Stability:** **7-minute** RT-ON open-world session (`1c-build1-rt.log`) — **0 crashes, 0 DRED resets**, clean exit. - **Performance:** `7.6 fps` (`132.2 ms/frame`, `4,022` draws/frame). - **RT / Memory Telemetry:** - Active RT/BVH builds (`12,653` pages / `790 MB` across `13` arenas, `98` build dispatches/frame). - `0` `"a shader reads view addresses without a view heap set"` warnings. - `1,374` DLSS upscalings (`0` failed); VRAM stayed bounded (`6,460 MB` in use, `554 MB` free across `27` texture blocks).
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
Androtim/MiniVI!3
No description provided.