perf(gpu/desc): bound placed-view shapes and retire idle views (Wave 7B / VSP-19) #422

Merged
Androtim merged 1 commit from upstream-pr/422 into main 2026-12-04 05:05:21 +00:00
Androtim commented 2026-12-04 04:21:46 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T04:21:46Z.


Summary

Ports Wave 7B: bounded placed-view shape cap and sliced idle-view eviction from \ReTerryDavis/ReVIctory\ PR #26 (\ c8f19f, \GPL-3.0) and \monte-alt/vesper\ PR #25 (VSP-19), adapted to MiniVI's split \ViewShapes\ / \LOCAL_SHAPES\ + sharded \ReadMostly\ + \FastMap\ + \MIRROR_CACHE\ architecture.

Key Changes

  • Bounded inline placed-view shapes: \ViewShapes\ caps inline shapes at \PLACED_SHAPE_CAP = 262_144\ (bypassed with \VICTORY_VIEW_EVICT=0). Once full, \shape_number()\ checks \shapes.len() >= shape_cap\ under the shared read lock and overflows directly into \Views\ without acquiring the exclusive \VIEW_SHAPES\ write lock.
  • \ViewEntry\ + sliced idle eviction: \Views::list\ stores \ViewEntry { view, generation, last_used: AtomicU64, live }. Resource-less entries (\View::Placed\ / \View::Constant) idle for \IDLE_EVICT_FRAMES = 1_800\ frames (~60 s at 30 FPS) are retired in bounded slices (\SWEEP_SLICE = 4_096\ .. \SWEEP_SLICE_MAX = 32_768) periodically from \sync_heaps()\ every \SWEEP_PERIOD_FRAMES = 4\ frames (even when \VICTORY_HEAP_SYNC=0) and on-demand during insertion past \EVICT_HIGH_WATER = 65_536.
  • Lifetime & concurrency safety:
    • Retired slots remove their \FastMap\ index entry, clear \live, bump \generation, and push to \ ree, so stale descriptor handles always resolve to \None\ even after slot reuse.
    • \last_used\ is atomically refreshed under the read lock on \lookup_entry, \entry_of, \ iews_alive\ (active draw descriptor-table cache validation), and \descriptor::host::views_entry_alive\ (\MIRROR_CACHE\ hits), preventing eviction of any view still active in descriptor tables or caches.
    • Resource-backed views (\View::Shader, \View::Unordered) and samplers (\View::Sampler, \View::ConsoleSampler) are never evicted; MiniVI's \ownerless\ FIFO hard cap (\VICTORY_OWNERLESS_VIEWS) is preserved and pruned of retired front entries.
  • Attribution: GPL-3.0 attribution referencing \ReTerryDavis/ReVIctory\ PR #26 (\ c8f19f) and \monte-alt/vesper\ PR #25 (VSP-19).

Verification (GNU toolchain +1.98.1-x86_64-pc-windows-gnu)

  • \cargo test -p victory-gpu --lib descriptor: 113 passed, 0 failed, 1 ignored (includes 4 new unit tests: \placed_shapes_are_bounded, \idle_eviction_retires_stale_views_and_reuses_slots, \idle_eviction_never_retires_resource_views_or_samplers, \idle_eviction_reinsertion_and_live_touch_retention)
  • \cargo xtask policy: PASSED (\sset policy: 365 files ok)
  • \cargo check --workspace: PASSED
  • \cargo check -p victory-gpu --features diagnostics: PASSED
