gpu(pool,resource),play: drain sparse heaps, add 16 MiB 8 GB blocks, and fix prelude aliasing guard #171

Closed
github-bot wants to merge 1 commit from gh-pr/171/head into gh-pr/171/base
Owner

@⁠Androtim on GitHub · 2026-11-29 23:40 UTC · original
Androtim:feat/iter169-sparse-pool-drain-and-8gb-vram-reclaim → main · +350 −93 · 5 files · 1 commits · closed without merging

Summary

Addresses texture pool fragmentation, committed-texture prelude crashes, and 8 GiB VRAM reclamation under heavy open-world pressure (#149):

  1. Pool occupancy tracking & sparse-block eviction ordering (crates/victory-gpu/src/pool.rs, resource.rs):
    • Added encode_pool_tag(), PoolBlockStats, and pool::block_stats() (snapshotted BEFORE locking textures() to avoid lock inversion) plus Hosted::pool_tag.
    • Updated pool_eviction_policy() in let_go_idle() and slot_evict() so standalone textures (tag == 0) and sparser blocks drain first (occ_bucket, 250 ms sparse drain when trapped holes >= 256 MiB) without blocking normal eviction on dense heaps.
  2. Configurable 16 MiB pool blocks & non-empty-block-first reuse (pool.rs, resource.rs, play.rs, host.rs):
    • Added VICTORY_TEXTURE_BLOCK_MB (4–64 MiB power-of-two, default 64; play.rs low_vram sets 16 alongside VICTORY_SLOT_EVICT_PERCENT=78/76, LOW=70/68, VICTORY_SLOT_EVICT_MB=384) and Pool::size() / Pool::scale().
    • Reused partially occupied blocks before cutting into empty resting blocks kept ahead (for empty in [false, true]), eliminating premature pool block growth.
    • Updated host.rs texture-block log formatting to scale by block_bytes() >> 20 instead of hardcoded 64.
  3. Prelude aliasing barrier fix for committed fallback textures (crates/victory-gpu/src/host.rs):
    • Guarded D3D12_RESOURCE_BARRIER_TYPE_ALIASING in upload preludes with crate::pool::is_pooled(&copy.texture) (matching texture.rs), preventing E_INVALIDARG (0x80070057) on large committed fallback textures (4224x4224) that bypass 16 MiB blocks.

Verification

  • Checks: xtask policy (311 files ok), cargo test -p victory-gpu pool::, cargo test -p victory-gpu resource::, cargo test -p victory play::, and dual clippy --workspace --all-targets -- -D warnings (standard + --features diagnostics) all passed.
  • Live GPU (RTX 4060 Ti 8 GB, --release --features diagnostics, DLSS quality, 75s in-world D:\victory-data\cache-minivi-pr165):
    • Series S (pr170-v2-s): 12.45 fps median (+39% vs 8.95 fps baseline, preparing 38.9 ms), max_draws=11921, 0 crashes, 20/24 lit frames (luma=102.92, near_black=0.0%, edge_energy=6.96, magenta=0.0%), 204 x 16 MiB blocks with only 263 MB free (8%), over=0 MB.
    • Series X 1440p (pr170-v2-x): 10.6 fps median (94.0 ms), max_draws=13913, used_max=6775 MB / budget_min=6820 MB (over=0 MB, 182 x 16 MiB blocks, 1 block reclaimed to DXGI), 0 crashes, 18/24 lit frames (luma=104.66, edge_energy=7.96, magenta=0.0%).
      (Note: room_false remains ~93–94% under 8 GiB heavy 14k-draw loads until per-thread code_dword scratch allocations are moved off private shader arrays in the follow-up SLOT_CODE_TABLE PR.)

Related: #149

**@⁠Androtim** on GitHub · 2026-11-29 23:40 UTC · [original](https://github.com/Androtim/MiniVI/pull/171) `Androtim:feat/iter169-sparse-pool-drain-and-8gb-vram-reclaim` → `main` · +350 −93 · 5 files · 1 commits · closed without merging ## Summary Addresses texture pool fragmentation, committed-texture prelude crashes, and 8 GiB VRAM reclamation under heavy open-world pressure (#149): 1. **Pool occupancy tracking & sparse-block eviction ordering (`crates/victory-gpu/src/pool.rs`, `resource.rs`):** - Added `encode_pool_tag()`, `PoolBlockStats`, and `pool::block_stats()` (snapshotted BEFORE locking `textures()` to avoid lock inversion) plus `Hosted::pool_tag`. - Updated `pool_eviction_policy()` in `let_go_idle()` and `slot_evict()` so standalone textures (`tag == 0`) and sparser blocks drain first (`occ_bucket`, `250 ms` sparse drain when trapped holes >= 256 MiB) without blocking normal eviction on dense heaps. 2. **Configurable 16 MiB pool blocks & non-empty-block-first reuse (`pool.rs`, `resource.rs`, `play.rs`, `host.rs`):** - Added `VICTORY_TEXTURE_BLOCK_MB` (4–64 MiB power-of-two, default `64`; `play.rs` `low_vram` sets `16` alongside `VICTORY_SLOT_EVICT_PERCENT=78/76`, `LOW=70/68`, `VICTORY_SLOT_EVICT_MB=384`) and `Pool::size()` / `Pool::scale()`. - Reused partially occupied blocks before cutting into empty resting blocks kept ahead (`for empty in [false, true]`), eliminating premature pool block growth. - Updated `host.rs` texture-block log formatting to scale by `block_bytes() >> 20` instead of hardcoded `64`. 3. **Prelude aliasing barrier fix for committed fallback textures (`crates/victory-gpu/src/host.rs`):** - Guarded `D3D12_RESOURCE_BARRIER_TYPE_ALIASING` in upload preludes with `crate::pool::is_pooled(&copy.texture)` (matching `texture.rs`), preventing `E_INVALIDARG (0x80070057)` on large committed fallback textures (`4224x4224`) that bypass 16 MiB blocks. ## Verification - **Checks:** `xtask policy` (`311 files ok`), `cargo test -p victory-gpu pool::`, `cargo test -p victory-gpu resource::`, `cargo test -p victory play::`, and dual `clippy --workspace --all-targets -- -D warnings` (standard + `--features diagnostics`) all passed. - **Live GPU (`RTX 4060 Ti 8 GB`, `--release --features diagnostics`, `DLSS quality`, 75s in-world `D:\victory-data\cache-minivi-pr165`):** - **Series S (`pr170-v2-s`):** `12.45 fps` median (+39% vs `8.95 fps` baseline, `preparing 38.9 ms`), `max_draws=11921`, `0` crashes, `20/24` lit frames (`luma=102.92`, `near_black=0.0%`, `edge_energy=6.96`, `magenta=0.0%`), `204` x 16 MiB blocks with only `263 MB` free (`8%`), `over=0 MB`. - **Series X 1440p (`pr170-v2-x`):** `10.6 fps` median (`94.0 ms`), `max_draws=13913`, `used_max=6775 MB / budget_min=6820 MB` (`over=0 MB`, `182` x 16 MiB blocks, `1` block reclaimed to DXGI), `0` crashes, `18/24` lit frames (`luma=104.66`, `edge_energy=7.96`, `magenta=0.0%`). *(Note: `room_false` remains ~93–94% under 8 GiB heavy 14k-draw loads until per-thread `code_dword` scratch allocations are moved off private shader arrays in the follow-up `SLOT_CODE_TABLE` PR.)* Related: #149
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 20:14:58 +00:00
github-bot closed this pull request 2026-12-01 20:14:58 +00:00
Author
Owner

@⁠Androtim on GitHub · 2026-11-30 00:03 UTC · original · edited 2026-11-30 15:02 UTC

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** on GitHub · 2026-11-30 00:03 UTC · [original](https://github.com/Androtim/MiniVI/pull/171#issuecomment-7264933698) · edited 2026-11-30 15:02 UTC <!-- minivi-triage v1 head=44e25dd774115d17e1ae91056b5aa402cb0be604 verdict=needs-rebase ci=passing at=2026-11-30T15:02:49Z --> 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`)._
Author
Owner

@⁠Androtim on GitHub · 2026-11-30 10:27 UTC · original

GitHub reports merge conflicts against current main. Please rebase onto latest main.

**@⁠Androtim** on GitHub · 2026-11-30 10:27 UTC · [original](https://github.com/Androtim/MiniVI/pull/171#issuecomment-7275616302) GitHub reports merge conflicts against current `main`. Please rebase onto latest `main`.
Author
Owner

@⁠Androtim on GitHub · 2026-12-01 01:38 UTC · original

Closing as superseded by newer merged/tracked work per #276 (Core Architecture Rewrite Backlog).

**@⁠Androtim** on GitHub · 2026-12-01 01:38 UTC · [original](https://github.com/Androtim/MiniVI/pull/171#issuecomment-7297721377) Closing as superseded by newer merged/tracked work per #276 (Core Architecture Rewrite Backlog).

Pull request closed

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!171
No description provided.