perf(gpu): WC metadata shadow, scoped copy barriers, dual-CCD list placement, resting filter & 512 late-list cap (Wave 9B) #425

Merged
Androtim merged 3 commits from upstream-pr/425 into main 2026-12-04 08:46:27 +00:00
Androtim commented 2026-12-04 07:49:35 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T07:49:35Z.


Wave 9B: Raw CPU FPS, VRAM Drain & Legacy Pipeline Library Guard

Ports verified GPL-3.0 upstream CPU/GPU frame-time optimizations cleanly onto MiniVI (ab8e337) without regressing PRs #415, #417, #421, #422, or #423.

Ported Optimizations & Upstream Attribution

  1. ReTerryDavis/ReVIctory commit 1ee967b (GPL-3.0):

    • Dual-CCD L3-cache detection & list-translator placement (crates/victory-gpu/src/cores.rs, crates/victory-gpu/src/list/thin.rs):
      • Adds parse_l3_cache_records(), l3_of_sets(), cache_cores() (VICTORY_CACHE_CORES=0 to disable, on by default), and fast_by_cache() so uniform-efficiency-class dual-CCD X3D CPUs identify the larger-L3 CCD as fast sets.
      • Parses variable-length GetLogicalProcessorInformationEx(RelationCache, ...) records via raw-pointer offset reads (offset_of!(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, Anonymous) 8-byte header) so 56-byte RelationCache records (including the final record) are read safely without forming an 80-byte &SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX reference.
      • Adds list_other() (VICTORY_LIST_OTHER=0 to disable, on by default), list_sets(), and cores::translates(), called from list/thin.rs worker startup so list translators run on non-fast sets (second CCD / E-cores) away from the submitting lane and its helpers.
      • Added unit tests cores::tests::dual_ccd_cache_detection_and_list_other_placement and cores::tests::parse_l3_cache_records_reads_final_56_byte_record.
    • Write-combining metadata RAM shadow (crates/victory-gpu/src/descriptor/host.rs):
      • Adds stride_shadow: Box<[AtomicU32]> and address_shadow: Box<[AtomicU64]> to HostHeap and checks them in write_stride() / write_address() before issuing WC write_volatile stores, skipping redundant write-combining bus flushes when slot metadata is unchanged.
    • Scoped buffer-copy barriers (crates/victory-gpu/src/host/place.rs):
      • Adds copy_barrier_desc(before, raytracing) and copy_barrier() using an enhanced D3D12_GLOBAL_BARRIER scoped to shader/copy/indirect/index stages (plus D3D12_BARRIER_SYNC_BUILD_RAYTRACING_ACCELERATION_STRUCTURE when crate::hwrt::active() is true) and buffer accesses (excluding RENDER_TARGET and DEPTH_STENCIL pipelines), falling back to wait_for_all() when enhanced barriers or ID3D12GraphicsCommandList7 are unavailable.
      • Routes place_copy() and place_source() transition barriers through Rec::barriers() instead of direct ResourceBarrier().
      • Added unit test host::place::tests::copy_barrier_desc_excludes_render_and_depth_targets covering both raytracing = false and raytracing = true.
    • Lock-free Bits::has & RESTING filter (crates/victory-gpu/src/watch.rs):
      • Adds lock-free read-only Bits::has() and static RESTING: Bits checked in Guards::rests() before probing Guards::opened, set in Guards::opened_at(), and cleared on expiry in Guards::rests() (preserving rest.max(hot) semantics).
      • Added unit test watch::ask_holds::resting_filter_tracks_opened_blocks_and_clears_on_expiry.
  2. ReTerryDavis/ReVIctory commit aefb79b (GPL-3.0, GPU parts only):

    • Raise late-list cap to 512 (crates/victory-gpu/src/host.rs):
      • Raises VICTORY_LATE_WAIT_LISTS (late_most()) default from 256 to 512 to prevent per-frame submission stalls waiting on lists in flight.

