gpu(pool,draw),play: reuse free pool holes under full VRAM and align 8 GiB room/eviction tier #153

Merged
Androtim merged 2 commits from upstream-pr/153 into main 2026-11-29 21:27:06 +00:00
Androtim commented 2026-11-29 18:21:37 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-29T18:21:37Z.


Summary

Addresses #149 (8 GiB VRAM texture starvation, black/missing textures, and broken textures under 8 GiB RT).

Root Causes Observed in Logs (#149)

  1. Unusable free pool holes when room() == false: In 8 GiB open-world play, texture blocks held up to ~637–708 MB of free space inside already-allocated 64 MiB blocks, yet heap_textures refused every new texture once room == false (no room for new ones so_far=788500) even when placement would take 0 bytes of new card memory.
  2. 8 GiB FG threshold starved new textures: VICTORY_TEXTURE_ROOM_PERCENT=80 sat permanently below the active render-target + DLSS Frame Gen working set (~85.5% of DXGI budget).
  3. 8 GiB automatic VICTORY_TEXTURE_MIP_DROP=1: Broke most textures when RT was enabled on 8 GiB cards while keeping only opt-in --set usefulness.

Changes

  • crates/victory-gpu/src/pool.rs & crates/victory-gpu/src/resource.rs:
    • Added pool::existing_only() / pool::is_existing_only(), forcing Grow::No in pool::texture and blocking any committed/reserved fallback in resource::host_texture so placements use strictly existing pool holes with zero new VRAM allocation (and never mark skipped allocations refused).
    • Added existing_only_reuses_free_pool_hole_without_creating_blocks unit test.
  • crates/victory-gpu/src/draw.rs:
    • When !room and !has_its_texture, added VICTORY_REUSE_POOL_WHEN_FULL (on unless =0) to try placing title-filled textures into already-allocated pool holes via pool::existing_only when texture_room() > 0 and !residency::pressured().
  • apps/victory/src/play.rs:
    • On <= 9 GiB GPUs, raised VICTORY_TEXTURE_ROOM_PERCENT to 86 (FG on) / 88 (FG ready-off) and paired with VICTORY_SLOT_EVICT_PERCENT=84 (86 without FG) / VICTORY_SLOT_EVICT_LOW_PERCENT=78 (80 without FG).
    • Removed automatic VICTORY_TEXTURE_MIP_DROP=1 from the 8 GiB tier while preserving VICTORY_CARD_BUFFERS_MB, VICTORY_CARD_WINDOWS_MB, VICTORY_CARD_ROOM_FOR_TARGETS_MB, VICTORY_RT_MEMORY_MB, and VICTORY_BVH_FAULTS_ALL safety caps.
    • Updated play::tests (low_vram_series_x_sets_headroom_and_eviction_guards, low_vram_series_s_keeps_native_mips_and_bounds_rt_caps, user_set_overrides_low_vram_defaults).

Local Verification

  • cargo +1.98.1-x86_64-pc-windows-gnu xtask policy: 305 files ok
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --locked -- pool::: 15 passed; 0 failed; 1 ignored
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --locked -- resource::: 27 passed; 0 failed
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --locked -- draw::: 9 passed; 0 failed; 1 ignored
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory --locked -- play::: 15 passed; 0 failed
  • Dual workspace clippy --all-targets -- -D warnings (default and --features diagnostics): 0 warnings
<!-- greyfinch-sync:Androtim/MiniVI:issue:5553695110 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/153). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-29T18:21:37Z. --- ## Summary Addresses #149 (8 GiB VRAM texture starvation, black/missing textures, and broken textures under 8 GiB RT). ### Root Causes Observed in Logs (#149) 1. **Unusable free pool holes when `room() == false`:** In 8 GiB open-world play, `texture blocks` held up to ~637–708 MB of free space inside already-allocated 64 MiB blocks, yet `heap_textures` refused every new texture once `room == false` (`no room for new ones so_far=788500`) even when placement would take **0 bytes** of new card memory. 2. **8 GiB FG threshold starved new textures:** `VICTORY_TEXTURE_ROOM_PERCENT=80` sat permanently below the active render-target + DLSS Frame Gen working set (~85.5% of DXGI budget). 3. **8 GiB automatic `VICTORY_TEXTURE_MIP_DROP=1`:** Broke most textures when RT was enabled on 8 GiB cards while keeping only opt-in `--set` usefulness. ### Changes - **`crates/victory-gpu/src/pool.rs` & `crates/victory-gpu/src/resource.rs`**: - Added `pool::existing_only()` / `pool::is_existing_only()`, forcing `Grow::No` in `pool::texture` and blocking any committed/reserved fallback in `resource::host_texture` so placements use strictly existing pool holes with zero new VRAM allocation (and never mark skipped allocations `refused`). - Added `existing_only_reuses_free_pool_hole_without_creating_blocks` unit test. - **`crates/victory-gpu/src/draw.rs`**: - When `!room` and `!has_its_texture`, added `VICTORY_REUSE_POOL_WHEN_FULL` (on unless `=0`) to try placing title-filled textures into already-allocated pool holes via `pool::existing_only` when `texture_room() > 0` and `!residency::pressured()`. - **`apps/victory/src/play.rs`**: - On `<= 9 GiB` GPUs, raised `VICTORY_TEXTURE_ROOM_PERCENT` to `86` (FG on) / `88` (FG ready-off) and paired with `VICTORY_SLOT_EVICT_PERCENT=84` (`86` without FG) / `VICTORY_SLOT_EVICT_LOW_PERCENT=78` (`80` without FG). - Removed automatic `VICTORY_TEXTURE_MIP_DROP=1` from the 8 GiB tier while preserving `VICTORY_CARD_BUFFERS_MB`, `VICTORY_CARD_WINDOWS_MB`, `VICTORY_CARD_ROOM_FOR_TARGETS_MB`, `VICTORY_RT_MEMORY_MB`, and `VICTORY_BVH_FAULTS_ALL` safety caps. - Updated `play::tests` (`low_vram_series_x_sets_headroom_and_eviction_guards`, `low_vram_series_s_keeps_native_mips_and_bounds_rt_caps`, `user_set_overrides_low_vram_defaults`). ## Local Verification - `cargo +1.98.1-x86_64-pc-windows-gnu xtask policy`: `305 files ok` - `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --locked -- pool::`: `15 passed; 0 failed; 1 ignored` - `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --locked -- resource::`: `27 passed; 0 failed` - `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --locked -- draw::`: `9 passed; 0 failed; 1 ignored` - `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory --locked -- play::`: `15 passed; 0 failed` - Dual workspace `clippy --all-targets -- -D warnings` (default and `--features diagnostics`): 0 warnings
Androtim commented 2026-11-29 18:59:17 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-29T18:59:17Z.