<!-- greyfinch-sync:Androtim/MiniVI:issue:5640169732 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/422). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-04T04:21:46Z. --- ## Summary Ports **Wave 7B**: bounded placed-view shape cap and sliced idle-view eviction from \ReTerryDavis/ReVIctory\ PR #26 (\ c8f19f\, \GPL-3.0\) and \monte-alt/vesper\ PR #25 (VSP-19), adapted to MiniVI's split \ViewShapes\ / \LOCAL_SHAPES\ + sharded \ReadMostly<Views>\ + \FastMap\ + \MIRROR_CACHE\ architecture. ### Key Changes - **Bounded inline placed-view shapes**: \ViewShapes\ caps inline shapes at \PLACED_SHAPE_CAP = 262_144\ (bypassed with \VICTORY_VIEW_EVICT=0\). Once full, \shape_number()\ checks \shapes.len() >= shape_cap\ under the shared read lock and overflows directly into \Views\ without acquiring the exclusive \VIEW_SHAPES\ write lock. - **\ViewEntry\ + sliced idle eviction**: \Views::list\ stores \ViewEntry { view, generation, last_used: AtomicU64, live }\. Resource-less entries (\View::Placed\ / \View::Constant\) idle for \IDLE_EVICT_FRAMES = 1_800\ frames (~60 s at 30 FPS) are retired in bounded slices (\SWEEP_SLICE = 4_096\ .. \SWEEP_SLICE_MAX = 32_768\) periodically from \sync_heaps()\ every \SWEEP_PERIOD_FRAMES = 4\ frames (even when \VICTORY_HEAP_SYNC=0\) and on-demand during insertion past \EVICT_HIGH_WATER = 65_536\. - **Lifetime & concurrency safety**: - Retired slots remove their \FastMap\ index entry, clear \live\, bump \generation\, and push to \ ree\, so stale descriptor handles always resolve to \None\ even after slot reuse. - \last_used\ is atomically refreshed under the read lock on \lookup_entry\, \entry_of\, \ iews_alive\ (active draw descriptor-table cache validation), and \descriptor::host::views_entry_alive\ (\MIRROR_CACHE\ hits), preventing eviction of any view still active in descriptor tables or caches. - Resource-backed views (\View::Shader\, \View::Unordered\) and samplers (\View::Sampler\, \View::ConsoleSampler\) are never evicted; MiniVI's \ownerless\ FIFO hard cap (\VICTORY_OWNERLESS_VIEWS\) is preserved and pruned of retired front entries. - **Attribution**: GPL-3.0 attribution referencing \ReTerryDavis/ReVIctory\ PR #26 (\ c8f19f\) and \monte-alt/vesper\ PR #25 (VSP-19). ### Verification (GNU toolchain \+1.98.1-x86_64-pc-windows-gnu\) - \cargo test -p victory-gpu --lib descriptor\: **113 passed, 0 failed, 1 ignored** (includes 4 new unit tests: \placed_shapes_are_bounded\, \idle_eviction_retires_stale_views_and_reuses_slots\, \idle_eviction_never_retires_resource_views_or_samplers\, \idle_eviction_reinsertion_and_live_touch_retention\) - \cargo xtask policy\: **PASSED** (\sset policy: 365 files ok\) - \cargo check --workspace\: **PASSED** - \cargo check -p victory-gpu --features diagnostics\: **PASSED**
Androtim commented 2026-12-04 04:31:53 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T04:31:53Z.


Triage (3ed6a9e0, CI check PASS):

  • Clean, 100% title-neutral port of Wave 7B (ReVIctory #26 / vesper #25 VSP-19, +436/-74 across descriptor.rs + descriptor/host.rs, zero opt-in toggles — VICTORY_VIEW_EVICT is default-on with =0 kill-switch): caps inline placed-view shapes at 262_144 and retires idle resource-less View::Placed/View::Constant entries in bounded slices with generation checks and atomic last_used refresh.
  • Holding auto-merge for Gate 2 Audit (#282) (verifying generation wrap/reuse soundness, MIRROR_CACHE last_used refresh coverage, and no active in-flight descriptor eviction) + Gate 3 live 1440p/4K plain---release A/B.
<!-- greyfinch-sync:Androtim/MiniVI:comment:7401335495 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/422#issuecomment-7401335495). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-04T04:31:53Z. --- Triage (`3ed6a9e0`, **CI `check` PASS**): - Clean, 100% title-neutral port of Wave 7B (`ReVIctory` `#26` / `vesper` `#25` VSP-19, `+436/-74` across `descriptor.rs` + `descriptor/host.rs`, **zero opt-in toggles** — `VICTORY_VIEW_EVICT` is default-on with `=0` kill-switch): caps inline placed-view shapes at `262_144` and retires idle resource-less `View::Placed`/`View::Constant` entries in bounded slices with generation checks and atomic `last_used` refresh. - Holding auto-merge for **Gate 2 Audit (`#282`)** (verifying generation wrap/reuse soundness, `MIRROR_CACHE` `last_used` refresh coverage, and no active in-flight descriptor eviction) + **Gate 3 live 1440p/4K plain-`--release` A/B**.
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!422
No description provided.