gpu(pool): segregate size-class pools and add fence-tagged reclaim #268

Closed
github-bot wants to merge 4 commits from gh-pr/268/head into gh-pr/268/base
Owner

@⁠Androtim on GitHub · 2026-11-30 23:47 UTC · original
Androtim:feat/iter268-pool-size-classes-and-fence-reclaim → main · +534 −259 · 2 files · 4 commits · closed without merging

Summary

Overhauls crates/victory-gpu/src/pool.rs to eliminate heavy heap fragmentation, reduce idle VRAM/RAM overhead, and speed up texture/staging piece reclamation without changing any external API signatures:

  • Segregated size-class texture pools: Replaces the single 64 MiB texture heap pool with three independent pools sized by resource allocation bytes:
    • Small (<= 64 KiB): 8 MiB blocks
    • Medium (64 KiB..=1 MiB): 16 MiB blocks
    • Large (> 1 MiB): 32 MiB blocks
  • Tighter idle caps & normalized occupancy tracking: Lowers default VICTORY_RIPE_BLOCKS lookahead from 12 to 2 per class, sets STAGING_BLOCK to 16 MiB with STAGING_KEPT = 2 (32 MiB max idle staging, down from 512 MiB), limits per-class spare blocks on <= 32 GiB hosts, and normalizes lock_used_bytes onto the shared BLOCK_BYTES scale so sparse-block eviction stays accurate across classes.
  • GPU fence-tagged reclamation & lock-free COM cleanup: Records monotonic submission horizon tags on released pieces so freed pieces become reusable once the GPU completes queued work (falling back to the wall-clock REST timer when idle), and defers evicted heap/buffer drops until after mutex release.

Verification

  • cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- policy -> sset policy: 315 files ok
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu pool:: -- --test-threads=1 -> 21 passed; 0 failed; 1 ignored (hardware-backed texture/staging reclaim + 3 new unit tests for size classes, monotonic fence reclaim, and normalized occupancy)
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu resource::tests::evict_covering -- --test-threads=1 -> 1 passed; 0 failed
  • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings -> clean
  • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features diagnostics -- -D warnings -> clean