Follow-up fix in 19914946 (crates/victory-gpu/src/draw.rs):

  • Gated reuse_pool_when_full() on !crate::residency::critical_commit() rather than !crate::residency::pressured(), since pool-hole reuse allocates zero new VRAM and normal 3D world execution regularly sits below the 4096 MiB host pressure watermark.
  • Hoisted the pool::texture_room() > 0 check once per pass and capped failed pool-hole probes per pass at MAX_POOL_REUSE_MISSES (64) to avoid repeated TEXTURES lock contention under full VRAM.

Verified at 19914946:

  • xtask policy: 305 files ok
  • cargo test -p victory-gpu --locked -- pool::: 15 passed; 0 failed (1 ignored)
  • cargo test -p victory-gpu --locked -- resource::: 27 passed; 0 failed
  • cargo test -p victory-gpu --locked -- draw::: 9 passed; 0 failed (1 ignored)
  • cargo test -p victory --locked -- play::: 15 passed; 0 failed
  • Dual workspace cargo clippy --workspace --locked --all-targets -- -D warnings (default features and --all-features): 0 warnings
  • CI (check): COMPLETED / SUCCESS
  • Live RTX 4060 Ti 8 GB verification (scripts/verify-world.ps1 with --features diagnostics for VICTORY_CAPTURE):
    • Run A (pool-hole stress test with forced VICTORY_TEXTURE_ROOM_PERCENT=72, 45s): room_false=100.0% yet placed 55,000+ new textures into already-allocated pool holes (uploaded=40155, crashes=0, used_max=5411 MB / budget_min=6712 MB, over=0 MB), with passing visual gate (pngs=24, lit=7/24, median luma 103.64, edge energy 6.97, near-black 0.01%, magenta 0.0%) and clean textures/lighting confirmed in screenshots.
    • Run B (8 GiB tier settings: VICTORY_TEXTURE_ROOM_PERCENT=88, VICTORY_SLOT_EVICT=1, 86/80% eviction thresholds, 45s): ok: true, all 6 gates PASSED (world_windows=12, max_draws=12333, crashes=0, no_host_texture_errors=0, used_max=5633 MB / budget_min=6634 MB, over=0 MB, room_false=16.7%, uploaded=41769, final_waiting=4455, mapped_rate=4.8 ms/world_sec, pngs=24, lit=14/24, median luma 104.78, edge energy 6.94, near-black 0.0%, magenta 0.0%, 10,000+ pool-hole placements logged), with full textures and clean lighting verified in captured screenshots.
