perf(gpu): pin hot BVH fault pages, extend Quiet copyback skip, FastMap draw tables, and cut card.check submits #399

Open
Androtim wants to merge 4 commits from upstream-pr/399 into main
Androtim commented 2026-12-03 16:25:02 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T16:25:02Z.


Summary

Scouts and ports Windows/D3D12-applicable performance, 8 GB VRAM residency, and GPU stability wins from GPL-3.0 upstream repositories lobomfz/VIctory-xmem and ReTerryDavis/ReVIctory onto Androtim/MiniVI:

  1. Hot BVH fault-page strike pinning (crates/victory-gpu/src/memory.rs) — Adapted from lobomfz/VIctory-xmem PR #255 (SETTLED = 4, GPL-3.0) for Windows D3D12:

    • Architectural note: VIctory-xmem PR #255 operates on um/residency.rs (Linux/vkd3d-proton Vulkan unified-memory page migration, reporting copy_ms 6.3 -> 1.0 ms/frame and >10 ms windows 6/30 -> 0). Windows-native D3D12 MiniVI has no um/residency.rs; its dynamic 64 KiB page thrash path under 8 GB VRAM limits (fault_pages_for = 256 MiB on 8 GB GPUs) is Memory's FaultQueues.
    • Adds FAULT_SETTLED = 4 persistent prompt eviction/re-fault (FAULT_SOON) strike tracking (FaultQueues), routing 4-strike hot pages to pinned_order so give_back() evicts cold unpinned pages first while falling back safely to pinned_order only when cold candidates are exhausted (and preserving FAULT_YOUNG safety).
    • Clears strike history on adopt, permanent unmap (look_again decommit / refused / packed release), and 2 * FAULT_YOUNG gc() expiry so recycled virtual addresses start fresh.
    • Prioritizes hot/recently-evicted pages when sorting pages against the per-frame FAULTS = 128 cap and reports pinned page counts.
  2. Non-carded Quiet copyback & snapshot suppression (crates/victory-gpu/src/shadow.rs) — 8 GB VRAM copyback reduction:

    • Extends Quiet (QUIET_AFTER = 64 consecutive zero-change compares, periodic AUDIT_EVERY = 32 audit, immediate CPU wake) to card.is_none() buffers in Shadow::gpu_writes and Shadow::note_quiet_compared_address.
    • Under 8 GB VRAM limits (CARD_REFUSED fallback) and for < 1 MiB UAV buffers, host-visible buffers now skip redundant per-frame Shadow::writing snapshots and copy_back_with / relay CPU diff scans once settled at zero changes.
  3. FastMap (AddressHash) for per-draw root & sweep tables (crates/victory-gpu/src/draw.rs) — Ported from lobomfz/VIctory-xmem PR #298 (GPL-3.0):

    • Replaces default SipHash HashMap with FastMap<K, V> (AddressHash) on root_srv_slots, root_uav_slots, and BufferSweep::unwatched / next_unwatched, matching neighboring fresh_tables / fresh_longest.
  4. card.check ExecuteCommandLists isolation (crates/victory-gpu/src/host.rs, crates/victory-gpu/src/host/check_cut.rs) — Ported from ReTerryDavis/ReVIctory PR #19 (GPL-3.0):

    • Splits ExecuteCommandLists before card.check across send_published and both submit (late and synchronous non-timing) paths so implicit COPY_DEST promotions decay to COMMON before card.check binds them as root SRVs (D3D12 debug layer ID 538 / RDNA2 TDR).

Upstream Attribution (GPL-3.0)

  • lobomfz/VIctory-xmem (verified gpl-3.0):
    • PR #255 (39a67fad234b14aa3c3c509caa749a066af528e0) — 4-strike hot page pinning (SETTLED = 4)
    • PR #298 (2e9fb291bcffc18a7233d001031d1ce778c3ea00) — AddressHash FastMap on per-draw root tables
  • ReTerryDavis/ReVIctory (verified gpl-3.0):
    • PR #19 (1d062cee27746206d62ef2b551b65cecd8bdc409) — ExecuteCommandLists cut before card.check

