Texture pool: sweep empty 64 MiB blocks on budget tick without residency #327

Open
github-bot wants to merge 1 commit from github-bot/gh-327 into main AGit
Owner

@⁠finegorko on GitHub · 2026-11-26 17:06 UTC · original
finegorko:vram-pool-reclaim → main · +43 −1 · 1 files · 1 commits · open

When VICTORY_RESIDENCY is off, pool::room() updates SPARES from SPARE_KEPT (64) to SPARE (2) at 85% VRAM, but previously never swept TEXTURES. If texture admission pauses (Pool::take() -> rested() stops running) or empty blocks are already sitting idle, up to SPARE_KEPT (4 GiB) of empty 64 MiB heaps remain held until a future allocation.

Change

  • crates/victory-gpu/src/pool.rs:
    • Mirror the residency::on() branch in pool::room(): when limit < SPARE_KEPT, try_lock() TEXTURES and call pool.reclaim(now(), limit, true).
    • Add VICTORY_POOL_RECLAIM (default on; 0 disables; A/B testable via crate::ab::pick).
    • Add unit test sweep_reclaims_empty_spares_without_new_allocations.

Measured (Windows 11, RX 7900 GRE 16 GB, Xbox Series S diag run)

  • When DXGI VRAM crossed 85% (11,973 -> 12,482 MB / 14,488 MB budget), texture pool shrunk from 6,592 MB down to 6,016 MB (-576 MB, 9 empty 64 MiB heaps released back to D3D12/DXGI) without extra texture eviction churn.
  • Note: deliberately leaves resource::let_go_idle() untouched; fragmented pools holding live textures cannot free partial 64 MiB heaps via idle eviction alone, and subtracting only empty_blocks there caused heavy thrashing in prior testing. Complementary to #297.

Validation

  • cargo test -p xtask --locked: 9 passed
  • cargo test -p victory-gpu pool::tests --locked: 9 passed
  • cargo xtask policy: 265 files ok
  • cargo build --locked --profile diag -p victory --features diagnostics: ok
**@⁠finegorko** on GitHub · 2026-11-26 17:06 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/327) `finegorko:vram-pool-reclaim` → `main` · +43 −1 · 1 files · 1 commits · open When `VICTORY_RESIDENCY` is off, `pool::room()` updates `SPARES` from `SPARE_KEPT` (64) to `SPARE` (2) at 85% VRAM, but previously never swept `TEXTURES`. If texture admission pauses (`Pool::take()` -> `rested()` stops running) or empty blocks are already sitting idle, up to `SPARE_KEPT` (4 GiB) of empty 64 MiB heaps remain held until a future allocation. ### Change - `crates/victory-gpu/src/pool.rs`: - Mirror the `residency::on()` branch in `pool::room()`: when `limit < SPARE_KEPT`, `try_lock()` `TEXTURES` and call `pool.reclaim(now(), limit, true)`. - Add `VICTORY_POOL_RECLAIM` (default on; `0` disables; A/B testable via `crate::ab::pick`). - Add unit test `sweep_reclaims_empty_spares_without_new_allocations`. ### Measured (Windows 11, RX 7900 GRE 16 GB, Xbox Series S diag run) - When DXGI VRAM crossed 85% (`11,973` -> `12,482 MB / 14,488 MB` budget), `texture pool` shrunk from `6,592 MB` down to `6,016 MB` (`-576 MB`, 9 empty 64 MiB heaps released back to D3D12/DXGI) without extra texture eviction churn. - Note: deliberately leaves `resource::let_go_idle()` untouched; fragmented pools holding live textures cannot free partial 64 MiB heaps via idle eviction alone, and subtracting only `empty_blocks` there caused heavy thrashing in prior testing. Complementary to #297. ### Validation - `cargo test -p xtask --locked`: 9 passed - `cargo test -p victory-gpu pool::tests --locked`: 9 passed - `cargo xtask policy`: 265 files ok - `cargo build --locked --profile diag -p victory --features diagnostics`: ok
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 17:06:58 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/327/head:github-bot/gh-327'
git switch 'github-bot/gh-327'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-327'
git switch 'github-bot/gh-327'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-327'
git switch 'github-bot/gh-327'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-327'
git switch 'main'
git merge --squash 'github-bot/gh-327'
git switch 'main'
git merge --ff-only 'github-bot/gh-327'
git switch 'main'
git merge 'github-bot/gh-327'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.