<!-- greyfinch-sync:Androtim/MiniVI:comment:7260915780 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/153#issuecomment-7260915780). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-29T18:59:17Z. --- Follow-up fix in `19914946` (`crates/victory-gpu/src/draw.rs`): - Gated `reuse_pool_when_full()` on `!crate::residency::critical_commit()` rather than `!crate::residency::pressured()`, since pool-hole reuse allocates zero new VRAM and normal 3D world execution regularly sits below the 4096 MiB host pressure watermark. - Hoisted the `pool::texture_room() > 0` check once per pass and capped failed pool-hole probes per pass at `MAX_POOL_REUSE_MISSES` (64) to avoid repeated `TEXTURES` lock contention under full VRAM. Verified at `19914946`: - `xtask policy`: `305 files ok` - `cargo test -p victory-gpu --locked -- pool::`: `15 passed; 0 failed` (1 ignored) - `cargo test -p victory-gpu --locked -- resource::`: `27 passed; 0 failed` - `cargo test -p victory-gpu --locked -- draw::`: `9 passed; 0 failed` (1 ignored) - `cargo test -p victory --locked -- play::`: `15 passed; 0 failed` - Dual workspace `cargo clippy --workspace --locked --all-targets -- -D warnings` (default features and `--all-features`): 0 warnings - CI (`check`): `COMPLETED` / `SUCCESS` - Live RTX 4060 Ti 8 GB verification (`scripts/verify-world.ps1` with `--features diagnostics` for `VICTORY_CAPTURE`): - **Run A (pool-hole stress test with forced `VICTORY_TEXTURE_ROOM_PERCENT=72`, 45s):** `room_false=100.0%` yet placed `55,000+` new textures into already-allocated pool holes (`uploaded=40155`, `crashes=0`, `used_max=5411 MB / budget_min=6712 MB`, `over=0 MB`), with passing visual gate (`pngs=24`, `lit=7/24`, median luma `103.64`, edge energy `6.97`, near-black `0.01%`, magenta `0.0%`) and clean textures/lighting confirmed in screenshots. - **Run B (8 GiB tier settings: `VICTORY_TEXTURE_ROOM_PERCENT=88`, `VICTORY_SLOT_EVICT=1`, `86/80%` eviction thresholds, 45s):** `ok: true`, all 6 gates PASSED (`world_windows=12`, `max_draws=12333`, `crashes=0`, `no_host_texture_errors=0`, `used_max=5633 MB / budget_min=6634 MB`, `over=0 MB`, `room_false=16.7%`, `uploaded=41769`, `final_waiting=4455`, `mapped_rate=4.8 ms/world_sec`, `pngs=24`, `lit=14/24`, median luma `104.78`, edge energy `6.94`, near-black `0.0%`, magenta `0.0%`, `10,000+` pool-hole placements logged), with full textures and clean lighting verified in captured screenshots.
Androtim commented 2026-11-29 19:03:18 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-29T19:03:18Z.