Inspected Upstream Targets Skipped (with Rationale)

  • lobomfz/VIctory-xmem PRs #263 (presets), #273 (Linux hidraw DualSense + WASAPI), #275 (Vulkan UM APU + LSFG bridge), #277 (Linux run.sh GTT/PSI guard): Linux/Wine/launcher-only or non-D3D12.
  • lobomfz/VIctory-xmem PR #294 (xma VLC lookup) & ReVIctory PR #22 (Snapshot pressure trim / AheadRanges): already present on Androtim/MiniVI main (xma.rs, shadow.rs, host.rs).
  • lobomfz/VIctory-xmem PR #329 (VICTORY_RECORD_PLACES/RANGES): applies to cuckoo records_table shader lowering not used by MiniVI.
  • lobomfz/VIctory-xmem PR #306 tight alignment (D3D12_RESOURCE_FLAG_USE_TIGHT_ALIGNMENT): not present in windows 0.62.2 crate bindings (MiniVI already uses D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT).

Verification

Toolchain +1.98.1-x86_64-pc-windows-gnu:

  • cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- policy -> asset policy: 354 files ok
  • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings -> passed cleanly
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib -- --test-threads=1 -> 868 passed; 0 failed; 39 ignored
    • Includes new unit/concurrency tests:
      • memory::tests::hot_fault_page_pins_after_four_round_trips_and_evicts_cold_pages_first
      • memory::tests::pinning_respects_fault_young_and_clears_history_on_adopt_unmap_or_gc
      • shadow::card_staging_tests::non_carded_shadow_suppresses_quiet_gpu_writes_after_zero_change_compares_and_wakes
      • host::check_cut::tests::cuts_before_card_check_when_preceded_by_other_lists
      • host::check_cut::tests::skips_cut_when_check_is_absent_or_first
