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

Manually merged
github merged 1 commit from github-bot/gh-422 into gh-pr/422/base 2026-12-04 05:07:10 +00:00 AGit
Owner

@⁠Androtim on GitHub · 2026-12-04 04:21 UTC · original
Androtim:perf/bounded-placed-view-table → main · +436 −74 · 2 files · 1 commits · merged 2026-12-04 05:05 UTC

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
**@⁠Androtim** on GitHub · 2026-12-04 04:21 UTC · [original](https://github.com/Androtim/MiniVI/pull/422) `Androtim:perf/bounded-placed-view-table` → `main` · +436 −74 · 2 files · 1 commits · merged 2026-12-04 05:05 UTC ## 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**
Ports the bounded placed-view shape cap and sliced idle-view eviction from
ReTerryDavis/ReVIctory PR #26 (fc8f19f, GPL-3.0) and monte-alt/vesper PR #25
(VSP-19) onto MiniVI's split ViewShapes + sharded ReadMostly<Views> table:

- Caps inline placed-view shapes in ViewShapes at PLACED_SHAPE_CAP (262,144)
  so long sessions cannot grow shapes/shape_index up to 4M entries; shapes
  past the cap overflow into the evictable Views table without taking the
  ViewShapes write lock once full.
- Wraps Views::list slots in ViewEntry with atomic last_used (updated under
  read lock) and live state; retires idle resource-less View::Placed /
  View::Constant entries after IDLE_EVICT_FRAMES (1,800) frames in bounded
  slices from sync_heaps() and on demand past EVICT_HIGH_WATER (65,536).
- Preserves resource-backed views (Shader/Unordered) and samplers, MiniVI's
  ownerless FIFO hard cap, FastMap, ReadMostly<Views>, and LOCAL_SHAPES.
- Refreshes last_used in lookup_entry, entry_of, views_alive (draw table
  cache validation), and host::views_entry_alive (MIRROR_CACHE hits) so
  actively referenced views are never evicted.
- VICTORY_VIEW_EVICT=0 disables both the shape cap and idle eviction.
- Adds unit tests for bounded shape cap, sliced idle eviction & slot reuse,
  resource/sampler retention, and re-insertion + live-touch retention.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-04 04:25:29 +00:00
github-bot force-pushed github-bot/gh-422 from 3ed6a9e03f to d73c6369be 2026-12-04 04:38:45 +00:00 Compare
Author
Owner

@⁠Androtim on GitHub · 2026-12-04 04:31 UTC · original

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.
**@⁠Androtim** on GitHub · 2026-12-04 04:31 UTC · [original](https://github.com/Androtim/MiniVI/pull/422#issuecomment-7401335495) 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**.
github-bot force-pushed github-bot/gh-422 from d73c6369be to 623950a3cf 2026-12-04 04:50:43 +00:00 Compare
github-bot changed target branch from main to gh-pr/422/base 2026-12-04 05:07:04 +00:00
github manually merged commit 623950a3cf into gh-pr/422/base 2026-12-04 05:07:10 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Androtim--MiniVI!422
No description provided.