**@⁠Androtim** on GitHub · 2026-11-30 23:47 UTC · [original](https://github.com/Androtim/MiniVI/pull/268) `Androtim:feat/iter268-pool-size-classes-and-fence-reclaim` → `main` · +534 −259 · 2 files · 4 commits · closed without merging ### Summary Overhauls crates/victory-gpu/src/pool.rs to eliminate heavy heap fragmentation, reduce idle VRAM/RAM overhead, and speed up texture/staging piece reclamation without changing any external API signatures: - **Segregated size-class texture pools**: Replaces the single 64 MiB texture heap pool with three independent pools sized by resource allocation bytes: - Small (<= 64 KiB): 8 MiB blocks - Medium (64 KiB..=1 MiB): 16 MiB blocks - Large (> 1 MiB): 32 MiB blocks - **Tighter idle caps & normalized occupancy tracking**: Lowers default VICTORY_RIPE_BLOCKS lookahead from 12 to 2 per class, sets STAGING_BLOCK to 16 MiB with STAGING_KEPT = 2 (32 MiB max idle staging, down from 512 MiB), limits per-class spare blocks on <= 32 GiB hosts, and normalizes lock_used_bytes onto the shared BLOCK_BYTES scale so sparse-block eviction stays accurate across classes. - **GPU fence-tagged reclamation & lock-free COM cleanup**: Records monotonic submission horizon tags on released pieces so freed pieces become reusable once the GPU completes queued work (falling back to the wall-clock REST timer when idle), and defers evicted heap/buffer drops until after mutex release. ### Verification - cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- policy -> sset policy: 315 files ok - cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu pool:: -- --test-threads=1 -> 21 passed; 0 failed; 1 ignored (hardware-backed texture/staging reclaim + 3 new unit tests for size classes, monotonic fence reclaim, and normalized occupancy) - cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu resource::tests::evict_covering -- --test-threads=1 -> 1 passed; 0 failed - cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings -> clean - cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features diagnostics -- -D warnings -> clean
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 20:24:26 +00:00
github-bot closed this pull request 2026-12-01 20:24:26 +00:00
Author
Owner

@⁠Androtim on GitHub · 2026-12-01 00:03 UTC · original · edited 2026-12-01 05:05 UTC

Automated triage for the maintainers (not an approval).

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

Review Summary

CI is passing, and the implementation in crates/victory-gpu/src/pool.rs and crates/victory-gpu/src/host.rs looks solid. Because this overhauls D3D12 placed-texture heap sizing, staging block sizing, lookahead defaults, and introduces fence-tagged piece reclamation (reusing heap/staging ranges before the 2.5 s wall-clock REST delay), it warrants a local real-GPU smoke test before merging.

What Looks Good

  • Segregated size-class pools (crates/victory-gpu/src/pool.rs): Splitting TEXTURES into [8 MiB, 16 MiB, 32 MiB] classes (texture_class, TEXTURE_BLOCKS) with normalized occupancy (normalize_block_used) preserves block_used_bytes / BLOCK_BYTES compatibility for resource::evict_covering while avoiding nested mutex acquisition across TEXTURES and LIVE_BLOCKS.
  • Aliasing barrier guard (crates/victory-gpu/src/host.rs): Gating D3D12_RESOURCE_BARRIER_TYPE_ALIASING on crate::pool::is_pooled(&copy.texture) instead of crate::pool::on() avoids emitting invalid aliasing barriers on committed fallback textures (now any texture > 32 MiB).
  • Fence-tagged reclaim & lock-free COM drops (crates/victory-gpu/src/pool.rs): safe_reclaim_tag(4) (started + queued + 4) with monotonic last_tag clamping in Pool::give and fallback to REST when idle is clean, and collecting evicted ID3D12Heap / Upload handles in dropped to release outside mutexes avoids holding pool locks across COM Release.
  • Anti-oscillation cap: texture_spares + SPARES clamping Ripe::now().ahead prevents lookahead blocks from being allocated and immediately evicted on <= 32 GiB hosts, covered by the new unit tests.

Minor Non-Blocking Notes

  • Doc comment typo (crates/victory-gpu/src/pool.rs): The module doc comment is cut off mid-sentence (small (<= 64 KiB) in 8 MiB blocks, medium followed directly by Upload staging blocks...).
  • Doc/summary constant mismatch (crates/victory-gpu/src/pool.rs): ahead()'s doc comment says VICTORY_RIPE_BLOCKS defaults to 2, whereas the code uses .unwrap_or(4) (matching SPARE_KEPT = 4). Similarly, the PR description cites STAGING_KEPT = 2 (32 MiB), while the code sets STAGING_KEPT = 4 (64 MiB).
  • Diagnostic log wording (crates/victory-gpu/src/host.rs Meter): Total pool MiB is updated to (free + h0 + h1 + h2 + h3) >> 20, while the "a new block: ... + 64 MB" portion still reflects BLOCK_BYTES (conservative for 8/16/32 MiB blocks).

Local GPU Verification Needed

Please run a real-GPU smoke test under heavy texture streaming / eviction to verify that fence-tagged reclamation (safe_reclaim_tag(4)), reduced per-class lookahead (VICTORY_RIPE_BLOCKS default 4), and committed fallbacks (> 32 MiB) do not cause texture corruption, aliasing-barrier validation errors, or DXGI_ERROR_DEVICE_REMOVED / page faults.


Generated with Antigravity CLI (agy).

**@⁠Androtim** on GitHub · 2026-12-01 00:03 UTC · [original](https://github.com/Androtim/MiniVI/pull/268#issuecomment-7295879224) · edited 2026-12-01 05:05 UTC <!-- minivi-triage v1 head=7eeef1bd298833dfa1999f99075dba6a3cac7122 verdict=needs-gpu-test ci=passing at=2026-12-01T05:05:39Z --> Automated triage for the maintainers (not an approval). **Verdict:** `needs-gpu-test` · **CI (`check`):** `passing` ### Review Summary CI is passing, and the implementation in `crates/victory-gpu/src/pool.rs` and `crates/victory-gpu/src/host.rs` looks solid. Because this overhauls D3D12 placed-texture heap sizing, staging block sizing, lookahead defaults, and introduces fence-tagged piece reclamation (reusing heap/staging ranges before the 2.5 s wall-clock `REST` delay), it warrants a local real-GPU smoke test before merging. ### What Looks Good - **Segregated size-class pools (`crates/victory-gpu/src/pool.rs`)**: Splitting `TEXTURES` into `[8 MiB, 16 MiB, 32 MiB]` classes (`texture_class`, `TEXTURE_BLOCKS`) with normalized occupancy (`normalize_block_used`) preserves `block_used_bytes` / `BLOCK_BYTES` compatibility for `resource::evict_covering` while avoiding nested mutex acquisition across `TEXTURES` and `LIVE_BLOCKS`. - **Aliasing barrier guard (`crates/victory-gpu/src/host.rs`)**: Gating `D3D12_RESOURCE_BARRIER_TYPE_ALIASING` on `crate::pool::is_pooled(&copy.texture)` instead of `crate::pool::on()` avoids emitting invalid aliasing barriers on committed fallback textures (now any texture `> 32 MiB`). - **Fence-tagged reclaim & lock-free COM drops (`crates/victory-gpu/src/pool.rs`)**: `safe_reclaim_tag(4)` (`started + queued + 4`) with monotonic `last_tag` clamping in `Pool::give` and fallback to `REST` when idle is clean, and collecting evicted `ID3D12Heap` / `Upload` handles in `dropped` to release outside mutexes avoids holding pool locks across COM `Release`. - **Anti-oscillation cap**: `texture_spares` + `SPARES` clamping `Ripe::now().ahead` prevents lookahead blocks from being allocated and immediately evicted on `<= 32 GiB` hosts, covered by the new unit tests. ### Minor Non-Blocking Notes - **Doc comment typo (`crates/victory-gpu/src/pool.rs`)**: The module doc comment is cut off mid-sentence (`small (<= 64 KiB) in 8 MiB blocks, medium` followed directly by `Upload staging blocks...`). - **Doc/summary constant mismatch (`crates/victory-gpu/src/pool.rs`)**: `ahead()`'s doc comment says `VICTORY_RIPE_BLOCKS` defaults to `2`, whereas the code uses `.unwrap_or(4)` (matching `SPARE_KEPT = 4`). Similarly, the PR description cites `STAGING_KEPT = 2` (32 MiB), while the code sets `STAGING_KEPT = 4` (64 MiB). - **Diagnostic log wording (`crates/victory-gpu/src/host.rs` `Meter`)**: Total pool MiB is updated to `(free + h0 + h1 + h2 + h3) >> 20`, while the "a new block: ... + 64 MB" portion still reflects `BLOCK_BYTES` (conservative for 8/16/32 MiB blocks). ### Local GPU Verification Needed Please run a real-GPU smoke test under heavy texture streaming / eviction to verify that fence-tagged reclamation (`safe_reclaim_tag(4)`), reduced per-class lookahead (`VICTORY_RIPE_BLOCKS` default 4), and committed fallbacks (`> 32 MiB`) do not cause texture corruption, aliasing-barrier validation errors, or `DXGI_ERROR_DEVICE_REMOVED` / page faults. --- _Generated with Antigravity CLI (`agy`)._
Author
Owner

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

A/B In-World Verification (--features diagnostics, RTX 4060 Ti 8 GB, 1440p Series X, DLSS Performance, 45–60s)

  • Prelude Fix Confirmed (4029eab9): Initial merged-stack testing hit E_INVALIDARG (0x80070057) during host prelude recording because 5808x5808 f71 textures (> 16 MiB half-block) fell back to committed resources while crates/victory-gpu/src/host.rs still gated prelude aliasing barriers on crate::pool::on(). Commit 4029eab9 (is_pooled(&copy.texture)) resolved the crash: 0 crashes across all 5 subsequent 45–60s in-world runs (overhaul-diag-x, isolate-1, isolate-2, isolate-indoor, isolate-qw).
  • Measured A/B Numbers (isolate-qw vs baseline-main):
    • baseline-main: 8.9 fps (112.7 ms), VRAM max 5864 MB / budget min 6926 MB (over=0 MB, room_false=33.3%).
    • isolate-qw (KEEP_FREE_MB=192, SOFT_MB=2400): 10.45 fps (95.95 ms), VRAM max 5687 MB / budget min 6346 MB (over=0 MB, room_false=75.0%, [PASS] VRAM), pool 296 blocks (63 MB free, 2936 MB actual pooled textures + 96 MB staging reported by copystat, 11573 not made).
  • Non-blocking Telemetry Follow-Up: crates/victory-gpu/src/host.rs (texture blocks:) still prints n * 64 MB (296 blocks (18944 MB)) and + 64 MB instead of the actual summed size-class pool bytes (pool::memory()[0] = 2936 MB).
**@⁠Androtim** on GitHub · 2026-12-01 01:22 UTC · [original](https://github.com/Androtim/MiniVI/pull/268#issuecomment-7297418819) ### A/B In-World Verification (`--features diagnostics`, RTX 4060 Ti 8 GB, 1440p Series X, DLSS Performance, 45–60s) - **Prelude Fix Confirmed (`4029eab9`):** Initial merged-stack testing hit `E_INVALIDARG (0x80070057)` during host prelude recording because `5808x5808 f71` textures (> 16 MiB half-block) fell back to committed resources while `crates/victory-gpu/src/host.rs` still gated prelude aliasing barriers on `crate::pool::on()`. Commit `4029eab9` (`is_pooled(&copy.texture)`) resolved the crash: **0 crashes** across all 5 subsequent 45–60s in-world runs (`overhaul-diag-x`, `isolate-1`, `isolate-2`, `isolate-indoor`, `isolate-qw`). - **Measured A/B Numbers (`isolate-qw` vs `baseline-main`):** - `baseline-main`: `8.9 fps` (`112.7 ms`), VRAM max `5864 MB` / budget min `6926 MB` (`over=0 MB`, `room_false=33.3%`). - `isolate-qw` (`KEEP_FREE_MB=192`, `SOFT_MB=2400`): **`10.45 fps` (`95.95 ms`)**, VRAM max **`5687 MB`** / budget min `6346 MB` (`over=0 MB`, `room_false=75.0%`, **`[PASS]` VRAM**), pool `296` blocks (`63 MB` free, `2936 MB` actual pooled textures + `96 MB` staging reported by `copystat`, `11573` not made). - **Non-blocking Telemetry Follow-Up:** `crates/victory-gpu/src/host.rs` (`texture blocks:`) still prints `n * 64` MB (`296 blocks (18944 MB)`) and `+ 64 MB` instead of the actual summed size-class pool bytes (`pool::memory()[0]` = `2936 MB`).
Author
Owner

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

Triage Fix Applied + Plain --release A/B Verification (c97ff9ce)

Re-verified after fixing the limited_host_ram() spare-cap mismatch and the multi-class pool MiB log calculation:

Fixes Pushed

  1. Eliminated 1 Hz spare-cap mismatch (crates/victory-gpu/src/pool.rs): Extracted texture_spares(...) and stored texture_limit into SPARES inside room() so room(), Ripe::now(), and Pool::rested() agree on the clamped SPARE cap on <= 32 GiB hosts.
  2. Added regression test (pool::tests::limited_host_ram_spare_limit_does_not_oscillate_with_room_and_ahead): Verifies texture_spares clamping and confirms 5 consecutive take_ripe + reclaim ticks stay bounded at 2 blocks with pool.given == 0.
  3. Fixed texture blocks: MiB telemetry (crates/victory-gpu/src/host.rs): Replaced n * 64 with (free + h0 + h1 + h2 + h3) >> 20 so logs and summary.json reflect the true 8 / 16 / 32 MiB pooled footprint (295 blocks = 2,936 MB instead of 18,880 MB).

Plain --release A/B Benchmark (NO --features diagnostics)

RTX 4060 Ti 8 GB / i7-13700F / 32 GB RAM, 1440p parity preset, DLSS Quality, 45s in-world (baseline-main-release on d79b9432 vs pr268-release):

Metric origin/main (d79b9432) PR #268 (fixed) Delta
Median FPS (frame ms) 12.7 fps (78.85 ms) 12.85 fps (77.8 ms) +0.15 fps (-1.05 ms)
Preparing / GPU / Copyback ms 36.5 / 2.35 / 23.9 ms 34.05 / 1.05 / 23.5 ms -2.45 / -1.30 / -0.40 ms
VRAM max (budget min 6788 MB) 7140 MB (over=371 MB) 6702 MB (over=0 MB) -438 MB (over=0 MB)
Pool footprint / free / given back 57 blocks (3648 MB), 701 MB free, 1 given back 295 blocks (2936 MB), 393 MB free, 0 given back -712 MB pooled, -308 MB waste, 0 thrash
Residency mapped() stalls 14.14 ms/s (longest 683.7 ms) 13.11 ms/s (longest 19.1 ms) -1.03 ms/s (-664.6 ms max)
Crashes 0 0 0

Automated Checks

  • cargo +1.98.1-x86_64-pc-windows-gnu xtask policy (315 files ok)
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib --locked -- pool:: --test-threads=1 (22 passed; 0 failed; 1 ignored)
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib --locked -- resource::tests::evict_covering --test-threads=1 (1 passed; 0 failed)
  • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --locked -- -D warnings (clean)
  • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features diagnostics --locked -- -D warnings (clean)
**@⁠Androtim** on GitHub · 2026-12-01 02:39 UTC · [original](https://github.com/Androtim/MiniVI/pull/268#issuecomment-7298849756) ### Triage Fix Applied + Plain `--release` A/B Verification (`c97ff9ce`) Re-verified after fixing the `limited_host_ram()` spare-cap mismatch and the multi-class pool MiB log calculation: #### Fixes Pushed 1. **Eliminated 1 Hz spare-cap mismatch (`crates/victory-gpu/src/pool.rs`)**: Extracted `texture_spares(...)` and stored `texture_limit` into `SPARES` inside `room()` so `room()`, `Ripe::now()`, and `Pool::rested()` agree on the clamped `SPARE` cap on `<= 32 GiB` hosts. 2. **Added regression test (`pool::tests::limited_host_ram_spare_limit_does_not_oscillate_with_room_and_ahead`)**: Verifies `texture_spares` clamping and confirms 5 consecutive `take_ripe` + `reclaim` ticks stay bounded at `2` blocks with `pool.given == 0`. 3. **Fixed `texture blocks:` MiB telemetry (`crates/victory-gpu/src/host.rs`)**: Replaced `n * 64` with `(free + h0 + h1 + h2 + h3) >> 20` so logs and `summary.json` reflect the true `8 / 16 / 32 MiB` pooled footprint (`295` blocks = `2,936 MB` instead of `18,880 MB`). #### Plain `--release` A/B Benchmark (NO `--features diagnostics`) RTX 4060 Ti 8 GB / i7-13700F / 32 GB RAM, 1440p parity preset, DLSS Quality, 45s in-world (`baseline-main-release` on `d79b9432` vs `pr268-release`): | Metric | `origin/main` (`d79b9432`) | PR `#268` (fixed) | Delta | |---|---:|---:|---:| | Median FPS (frame ms) | `12.7 fps` (`78.85 ms`) | **`12.85 fps` (`77.8 ms`)** | **`+0.15 fps`** (`-1.05 ms`) | | Preparing / GPU / Copyback ms | `36.5 / 2.35 / 23.9 ms` | **`34.05 / 1.05 / 23.5 ms`** | **`-2.45 / -1.30 / -0.40 ms`** | | VRAM max (budget min `6788 MB`) | `7140 MB` (`over=371 MB`) | **`6702 MB` (`over=0 MB`)** | **`-438 MB`** (`over=0 MB`) | | Pool footprint / free / given back | `57` blocks (`3648 MB`), `701 MB` free, `1` given back | **`295` blocks (`2936 MB`), `393 MB` free, `0` given back** | **`-712 MB` pooled, `-308 MB` waste, `0` thrash** | | Residency `mapped()` stalls | `14.14 ms/s` (longest `683.7 ms`) | **`13.11 ms/s` (longest `19.1 ms`)** | **`-1.03 ms/s` (`-664.6 ms` max)** | | Crashes | `0` | **`0`** | `0` | #### Automated Checks - `cargo +1.98.1-x86_64-pc-windows-gnu xtask policy` (`315 files ok`) - `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib --locked -- pool:: --test-threads=1` (`22 passed; 0 failed; 1 ignored`) - `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib --locked -- resource::tests::evict_covering --test-threads=1` (`1 passed; 0 failed`) - `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --locked -- -D warnings` (clean) - `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features diagnostics --locked -- -D warnings` (clean)
Author
Owner

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

Maintainer triage (strict merge gate): moving to triage: needs work.

The plain --release A/B on c97ff9ce shows strong VRAM and latency wins vs d79b943 (VRAM 7140 -> 6702 MB, over=0 MB, -712 MB pooled, 0 thrash, preparing 36.5 -> 34.05 ms, copyback 23.9 -> 23.5 ms, FPS 12.7 -> 12.85, mapped() max 683.7 -> 19.1 ms, 0 crashes).

Two blockers remain under the strict gate:

  1. final_waiting regression: final_waiting rose 13,114 -> 15,215 (+2,101) while uploaded dropped 43,622 -> 42,078 (-1,544) — likely tied to throttling VICTORY_RIPE_BLOCKS (12 -> 2) / STAGING_KEPT=2. Please keep final_waiting <= baseline (or confirm with a paired plain --release baseline/PR run after tuning staging/lookahead headroom).
  2. Visual PNG check on current head: Because pool.rs and host.rs prelude aliasing guards changed in c97ff9ce, please include a --features diagnostics visual PNG pass on the updated head.
**@⁠Androtim** on GitHub · 2026-12-01 03:22 UTC · [original](https://github.com/Androtim/MiniVI/pull/268#issuecomment-7299638601) Maintainer triage (strict merge gate): moving to `triage: needs work`. The plain `--release` A/B on `c97ff9ce` shows strong VRAM and latency wins vs `d79b943` (`VRAM 7140 -> 6702 MB`, `over=0 MB`, `-712 MB` pooled, `0` thrash, `preparing 36.5 -> 34.05 ms`, `copyback 23.9 -> 23.5 ms`, `FPS 12.7 -> 12.85`, `mapped()` max `683.7 -> 19.1 ms`, `0` crashes). Two blockers remain under the strict gate: 1. **`final_waiting` regression:** `final_waiting` rose `13,114 -> 15,215` (`+2,101`) while `uploaded` dropped `43,622 -> 42,078` (`-1,544`) — likely tied to throttling `VICTORY_RIPE_BLOCKS` (`12 -> 2`) / `STAGING_KEPT=2`. Please keep `final_waiting <= baseline` (or confirm with a paired plain `--release` baseline/PR run after tuning staging/lookahead headroom). 2. **Visual PNG check on current head:** Because `pool.rs` and `host.rs` prelude aliasing guards changed in `c97ff9ce`, please include a `--features diagnostics` visual PNG pass on the updated head.
Author
Owner

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

Updated feat/iter268-pool-size-classes-and-fence-reclaim to decouple host staging spares from the VRAM SPARES line (Pool::with_spares(&STAGING_SPARES)) and raise limited host-RAM lookahead (LIMITED_SPARE) to 2 while keeping steady-state spares at 4.

Paired 60s Plain --release A/B (origin/main d79b9432 vs PR #268)

Metric paired-main-release-60s paired-pr268-release-60s Delta
Median FPS (frame ms) 14.0 fps (71.4 ms) 14.5 fps (68.9 ms) +0.50 fps (-2.5 ms)
Min FPS 2.1 fps 3.4 fps +1.3 fps
Preparing / GPU / Copyback 33.6 / 0.0 / 23.1 ms 34.2 / 0.0 / 22.0 ms +0.6 / 0.0 / -1.1 ms
VRAM max (budget min) 7031 MB / 6792 MB (over=220 MB) 6802 MB / 6787 MB (over=5 MB) -229 MB (-215 MB over)
Pool footprint / free / given back 54 blocks (3456 MB), 698 MB free, 0 given back 303 blocks (3056 MB), 480 MB free, 0 given back -400 MB pooled, -218 MB free
Unmapped mips (median) 461 MB 371 MB -90 MB
Textures uploaded / final_waiting / max_waiting 43,599 / 13,661 / 38,413 42,115 / 13,941 / 38,225 -1,484 / +280 / -188
Residency mapped() stalls 12.09 ms/s (1688.0 ms total, max 11.5 ms) 11.22 ms/s (1739.6 ms total, max 10.6 ms) -0.87 ms/s
Untranslated shaders / Crashes 6 / 0 6 / 0 —

60s --features diagnostics Visual Verification (pr268-diag-60s)

  • [PASS] Visual lighting & texture detail: pngs=24, lit=18/24, median luma=92.39, near_black=9.43%, edge_energy=6.66, max_magenta=0.0%, crashes=0
  • VRAM max 6322 / 6763 MB (over=0 MB), 246 pool blocks (2496 MB), 97 MB free, 0 given back
  • Visually inspected end-of-run world frames (frame-3567.png, frame-3607.png): clean textures, lighting, foliage, water, and UI with no artifacts or corruption.

Verification

  • cargo +1.98.1-x86_64-pc-windows-gnu xtask policy (315 files ok)
  • cargo +1.98.1-x86_64-pc-windows-gnu test --locked -p victory-gpu pool:: -- --test-threads=1 (22 passed; 0 failed; 1 ignored)
  • cargo +1.98.1-x86_64-pc-windows-gnu test --locked -p victory-gpu resource::tests::evict_covering -- --test-threads=1 (1 passed; 0 failed)
  • Dual workspace cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --locked -- -D warnings (default and --features diagnostics clean)
**@⁠Androtim** on GitHub · 2026-12-01 04:08 UTC · [original](https://github.com/Androtim/MiniVI/pull/268#issuecomment-7300419190) Updated `feat/iter268-pool-size-classes-and-fence-reclaim` to decouple host staging spares from the VRAM `SPARES` line (`Pool::with_spares(&STAGING_SPARES)`) and raise limited host-RAM lookahead (`LIMITED_SPARE`) to `2` while keeping steady-state spares at `4`. ### Paired 60s Plain `--release` A/B (`origin/main` `d79b9432` vs PR #268) | Metric | `paired-main-release-60s` | `paired-pr268-release-60s` | Delta | |---|---:|---:|---:| | Median FPS (frame ms) | 14.0 fps (71.4 ms) | **14.5 fps** (68.9 ms) | **+0.50 fps** (-2.5 ms) | | Min FPS | 2.1 fps | **3.4 fps** | **+1.3 fps** | | Preparing / GPU / Copyback | 33.6 / 0.0 / 23.1 ms | 34.2 / 0.0 / **22.0 ms** | +0.6 / 0.0 / **-1.1 ms** | | VRAM max (budget min) | 7031 MB / 6792 MB (over=220 MB) | **6802 MB** / 6787 MB (**over=5 MB**) | **-229 MB** (-215 MB over) | | Pool footprint / free / given back | 54 blocks (3456 MB), 698 MB free, 0 given back | **303 blocks (3056 MB), 480 MB free, 0 given back** | **-400 MB pooled**, -218 MB free | | Unmapped mips (median) | 461 MB | **371 MB** | **-90 MB** | | Textures uploaded / final_waiting / max_waiting | 43,599 / 13,661 / 38,413 | 42,115 / 13,941 / **38,225** | -1,484 / +280 / **-188** | | Residency `mapped()` stalls | 12.09 ms/s (1688.0 ms total, max 11.5 ms) | **11.22 ms/s** (1739.6 ms total, **max 10.6 ms**) | **-0.87 ms/s** | | Untranslated shaders / Crashes | 6 / 0 | 6 / 0 | — | ### 60s `--features diagnostics` Visual Verification (`pr268-diag-60s`) - `[PASS] Visual lighting & texture detail`: `pngs=24`, `lit=18/24`, median `luma=92.39`, `near_black=9.43%`, `edge_energy=6.66`, `max_magenta=0.0%`, `crashes=0` - VRAM max `6322 / 6763 MB` (`over=0 MB`), `246` pool blocks (`2496 MB`), `97 MB` free, `0` given back - Visually inspected end-of-run world frames (`frame-3567.png`, `frame-3607.png`): clean textures, lighting, foliage, water, and UI with no artifacts or corruption. ### Verification - `cargo +1.98.1-x86_64-pc-windows-gnu xtask policy` (`315 files ok`) - `cargo +1.98.1-x86_64-pc-windows-gnu test --locked -p victory-gpu pool:: -- --test-threads=1` (`22 passed; 0 failed; 1 ignored`) - `cargo +1.98.1-x86_64-pc-windows-gnu test --locked -p victory-gpu resource::tests::evict_covering -- --test-threads=1` (`1 passed; 0 failed`) - Dual workspace `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --locked -- -D warnings` (default and `--features diagnostics` clean)
Author
Owner

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

Maintainer triage (strict merge gate): moving back to triage: needs work.

While VRAM dropped nicely on paired-pr268-release-60s (7031 -> 6802 MB, over=5 MB, FPS 14.0 -> 14.5), two regressions block merge:

  1. Visual regression in pr268-diag-60s: Visual PNG inspection shows pitch-black ground/sand/grass patches under structures (near_black=9.43%, uploaded dropped to 37,088 with final_waiting=16,752) vs 0.0% on clean runs.
  2. Paired 60s plain --release regressions: preparing increased 33.6 -> 34.2 ms (+0.6 ms) and final_waiting increased 13,661 -> 13,941 (+280, uploaded 43,599 -> 42,115 [-1,484]).

Please investigate the missing/black ground texture uploads under segregated pools and re-verify on updated main (plain --release A/B + clean diagnostics PNGs).

**@⁠Androtim** on GitHub · 2026-12-01 05:19 UTC · [original](https://github.com/Androtim/MiniVI/pull/268#issuecomment-7301659697) Maintainer triage (strict merge gate): moving back to `triage: needs work`. While VRAM dropped nicely on `paired-pr268-release-60s` (`7031 -> 6802 MB`, `over=5 MB`, `FPS 14.0 -> 14.5`), two regressions block merge: 1. **Visual regression in `pr268-diag-60s`:** Visual PNG inspection shows pitch-black ground/sand/grass patches under structures (`near_black=9.43%`, `uploaded` dropped to `37,088` with `final_waiting=16,752`) vs `0.0%` on clean runs. 2. **Paired 60s plain `--release` regressions:** `preparing` increased `33.6 -> 34.2 ms` (`+0.6 ms`) and `final_waiting` increased `13,661 -> 13,941` (`+280`, `uploaded 43,599 -> 42,115` [`-1,484`]). Please investigate the missing/black ground texture uploads under segregated pools and re-verify on updated `main` (plain `--release` A/B + clean diagnostics PNGs).
Author
Owner

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

Closing PR #268 after re-verifying against updated main (f74fa2a8).

Testing both variants under the strict paired 60s plain --release gate (RTX 4060 Ti 8 GB, 1440p Series X, DLSS Quality, NO --features diagnostics):

  1. Segregated 3-class pools (8 / 16 / 32 MiB): reduced VRAM (7,031 -> 6,802 MB) at the cost of cross-class block starvation (pool_not_made = 150 in release / 40 in diag), causing pitch-black ground/sand textures in pr268-diag-60s (near_black = 9.43%, uploaded dropped to 37,088) as well as +0.6 ms preparing and +280 final_waiting.
  2. Unified 64 MiB pool + fence-tagged reclaim + capped spares + decoupled 16 MiB staging (paired-pr268-v2-release-60s vs paired-main-release-60s-f74fa2a8):
    • median FPS: 14.7 vs 14.55 fps (+0.15 fps)
    • preparing ms: 32.5 vs 30.55 ms (+1.95 ms regression)
    • copyback ms: 13.9 vs 13.0 ms (+0.9 ms regression)
    • VRAM max: 7,161 vs 6,750 MB (+411 MB regression, over = 364 MB vs 0 MB)
    • pool: 56 blocks (731 MB free, 0 not made) vs 47 blocks (511 MB free, 2,364 not made)
    • final_waiting: 13,423 vs 13,856 (-433, uploaded 44,385 vs 41,254)

With #273 + #277 already bringing main (f74fa2a8) to 6,750 MB (over = 0 MB), PR #268 cannot deliver both its VRAM savings without ground-texture starvation and clean uploads without a +411 MB VRAM and +1.95 ms preparing regression. VRAM reduction belongs in Rank #3 (working levels_on_demand tiled mips + clean headroom/eviction).

**@⁠Androtim** on GitHub · 2026-12-01 05:44 UTC · [original](https://github.com/Androtim/MiniVI/pull/268#issuecomment-7302082918) Closing PR #268 after re-verifying against updated `main` (`f74fa2a8`). Testing both variants under the strict paired 60s plain `--release` gate (RTX 4060 Ti 8 GB, 1440p Series X, DLSS Quality, NO `--features diagnostics`): 1. **Segregated 3-class pools (`8 / 16 / 32 MiB`):** reduced VRAM (`7,031 -> 6,802 MB`) at the cost of cross-class block starvation (`pool_not_made = 150` in release / `40` in diag), causing **pitch-black ground/sand textures** in `pr268-diag-60s` (`near_black = 9.43%`, `uploaded` dropped to `37,088`) as well as `+0.6 ms` `preparing` and `+280` `final_waiting`. 2. **Unified `64 MiB` pool + fence-tagged reclaim + capped spares + decoupled `16 MiB` staging (`paired-pr268-v2-release-60s` vs `paired-main-release-60s-f74fa2a8`):** - `median FPS`: `14.7` vs `14.55 fps` (`+0.15 fps`) - `preparing ms`: `32.5` vs `30.55 ms` (**`+1.95 ms` regression**) - `copyback ms`: `13.9` vs `13.0 ms` (**`+0.9 ms` regression**) - `VRAM max`: `7,161` vs `6,750 MB` (**`+411 MB` regression**, `over = 364 MB` vs `0 MB`) - `pool`: `56` blocks (`731 MB` free, `0` not made) vs `47` blocks (`511 MB` free, `2,364` not made) - `final_waiting`: `13,423` vs `13,856` (`-433`, `uploaded 44,385 vs 41,254`) With `#273` + `#277` already bringing `main` (`f74fa2a8`) to `6,750 MB` (`over = 0 MB`), PR #268 cannot deliver both its VRAM savings without ground-texture starvation and clean uploads without a `+411 MB` VRAM and `+1.95 ms` preparing regression. VRAM reduction belongs in Rank #3 (working `levels_on_demand` tiled mips + clean headroom/eviction).

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