<!-- greyfinch-sync:Androtim/MiniVI:issue:5630513334 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/399). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T16:25:02Z. --- ## Summary Scouts and ports Windows/D3D12-applicable performance, 8 GB VRAM residency, and GPU stability wins from GPL-3.0 upstream repositories [`lobomfz/VIctory-xmem`](https://github.com/lobomfz/VIctory-xmem) and [`ReTerryDavis/ReVIctory`](https://github.com/ReTerryDavis/ReVIctory) onto `Androtim/MiniVI`: 1. **Hot BVH fault-page strike pinning (`crates/victory-gpu/src/memory.rs`)** — Adapted from [`lobomfz/VIctory-xmem` PR #255](https://github.com/lobomfz/VIctory-xmem/pull/255) (`SETTLED = 4`, GPL-3.0) for Windows D3D12: - *Architectural note*: `VIctory-xmem` PR #255 operates on `um/residency.rs` (Linux/vkd3d-proton Vulkan unified-memory page migration, reporting `copy_ms` `6.3 -> 1.0 ms/frame` and `>10 ms` windows `6/30 -> 0`). Windows-native D3D12 `MiniVI` has no `um/residency.rs`; its dynamic 64 KiB page thrash path under 8 GB VRAM limits (`fault_pages_for` = 256 MiB on 8 GB GPUs) is `Memory`'s `FaultQueues`. - Adds `FAULT_SETTLED = 4` persistent prompt eviction/re-fault (`FAULT_SOON`) strike tracking (`FaultQueues`), routing 4-strike hot pages to `pinned_order` so `give_back()` evicts cold unpinned pages first while falling back safely to `pinned_order` only when cold candidates are exhausted (and preserving `FAULT_YOUNG` safety). - Clears strike history on `adopt`, permanent unmap (`look_again` decommit / `refused` / packed release), and `2 * FAULT_YOUNG` `gc()` expiry so recycled virtual addresses start fresh. - Prioritizes hot/recently-evicted pages when sorting `pages` against the per-frame `FAULTS = 128` cap and reports pinned page counts. 2. **Non-carded `Quiet` copyback & snapshot suppression (`crates/victory-gpu/src/shadow.rs`)** — 8 GB VRAM copyback reduction: - Extends `Quiet` (`QUIET_AFTER = 64` consecutive zero-change compares, periodic `AUDIT_EVERY = 32` audit, immediate CPU wake) to `card.is_none()` buffers in `Shadow::gpu_writes` and `Shadow::note_quiet_compared_address`. - Under 8 GB VRAM limits (`CARD_REFUSED` fallback) and for `< 1 MiB` UAV buffers, host-visible buffers now skip redundant per-frame `Shadow::writing` snapshots and `copy_back_with` / `relay` CPU diff scans once settled at zero changes. 3. **`FastMap` (`AddressHash`) for per-draw root & sweep tables (`crates/victory-gpu/src/draw.rs`)** — Ported from [`lobomfz/VIctory-xmem` PR #298](https://github.com/lobomfz/VIctory-xmem/pull/298) (GPL-3.0): - Replaces default SipHash `HashMap` with `FastMap<K, V>` (`AddressHash`) on `root_srv_slots`, `root_uav_slots`, and `BufferSweep::unwatched` / `next_unwatched`, matching neighboring `fresh_tables` / `fresh_longest`. 4. **`card.check` `ExecuteCommandLists` isolation (`crates/victory-gpu/src/host.rs`, `crates/victory-gpu/src/host/check_cut.rs`)** — Ported from [`ReTerryDavis/ReVIctory` PR #19](https://github.com/ReTerryDavis/ReVIctory/pull/19) (GPL-3.0): - Splits `ExecuteCommandLists` before `card.check` across `send_published` and both `submit` (`late` and synchronous non-timing) paths so implicit `COPY_DEST` promotions decay to `COMMON` before `card.check` binds them as root SRVs (D3D12 debug layer ID 538 / RDNA2 TDR). ## Upstream Attribution (GPL-3.0) - `lobomfz/VIctory-xmem` (verified `gpl-3.0`): - PR [#255](https://github.com/lobomfz/VIctory-xmem/pull/255) (`39a67fad234b14aa3c3c509caa749a066af528e0`) — 4-strike hot page pinning (`SETTLED = 4`) - PR [#298](https://github.com/lobomfz/VIctory-xmem/pull/298) (`2e9fb291bcffc18a7233d001031d1ce778c3ea00`) — `AddressHash` `FastMap` on per-draw root tables - `ReTerryDavis/ReVIctory` (verified `gpl-3.0`): - PR [#19](https://github.com/ReTerryDavis/ReVIctory/pull/19) (`1d062cee27746206d62ef2b551b65cecd8bdc409`) — `ExecuteCommandLists` cut before `card.check` ## Inspected Upstream Targets Skipped (with Rationale) - `lobomfz/VIctory-xmem` PRs #263 (presets), #273 (Linux hidraw DualSense + WASAPI), #275 (Vulkan UM APU + LSFG bridge), #277 (Linux `run.sh` GTT/PSI guard): Linux/Wine/launcher-only or non-D3D12. - `lobomfz/VIctory-xmem` PR #294 (`xma` VLC lookup) & `ReVIctory` PR #22 (`Snapshot` pressure trim / `AheadRanges`): already present on `Androtim/MiniVI` `main` (`xma.rs`, `shadow.rs`, `host.rs`). - `lobomfz/VIctory-xmem` PR #329 (`VICTORY_RECORD_PLACES`/`RANGES`): applies to cuckoo `records_table` shader lowering not used by `MiniVI`. - `lobomfz/VIctory-xmem` PR #306 tight alignment (`D3D12_RESOURCE_FLAG_USE_TIGHT_ALIGNMENT`): not present in `windows 0.62.2` crate bindings (`MiniVI` already uses `D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT`). ## Verification Toolchain `+1.98.1-x86_64-pc-windows-gnu`: - `cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- policy` -> `asset policy: 354 files ok` - `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings` -> passed cleanly - `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib -- --test-threads=1` -> `868 passed; 0 failed; 39 ignored` - Includes new unit/concurrency tests: - `memory::tests::hot_fault_page_pins_after_four_round_trips_and_evicts_cold_pages_first` - `memory::tests::pinning_respects_fault_young_and_clears_history_on_adopt_unmap_or_gc` - `shadow::card_staging_tests::non_carded_shadow_suppresses_quiet_gpu_writes_after_zero_change_compares_and_wakes` - `host::check_cut::tests::cuts_before_card_check_when_preceded_by_other_lists` - `host::check_cut::tests::skips_cut_when_check_is_absent_or_first`
Androtim commented 2026-12-03 16:33:27 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T16:33:27Z.