Automated triage for the maintainers (not an approval).

Verdict: needs-gpu-test · CI (check): passing

Review Summary

Logic and safety look solid, CI is passing, and the changes are well-scoped to #149 (8 GiB VRAM texture starvation). Because this PR modifies D3D12 texture-pool placement under full VRAM and changes 8 GiB launcher headroom/eviction defaults, it warrants a local real-GPU smoke test before merging.

Key Findings

  • Zero-allocation pool hole reuse (crates/victory-gpu/src/pool.rs, crates/victory-gpu/src/resource.rs):
    • pool::existing_only sets CAN_WAIT and EXISTING_ONLY, forcing Grow::No in pool::texture and setting WAITED on any miss (including non-pooled sizes, without inflating BLOCKS[NOT_MADE]).
    • resource::host_texture_as checks pool::waits() || pool::is_existing_only() before CreateReservedResource / CreateCommittedResource, and resource::hosted avoids setting r.host.refused when pool::is_existing_only() is active. This guarantees zero new D3D12 heap or committed VRAM allocations during reuse attempts.
    • Unit test existing_only_reuses_free_pool_hole_without_creating_blocks covers thread-local guard restoration and Pool::take_ripe with Grow::No.
  • Full-VRAM reuse path (crates/victory-gpu/src/draw.rs):
    • VICTORY_REUSE_POOL_WHEN_FULL (default on) attempts pool::existing_only(|| resource::host_resource(wanted)) when !room, !has_its_texture, pool::texture_room() > 0, and !residency::critical_commit(), capped at MAX_POOL_REUSE_MISSES = 64 per pass.
    • Minor non-blocking notes:
      • The PR summary mentions !residency::pressured(), whereas draw.rs checks !crate::residency::critical_commit() (reasonable on 8 GiB where pressured() may stay true while commit is not critical).
      • If wanted already has a cached host texture from another slot, host_resource returns Some with waited == false and increments HEAP_TEXTURES_REUSED_POOL; harmless functionally, just a slight counter overcount on shared resources.
      • existing_only runs before residency::admit_texture_pass(required); if admit_texture_pass breaks the loop, the placed texture stays cached in r.host for a subsequent pass.
  • 8 GiB launcher tier (apps/victory/src/play.rs):
    • Raises VICTORY_TEXTURE_ROOM_PERCENT on <= LOW_VRAM_THRESHOLD_MB cards to 86 (FG on) / 88 (FG ready-off) and pairs it with VICTORY_SLOT_EVICT_PERCENT (84 / 86) and VICTORY_SLOT_EVICT_LOW_PERCENT (78 / 80), keeping low < evict < room in all modes.
    • Removes automatic VICTORY_TEXTURE_MIP_DROP=1 while keeping buffer/window/target/RT caps intact and overridable via --set / menu.

Local GPU Verification Needed

Please run a smoke test on an 8 GiB GPU (and optionally a higher-VRAM GPU for regression) covering:

  1. Open-world play with Frame Gen enabled (verify new texture placed into already-allocated pool hole triggers when room == false, no black/missing textures, and VRAM stays within DXGI budget without device removal).
  2. 8 GiB with RT enabled (VICTORY_BVH_BUILDER=1) to confirm textures render cleanly without automatic VICTORY_TEXTURE_MIP_DROP=1 and without OOM/TDR.
  3. Fallback toggle VICTORY_REUSE_POOL_WHEN_FULL=0 sanity check.

