perf(gpu): cache per-HostList RTV/DSV states, batch/window uses, and bindless heap tables #388

Merged
Androtim merged 3 commits from upstream-pr/388 into main 2026-12-03 13:05:40 +00:00
Androtim commented 2026-12-03 12:30:05 +00:00 (Migrated from github.com)

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


Summary

Eliminates tens of thousands of redundant per-draw mutex locks (\HostList::states, \HostList::deferred) and global \host_copy\ / \ win\ / \descriptor::heap\ lookups across open-world frames (~6k–10k draws/frame):

  1. Monotonic \HostList::use_id\ & \HostList::state_epoch\ (\crates/victory-gpu/src/host.rs):
    • \use_id\ is assigned on creation and bumped on every \HostList::reset().
    • \state_epoch\ is bumped on creation, \HostList::reset(), and every texture-state or depth-twin mutation (\ ransition_checked, \settle, \ win_use, \ wins_written).
  2. Per-\HostList\ RTV/DSV state cache in \State::prepare_for\ (\crates/victory-gpu/src/draw.rs, \list.rs):
    • Skips redundant \ensure_state\ + \ win_use\ calls when \list.state_epoch()\ and resolved \depth_wanted\ (\DEPTH_WRITE\ / \DEPTH_READ\ / \DEPTH_READ | SHADER_RESOURCE) match the previous draw on the same \HostList.
    • Invalidated automatically on \State::set_targets, any non-draw texture transition (\clear_rtv, \clear_dsv, \copy,
      esolve,
      eadable\ SRV/UAV barriers, depth-twin copies), \HostList::reset, or list cuts; never caches if any target lacked a live \host_copy.
  3. Lock-free \use_id\ validation for indirect batch/window and bindless heap tables (\crates/victory-gpu/src/draw.rs):
    • Replaces per-indirect \list.first_use(BATCH_USE)\ and \list.first_use(WINDOW_USE)\ (\deferred.lock()) with \atch_use_id\ / \window_use_id.
    • Caches (use_id, heaps, gpu)\ for \heap_buffers, \heap_strides, and \heap_addresses\ so repeat draws on the same list skip \descriptor::heap\ walks and \list.first_use\ locks.

Verification

  • \cargo test -p victory-gpu --lib\ (all 839 active tests pass)
  • \cargo clippy -p victory-gpu --all-targets -- -D warnings\ (0 warnings)
  • Gate 3 live RTX 4060 Ti visual & FPS verification in progress.
<!-- greyfinch-sync:Androtim/MiniVI:issue:5626516343 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/388). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T12:30:05Z. --- ## Summary Eliminates tens of thousands of redundant per-draw mutex locks (\HostList::states\, \HostList::deferred\) and global \host_copy\ / \ win\ / \descriptor::heap\ lookups across open-world frames (~6k–10k draws/frame): 1. **Monotonic \HostList::use_id\ & \HostList::state_epoch\ (\crates/victory-gpu/src/host.rs\):** - \use_id\ is assigned on creation and bumped on every \HostList::reset()\. - \state_epoch\ is bumped on creation, \HostList::reset()\, and every texture-state or depth-twin mutation (\ ransition_checked\, \settle\, \ win_use\, \ wins_written\). 2. **Per-\HostList\ RTV/DSV state cache in \State::prepare_for\ (\crates/victory-gpu/src/draw.rs\, \list.rs\):** - Skips redundant \ensure_state\ + \ win_use\ calls when \list.state_epoch()\ and resolved \depth_wanted\ (\DEPTH_WRITE\ / \DEPTH_READ\ / \DEPTH_READ | SHADER_RESOURCE\) match the previous draw on the same \HostList\. - Invalidated automatically on \State::set_targets\, any non-draw texture transition (\clear_rtv\, \clear_dsv\, \copy\, \ esolve\, \ eadable\ SRV/UAV barriers, depth-twin copies), \HostList::reset\, or list cuts; never caches if any target lacked a live \host_copy\. 3. **Lock-free \use_id\ validation for indirect batch/window and bindless heap tables (\crates/victory-gpu/src/draw.rs\):** - Replaces per-indirect \list.first_use(BATCH_USE)\ and \list.first_use(WINDOW_USE)\ (\deferred.lock()\) with \atch_use_id\ / \window_use_id\. - Caches \(use_id, heaps, gpu)\ for \heap_buffers\, \heap_strides\, and \heap_addresses\ so repeat draws on the same list skip \descriptor::heap\ walks and \list.first_use\ locks. ## Verification - \cargo test -p victory-gpu --lib\ (all 839 active tests pass) - \cargo clippy -p victory-gpu --all-targets -- -D warnings\ (0 warnings) - Gate 3 live RTX 4060 Ti visual & FPS verification in progress.
Androtim commented 2026-12-03 12:39:59 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T12:39:59Z.


3-Gate Verification Summary (commit \2d7c529)

  • Gate 1 (GitHub CI \check): PASS (\7m26s)
  • Gate 2 (Read-only Reasoning Audit): VERIFIED CLEAN (0 P0, 0 P1, 0 P2) — logged on #282 (Pass #15).
  • Gate 3 (Live RTX 4060 Ti 8G): PASS (\1440\ DLSS Quality, \
<!-- greyfinch-sync:Androtim/MiniVI:comment:7378655858 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/388#issuecomment-7378655858). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T12:39:59Z. --- ### 3-Gate Verification Summary (commit \2d7c529\) - **Gate 1 (GitHub CI \check\):** PASS (\7m26s\) - **Gate 2 (Read-only Reasoning Audit):** **VERIFIED CLEAN (0 P0, 0 P1, 0 P2)** — logged on #282 (Pass #15). - **Gate 3 (Live RTX 4060 Ti 8G):** PASS (\1440\ DLSS Quality, \
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!388
No description provided.