Triage (5e3fd75e, CI check PASS):

  • Clean Windows/D3D12 adaptation (+509/-106 across memory.rs, shadow.rs, draw.rs, host.rs, host/check_cut.rs): hot BVH fault-page strike pinning (FAULT_SETTLED = 4), non-carded Quiet copyback suppression for 8 GB VRAM, FastMap draw tables, and card.check submit cuts.
  • Holding auto-merge for Gate 2 Deep Reasoning Audit (#282) (especially non-carded Quiet invalidation on CPU/GPU writes and FaultQueues eviction/GC invariants) + Gate 3 plain --release A/B vs main (21fcafdc, 0 crashes/DRED) + --features diagnostics visual check.
<!-- greyfinch-sync:Androtim/MiniVI:comment:7385041420 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/399#issuecomment-7385041420). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T16:33:27Z. --- Triage (`5e3fd75e`, **CI `check` PASS**): - Clean Windows/D3D12 adaptation (`+509/-106` across `memory.rs`, `shadow.rs`, `draw.rs`, `host.rs`, `host/check_cut.rs`): hot BVH fault-page strike pinning (`FAULT_SETTLED = 4`), non-carded `Quiet` copyback suppression for 8 GB VRAM, `FastMap` draw tables, and `card.check` submit cuts. - Holding auto-merge for **Gate 2 Deep Reasoning Audit (`#282`)** (especially non-carded `Quiet` invalidation on CPU/GPU writes and `FaultQueues` eviction/GC invariants) + **Gate 3 plain `--release` A/B** vs `main` (`21fcafdc`, `0` crashes/DRED) + `--features diagnostics` visual check.
Androtim commented 2026-12-03 17:35:40 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T17:35:40Z.


Triage (ab04297b, CI check FAILURE — run 47157821317):

  • Swapped label to triage: needs work: victory-gpu unit test shadow::card_staging_tests::non_carded_shadow_never_quiets_and_recovers_gpu_writes_after_long_idle_streak failed at crates/victory-gpu/src/shadow.rs:9377:9 (assertion failed: written > 0, 871 passed; 1 failed).
  • Once fixed and CI check is green, we will continue to Gate 2 Audit (#282) + Gate 3 plain---release GPU A/B verification.
<!-- greyfinch-sync:Androtim/MiniVI:comment:7386759723 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/399#issuecomment-7386759723). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T17:35:40Z. --- Triage (`ab04297b`, **CI `check` FAILURE** — run `47157821317`): - Swapped label to `triage: needs work`: `victory-gpu` unit test **`shadow::card_staging_tests::non_carded_shadow_never_quiets_and_recovers_gpu_writes_after_long_idle_streak`** failed at `crates/victory-gpu/src/shadow.rs:9377:9` (`assertion failed: written > 0`, `871 passed; 1 failed`). - Once fixed and CI `check` is green, we will continue to Gate 2 Audit (`#282`) + Gate 3 plain-`--release` GPU A/B verification.
Androtim commented 2026-12-03 18:04:10 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T18:04:10Z.


Verified d5f4ddfe fixed the non_carded_shadow_never_quiets_and_recovers_gpu_writes_after_long_idle_streak failure and CI check is PASS again. Swapped label back to triage: needs gpu test — awaiting Gate 2 Audit (#282) + Gate 3 plain---release GPU A/B + visual check.

<!-- greyfinch-sync:Androtim/MiniVI:comment:7387548171 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/399#issuecomment-7387548171). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T18:04:10Z. --- Verified `d5f4ddfe` fixed the `non_carded_shadow_never_quiets_and_recovers_gpu_writes_after_long_idle_streak` failure and **CI `check` is PASS** again. Swapped label back to `triage: needs gpu test` — awaiting Gate 2 Audit (`#282`) + Gate 3 plain-`--release` GPU A/B + visual check.
Androtim commented 2026-12-03 19:02:05 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T19:02:05Z.


Automated triage for the maintainers (not an approval).

Verdict: needs-rebase · CI (check): passing

This PR no longer merges cleanly into main.

To change the verdict: Rebase onto current main and resolve conflicts; CI and triage will run again automatically.


Generated with Antigravity CLI (agy).

<!-- greyfinch-sync:Androtim/MiniVI:comment:7389053583 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/399#issuecomment-7389053583). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T19:02:05Z. --- <!-- minivi-triage v1 head=33185642a5e1f8848a113fb0ddcc238bfe07d898 verdict=needs-rebase ci=passing at=2026-12-04T02:02:45Z --> Automated triage for the maintainers (not an approval). **Verdict:** `needs-rebase` · **CI (`check`):** `passing` This PR no longer merges cleanly into `main`. **To change the verdict:** Rebase onto current `main` and resolve conflicts; CI and triage will run again automatically. --- _Generated with Antigravity CLI (`agy`)._
Androtim commented 2026-12-03 19:02:41 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T19:02:41Z.


Marking triage: needs rebase after #400 merged onto main (c59a8027). Once rebased with green CI, ready for Gate 2 + Gate 3 GPU A/B.

<!-- greyfinch-sync:Androtim/MiniVI:comment:7389068745 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/399#issuecomment-7389068745). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T19:02:41Z. --- Marking `triage: needs rebase` after `#400` merged onto `main` (`c59a8027`). Once rebased with green CI, ready for Gate 2 + Gate 3 GPU A/B.
Androtim commented 2026-12-03 20:01:47 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T20:01:47Z.


Verified clean merge with main (99bf4088) and CI check PASS. Swapped label to triage: needs gpu test — awaiting Gate 2 Audit + Gate 3 plain --release A/B + visual check.

<!-- greyfinch-sync:Androtim/MiniVI:comment:7390604912 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/399#issuecomment-7390604912). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T20:01:47Z. --- Verified clean merge with main (99bf4088) and CI check PASS. Swapped label to triage: needs gpu test — awaiting Gate 2 Audit + Gate 3 plain --release A/B + visual check.
Androtim commented 2026-12-03 22:31:20 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T22:31:20Z.


Marking triage: needs rebase after #404 (32f3e000) merged onto main. Once rebased cleanly with green CI, ready for Gate 2 + Gate 3 GPU A/B.

<!-- greyfinch-sync:Androtim/MiniVI:comment:7394322606 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/399#issuecomment-7394322606). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T22:31:20Z. --- Marking `triage: needs rebase` after `#404` (`32f3e000`) merged onto `main`. Once rebased cleanly with green CI, ready for Gate 2 + Gate 3 GPU A/B.
Androtim commented 2026-12-03 23:31:05 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T23:31:05Z.


Gate 3 Live RTX 4060 Ti Verification (3318564): FAIL — Held from v2026.12.04.01

  • 4K Lab Spec (--res 4k --dlss quality, RT OFF): Severe visual corruption observed at 95s — stretched diagonal geometry spike through vehicle/sky, missing character mesh, and pitch-black/checkerboard ground artifacts (253-580 dropped draws without host pipeline; Quiet skipping 347-394 declarations / ~249 MB in Series S).
  • Series S (--series-s --framegen 2 --fg-type dlss): Higher SUBMIT BUSY (57-64 ms vs 36-37 ms on main af09c98) and higher Shared VRAM (3.34 GB vs 2.95 GB).
  • Next step: Narrow or drop the overly aggressive Quiet copyback skip and isolate why 3318564 regressed geometry and submit times before re-running Gate 3.
<!-- greyfinch-sync:Androtim/MiniVI:comment:7395654567 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/399#issuecomment-7395654567). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T23:31:05Z. --- **Gate 3 Live RTX 4060 Ti Verification (`3318564`): FAIL — Held from `v2026.12.04.01`** - **4K Lab Spec (`--res 4k --dlss quality`, RT OFF):** Severe visual corruption observed at 95s — stretched diagonal geometry spike through vehicle/sky, missing character mesh, and pitch-black/checkerboard ground artifacts (`253-580` dropped draws without host pipeline; `Quiet` skipping `347-394` declarations / `~249 MB` in Series S). - **Series S (`--series-s --framegen 2 --fg-type dlss`):** Higher `SUBMIT BUSY` (`57-64 ms` vs `36-37 ms` on `main` `af09c98`) and higher Shared VRAM (`3.34 GB` vs `2.95 GB`). - **Next step:** Narrow or drop the overly aggressive `Quiet` copyback skip and isolate why `3318564` regressed geometry and submit times before re-running Gate 3.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/399:upstream-pr/399'
git switch 'upstream-pr/399'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/399'
git switch 'upstream-pr/399'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/399'
git switch 'upstream-pr/399'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/399'
git switch 'main'
git merge --squash 'upstream-pr/399'
git switch 'main'
git merge --ff-only 'upstream-pr/399'
git switch 'main'
git merge 'upstream-pr/399'
git push origin 'main'
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!399
No description provided.