Generated with Antigravity CLI (agy).

<!-- greyfinch-sync:Androtim/MiniVI:comment:7260969800 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/153#issuecomment-7260969800). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-29T19:03:18Z. --- <!-- minivi-triage v1 head=1991494628310075c05a10f8de70f35d8cb20f1a verdict=needs-gpu-test ci=passing at=2026-11-29T19:03:52Z --> Automated triage for the maintainers (not an approval). **Verdict:** `needs-gpu-test` · **CI (`check`):** `passing` ### Review Summary Logic and safety look solid, CI is passing, and the changes are well-scoped to `#149` (8 GiB VRAM texture starvation). Because this PR modifies D3D12 texture-pool placement under full VRAM and changes 8 GiB launcher headroom/eviction defaults, it warrants a local real-GPU smoke test before merging. ### Key Findings - **Zero-allocation pool hole reuse (`crates/victory-gpu/src/pool.rs`, `crates/victory-gpu/src/resource.rs`):** - `pool::existing_only` sets `CAN_WAIT` and `EXISTING_ONLY`, forcing `Grow::No` in `pool::texture` and setting `WAITED` on any miss (including non-pooled sizes, without inflating `BLOCKS[NOT_MADE]`). - `resource::host_texture_as` checks `pool::waits() || pool::is_existing_only()` before `CreateReservedResource` / `CreateCommittedResource`, and `resource::hosted` avoids setting `r.host.refused` when `pool::is_existing_only()` is active. This guarantees zero new D3D12 heap or committed VRAM allocations during reuse attempts. - Unit test `existing_only_reuses_free_pool_hole_without_creating_blocks` covers thread-local guard restoration and `Pool::take_ripe` with `Grow::No`. - **Full-VRAM reuse path (`crates/victory-gpu/src/draw.rs`):** - `VICTORY_REUSE_POOL_WHEN_FULL` (default on) attempts `pool::existing_only(|| resource::host_resource(wanted))` when `!room`, `!has_its_texture`, `pool::texture_room() > 0`, and `!residency::critical_commit()`, capped at `MAX_POOL_REUSE_MISSES = 64` per pass. - Minor non-blocking notes: - The PR summary mentions `!residency::pressured()`, whereas `draw.rs` checks `!crate::residency::critical_commit()` (reasonable on 8 GiB where `pressured()` may stay true while commit is not critical). - If `wanted` already has a cached host texture from another slot, `host_resource` returns `Some` with `waited == false` and increments `HEAP_TEXTURES_REUSED_POOL`; harmless functionally, just a slight counter overcount on shared resources. - `existing_only` runs before `residency::admit_texture_pass(required)`; if `admit_texture_pass` breaks the loop, the placed texture stays cached in `r.host` for a subsequent pass. - **8 GiB launcher tier (`apps/victory/src/play.rs`):** - Raises `VICTORY_TEXTURE_ROOM_PERCENT` on `<= LOW_VRAM_THRESHOLD_MB` cards to `86` (FG on) / `88` (FG ready-off) and pairs it with `VICTORY_SLOT_EVICT_PERCENT` (`84` / `86`) and `VICTORY_SLOT_EVICT_LOW_PERCENT` (`78` / `80`), keeping `low < evict < room` in all modes. - Removes automatic `VICTORY_TEXTURE_MIP_DROP=1` while keeping buffer/window/target/RT caps intact and overridable via `--set` / menu. ### Local GPU Verification Needed Please run a smoke test on an 8 GiB GPU (and optionally a higher-VRAM GPU for regression) covering: 1. Open-world play with Frame Gen enabled (verify `new texture placed into already-allocated pool hole` triggers when `room == false`, no black/missing textures, and VRAM stays within DXGI budget without device removal). 2. 8 GiB with RT enabled (`VICTORY_BVH_BUILDER=1`) to confirm textures render cleanly without automatic `VICTORY_TEXTURE_MIP_DROP=1` and without OOM/TDR. 3. Fallback toggle `VICTORY_REUSE_POOL_WHEN_FULL=0` sanity check. --- _Generated with Antigravity CLI (`agy`)._
Androtim commented 2026-11-29 21:27:03 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-29T21:27:03Z.