Intentionally Skipped / Preserved from Prior MiniVI PRs

  • PR #415 preserved: crates/victory-gpu/src/host/rec.rs (coalesced direct barriers with UAV/aliasing folding guards) is untouched; host/place.rs uses Rec::barriers() and Rec::deref() flushing via rec.cast::<ID3D12GraphicsCommandList7>().
  • PR #417 preserved: All uniform-core VICTORY_LANE_PRIORITY / VICTORY_HELPER_PRIORITY (Part::Lane/Helper/Beside) registration and tid-deduplication logic in cores.rs is preserved intact.
  • PR #422 & #423 preserved: descriptor.rs bounded placed-view table/eviction, cross-watch-page descriptor mirroring, descriptor/host.rs single-borrow MIRROR_CACHE with views_entry_alive / slot.touch(), and watch.rs open_resolved_with() alias open count (ALIASES[1]) are all preserved intact.
  • Skipped from 1ee967b (N/A in MiniVI): soft.rs write-watch filters (host/refresh.rs, shadow.rs, watch.rs), Claims/BUSY TTAS spinlocks (MiniVI uses 64-shard GUARD_SHARDS), host/scratch.rs, list/groups.rs, and list/thin.rs calls < 512 urgent-yield guard (none of these subsystems exist in MiniVI).
  • Skipped from aefb79b:
    • apps/victory/build.rs, launcher.rs, Cargo.toml, Cargo.lock (zlib DLL compression — strictly out of scope).
    • draw.rs (bake::Picks::These / aside::texture_pass_here / ahead::wait_idle): N/A in MiniVI (MiniVI uses synchronous BAKE_UPLOAD with BAKE_SERVED fast-skip).
    • vram.rs (plan()): N/A in MiniVI (MiniVI has no vram.rs; host.rs::vram_keep_below() already uses 5_000 ms up to 95% and 600_000 ms below line - 2%).
  • Verified already covered (tyr0nsur/Darner f3840d7, PR #192, GPL-3.0): MiniVI's pipeline/library.rs only loads from a single library_dir() with no adapter-scoped subdirectory / legacy-root fallback, so PR #421's made_by_another_build() (VICTORY_LIBRARY_KEEP_OLD=1) already guards the sole library directory for both host-pipelines.bin and host-pipelines.next.

Verification

  • cargo xtask policy: PASS (asset policy: 365 files ok)
  • cargo clippy --workspace --all-targets -- -D warnings: PASS (0 warnings, 0 errors)
  • cargo test -p victory-gpu --lib -- cores place: 53 passed, 0 failed, 2 ignored
  • cargo test -p victory-gpu --lib -- cores::tests host::place::tests host::rec::tests pipeline::library::tests::a_library_from_another_builds_translator_is_not_loaded: PASS
  • cargo test -p victory-gpu --lib -- --test-threads=1 local_shapes_cache_resolves_and_deduplicates_across_threads resting_filter_tracks_opened_blocks_and_clears_on_expiry: 2 passed, 0 failed
  • cargo test -p victory-gpu --lib -- host::batch_tests:: descriptor::tests:: (excluding parallel local_shapes_cache, verified serialized above): 34 passed, 0 failed, 1 ignored
  • cargo test -p victory-gpu --lib --features diagnostics -- open_resolved_with_counts_cleared_clean_aliases resting_filter_tracks_opened_blocks_and_clears_on_expiry: 2 passed, 0 failed
<!-- greyfinch-sync:Androtim/MiniVI:issue:5642559518 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/425). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-04T07:49:35Z. --- ## Wave 9B: Raw CPU FPS, VRAM Drain & Legacy Pipeline Library Guard Ports verified **GPL-3.0** upstream CPU/GPU frame-time optimizations cleanly onto MiniVI (`ab8e337`) without regressing PRs #415, #417, #421, #422, or #423. ### Ported Optimizations & Upstream Attribution 1. **ReTerryDavis/ReVIctory commit `1ee967b` (GPL-3.0):** - **Dual-CCD L3-cache detection & list-translator placement (`crates/victory-gpu/src/cores.rs`, `crates/victory-gpu/src/list/thin.rs`):** - Adds `parse_l3_cache_records()`, `l3_of_sets()`, `cache_cores()` (`VICTORY_CACHE_CORES=0` to disable, on by default), and `fast_by_cache()` so uniform-efficiency-class dual-CCD X3D CPUs identify the larger-L3 CCD as fast sets. - Parses variable-length `GetLogicalProcessorInformationEx(RelationCache, ...)` records via raw-pointer offset reads (`offset_of!(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, Anonymous)` 8-byte header) so 56-byte `RelationCache` records (including the final record) are read safely without forming an 80-byte `&SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX` reference. - Adds `list_other()` (`VICTORY_LIST_OTHER=0` to disable, on by default), `list_sets()`, and `cores::translates()`, called from `list/thin.rs` worker startup so list translators run on non-fast sets (second CCD / E-cores) away from the submitting lane and its helpers. - Added unit tests `cores::tests::dual_ccd_cache_detection_and_list_other_placement` and `cores::tests::parse_l3_cache_records_reads_final_56_byte_record`. - **Write-combining metadata RAM shadow (`crates/victory-gpu/src/descriptor/host.rs`):** - Adds `stride_shadow: Box<[AtomicU32]>` and `address_shadow: Box<[AtomicU64]>` to `HostHeap` and checks them in `write_stride()` / `write_address()` before issuing WC `write_volatile` stores, skipping redundant write-combining bus flushes when slot metadata is unchanged. - **Scoped buffer-copy barriers (`crates/victory-gpu/src/host/place.rs`):** - Adds `copy_barrier_desc(before, raytracing)` and `copy_barrier()` using an enhanced `D3D12_GLOBAL_BARRIER` scoped to shader/copy/indirect/index stages (plus `D3D12_BARRIER_SYNC_BUILD_RAYTRACING_ACCELERATION_STRUCTURE` when `crate::hwrt::active()` is true) and buffer accesses (excluding `RENDER_TARGET` and `DEPTH_STENCIL` pipelines), falling back to `wait_for_all()` when enhanced barriers or `ID3D12GraphicsCommandList7` are unavailable. - Routes `place_copy()` and `place_source()` transition barriers through `Rec::barriers()` instead of direct `ResourceBarrier()`. - Added unit test `host::place::tests::copy_barrier_desc_excludes_render_and_depth_targets` covering both `raytracing = false` and `raytracing = true`. - **Lock-free `Bits::has` & `RESTING` filter (`crates/victory-gpu/src/watch.rs`):** - Adds lock-free read-only `Bits::has()` and `static RESTING: Bits` checked in `Guards::rests()` before probing `Guards::opened`, set in `Guards::opened_at()`, and cleared on expiry in `Guards::rests()` (preserving `rest.max(hot)` semantics). - Added unit test `watch::ask_holds::resting_filter_tracks_opened_blocks_and_clears_on_expiry`. 2. **ReTerryDavis/ReVIctory commit `aefb79b` (GPL-3.0, GPU parts only):** - **Raise late-list cap to 512 (`crates/victory-gpu/src/host.rs`):** - Raises `VICTORY_LATE_WAIT_LISTS` (`late_most()`) default from 256 to 512 to prevent per-frame submission stalls waiting on lists in flight. ### Intentionally Skipped / Preserved from Prior MiniVI PRs - **PR #415 preserved:** `crates/victory-gpu/src/host/rec.rs` (coalesced direct barriers with UAV/aliasing folding guards) is untouched; `host/place.rs` uses `Rec::barriers()` and `Rec::deref()` flushing via `rec.cast::<ID3D12GraphicsCommandList7>()`. - **PR #417 preserved:** All uniform-core `VICTORY_LANE_PRIORITY` / `VICTORY_HELPER_PRIORITY` (`Part::Lane`/`Helper`/`Beside`) registration and tid-deduplication logic in `cores.rs` is preserved intact. - **PR #422 & #423 preserved:** `descriptor.rs` bounded placed-view table/eviction, cross-watch-page descriptor mirroring, `descriptor/host.rs` single-borrow `MIRROR_CACHE` with `views_entry_alive` / `slot.touch()`, and `watch.rs` `open_resolved_with()` alias open count (`ALIASES[1]`) are all preserved intact. - **Skipped from `1ee967b` (N/A in MiniVI):** `soft.rs` write-watch filters (`host/refresh.rs`, `shadow.rs`, `watch.rs`), `Claims`/`BUSY` TTAS spinlocks (MiniVI uses 64-shard `GUARD_SHARDS`), `host/scratch.rs`, `list/groups.rs`, and `list/thin.rs` `calls < 512` urgent-yield guard (none of these subsystems exist in MiniVI). - **Skipped from `aefb79b`:** - `apps/victory/build.rs`, `launcher.rs`, `Cargo.toml`, `Cargo.lock` (zlib DLL compression — strictly out of scope). - `draw.rs` (`bake::Picks::These` / `aside::texture_pass_here` / `ahead::wait_idle`): N/A in MiniVI (MiniVI uses synchronous `BAKE_UPLOAD` with `BAKE_SERVED` fast-skip). - `vram.rs` (`plan()`): N/A in MiniVI (MiniVI has no `vram.rs`; `host.rs::vram_keep_below()` already uses 5_000 ms up to 95% and 600_000 ms below `line - 2%`). - **Verified already covered (`tyr0nsur/Darner` `f3840d7`, PR #192, GPL-3.0):** MiniVI's `pipeline/library.rs` only loads from a single `library_dir()` with no adapter-scoped subdirectory / legacy-root fallback, so PR #421's `made_by_another_build()` (`VICTORY_LIBRARY_KEEP_OLD=1`) already guards the sole library directory for both `host-pipelines.bin` and `host-pipelines.next`. ### Verification - `cargo xtask policy`: **PASS** (asset policy: 365 files ok) - `cargo clippy --workspace --all-targets -- -D warnings`: **PASS** (0 warnings, 0 errors) - `cargo test -p victory-gpu --lib -- cores place`: **53 passed, 0 failed, 2 ignored** - `cargo test -p victory-gpu --lib -- cores::tests host::place::tests host::rec::tests pipeline::library::tests::a_library_from_another_builds_translator_is_not_loaded`: **PASS** - `cargo test -p victory-gpu --lib -- --test-threads=1 local_shapes_cache_resolves_and_deduplicates_across_threads resting_filter_tracks_opened_blocks_and_clears_on_expiry`: **2 passed, 0 failed** - `cargo test -p victory-gpu --lib -- host::batch_tests:: descriptor::tests::` (excluding parallel `local_shapes_cache`, verified serialized above): **34 passed, 0 failed, 1 ignored** - `cargo test -p victory-gpu --lib --features diagnostics -- open_resolved_with_counts_cleared_clean_aliases resting_filter_tracks_opened_blocks_and_clears_on_expiry`: **2 passed, 0 failed**
Androtim commented 2026-12-04 08:02:02 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T08:02:02Z.


Triage (7c1ed141, CI check PASS, MERGEABLE):

  • Clean, 100% title-neutral Wave 9B CPU/GPU perf port (+351/-26 across 6 files, zero opt-in toggles — VICTORY_CACHE_CORES=0 & VICTORY_LIST_OTHER=0 are default-on with =0 kill-switches, VICTORY_LATE_WAIT_LISTS raises default 256 -> 512): dual-CCD L3-cache placement, WC metadata shadow (stride_shadow/address_shadow), scoped D3D12_GLOBAL_BARRIER buffer-copy barriers, lock-free resting filter (watch.rs), and 512 late-list cap.
  • Note: overlaps crates/victory-gpu/src/host.rs with #426 (whichever merges second will need a quick rebase).
  • Marked triage: needs gpu test — awaiting Gate 2 Audit (#282) + Gate 3 1440p/4K plain---release A/B verification.
<!-- greyfinch-sync:Androtim/MiniVI:comment:7405410232 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/425#issuecomment-7405410232). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-04T08:02:02Z. --- Triage (`7c1ed141`, **CI `check` PASS**, `MERGEABLE`): - Clean, 100% title-neutral Wave 9B CPU/GPU perf port (`+351/-26` across 6 files, **zero opt-in toggles** — `VICTORY_CACHE_CORES=0` & `VICTORY_LIST_OTHER=0` are default-on with `=0` kill-switches, `VICTORY_LATE_WAIT_LISTS` raises default `256 -> 512`): dual-CCD L3-cache placement, WC metadata shadow (`stride_shadow`/`address_shadow`), scoped `D3D12_GLOBAL_BARRIER` buffer-copy barriers, lock-free resting filter (`watch.rs`), and 512 late-list cap. - Note: overlaps `crates/victory-gpu/src/host.rs` with `#426` (whichever merges second will need a quick rebase). - Marked `triage: needs gpu test` — awaiting Gate 2 Audit (`#282`) + Gate 3 1440p/4K plain-`--release` A/B verification.
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!425
No description provided.