Automated RTX 4060 Ti 8 GB Open-World A/B hardware verification PASSED (playtest/wave5 vs origin/main b1b6dc1, VICTORY_LEVELS_ON_DEMAND=0 play-parity):

  • Hardware cargo test (RTX 4060 Ti): 645 passed, 0 failed (victory 39/39, victory-shader emit::wave64_tests 19/19 & lower 19/19, victory-gpu 568/568).
  • 45s Open-World A/B (scripts/verify-world.ps1, DLSS Quality + open-world save):
    • FPS: median 9.4 fps vs 7.5 fps (+1.90 fps / +25%), min 8.3 fps vs 0.8 fps, preparing 53.6 ms vs 60.0 ms
    • Stability: 0 crashes / 0 DRED / 0 untranslated shaders
    • VRAM / Issue #149: max 5760 MB vs 6005 MB (-245 MB, 0 MB over budget); no room for new ones halved (9,000 vs 18,000); max_waiting dropped (36,432 vs 41,431)
    • Decoration bakes / Issue #150: 0 mismatches (other_bytes=0, showed_another_view=0, failed=0 vs 5 and 2 on baseline)
    • Residency stalls: mapped_rate 1.63 ms/s vs 6.9 ms/s (-76%, max 12.9 vs 51.9 ms)
    • Visual check: Clean open-world safehouse frames (frame-5975.png, frame-5983.png), edge_energy=4.69 vs 3.88, near_black=0.02%, magenta=0.0% (and #141 2bf6800 showed zero visual artifacts).
<!-- greyfinch-sync:Androtim/MiniVI:comment:7262884910 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/153#issuecomment-7262884910). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-29T21:27:03Z. --- Automated RTX 4060 Ti 8 GB **Open-World** A/B hardware verification **PASSED** (`playtest/wave5` vs `origin/main` `b1b6dc1`, `VICTORY_LEVELS_ON_DEMAND=0` play-parity): - **Hardware `cargo test` (RTX 4060 Ti):** **645 passed, 0 failed** (`victory` 39/39, `victory-shader` `emit::wave64_tests` 19/19 & `lower` 19/19, `victory-gpu` 568/568). - **45s Open-World A/B (`scripts/verify-world.ps1`, DLSS Quality + open-world save):** - **FPS:** median **`9.4 fps`** vs `7.5 fps` (**+1.90 fps / +25%**), min **`8.3 fps`** vs **`0.8 fps`**, preparing `53.6 ms` vs `60.0 ms` - **Stability:** **0** crashes / **0** DRED / **0** untranslated shaders - **VRAM / Issue #149:** max **`5760 MB`** vs `6005 MB` (**-245 MB**, `0 MB` over budget); `no room for new ones` halved (**`9,000`** vs `18,000`); `max_waiting` dropped (`36,432` vs `41,431`) - **Decoration bakes / Issue #150:** **`0` mismatches** (`other_bytes=0, showed_another_view=0, failed=0` vs `5` and `2` on baseline) - **Residency stalls:** `mapped_rate` **`1.63 ms/s`** vs `6.9 ms/s` (**-76%**, max `12.9` vs `51.9 ms`) - **Visual check:** Clean open-world safehouse frames (`frame-5975.png`, `frame-5983.png`), `edge_energy=4.69` vs `3.88`, `near_black=0.02%`, `magenta=0.0%` (and `#141` `2bf6800` showed zero visual artifacts).
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!153
No description provided.