Pool: empty blocks kept follow the card's headroom below 85% (VICTORY_SPARES_BY_HEADROOM=1, off) (#94) #285

Open
GDemay wants to merge 1 commit from upstream-pr/285 into main
GDemay commented 2026-11-26 14:23:01 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by GDemay on 2026-11-26T14:23:01Z.


What and why

spares() (crates/victory-gpu/src/pool.rs) keeps either 2 blocks or all 64 (4 GiB) by a binary line at 85 % of the card's budget, whatever headroom is actually left below it. On 8-16 GB cards that overshoots: a 16 GB card 12 GB in held 4 GiB of empty blocks with about a GB of budget left, and the paging that followed ran at about a frame a second; on 8 GB cards it costs about 1-1.5 GB of VRAM (#94, #76's 8-16 GB runs; the 7900 XTX is unaffected — 24 GB keeps all 64).

Behind VICTORY_SPARES_BY_HEADROOM=1 (off by default, read and explained in a comment where it is read): at most half of what is left below 85 % of the budget is kept, in 64 MiB blocks, the ends as before — a 24 GB card 10 GB in keeps all 64 blocks, one at or past 85 % keeps 2, memory pressure (room's keep == false) keeps 2, and with the switch off the choice is exactly as today. Composes with VICTORY_RESIDENCY unchanged: it only feeds spares() a smaller number.

The issue's sketch, with the boundary cases spelled out: 16 GB at 12 GB in -> 12 blocks (768 MiB), 8 GB at 5.5 GB in -> ~5 blocks.

Measurements or Tested

  • New unit test pool::tests::spares_follow_the_cards_headroom_when_asked (exact GiB arithmetic, both modes, all boundary cases), alongside the existing empty_blocks_stay_while_the_card_has_room, which keeps passing through the unchanged default path.
  • Cross-checked from a non-Windows machine: CARGO_FEATURE_PURE=1 cargo clippy -p victory-gpu --all-targets [--all-features] --locked --target x86_64-pc-windows-msvc -- -D warnings is clean apart from the two errors already on main (missing_transmute_annotations #169, unnecessary_mut_passed watch.rs:3626 #241).
  • Windows runners (my fork's CI, this branch): parallel Default 381 passed; 1 failed and Diagnostics 432 passed; 1 failed, the one failure in both being depth_bounds_pipeline_loads_and_filters_draws (WARP, #169); the new test passes in both jobs.

Not run

  • Not run: the game. The frame-time and VRAM effect of the smaller spare set on 8-16 GB cards is a game-run measurement — per #94/#76 the pool overshoot paged over PCIe (~1 fps on a 16 GB card at high use). A run on a 16 GB card with VICTORY_SPARES_BY_HEADROOM=1 (for example #76's and #124's setups) would say the number; the 7900 XTX should be unchanged, as the clamp keeps 64 blocks there.

AI-assisted: yes

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:6628688795 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/285). Originally posted by [GDemay](https://github.com/GDemay) on 2026-11-26T14:23:01Z. --- ### What and why `spares()` (crates/victory-gpu/src/pool.rs) keeps either 2 blocks or all 64 (4 GiB) by a binary line at 85 % of the card's budget, whatever headroom is actually left below it. On 8-16 GB cards that overshoots: a 16 GB card 12 GB in held 4 GiB of empty blocks with about a GB of budget left, and the paging that followed ran at about a frame a second; on 8 GB cards it costs about 1-1.5 GB of VRAM (#94, #76's 8-16 GB runs; the 7900 XTX is unaffected — 24 GB keeps all 64). Behind `VICTORY_SPARES_BY_HEADROOM=1` (off by default, read and explained in a comment where it is read): at most half of what is left below 85 % of the budget is kept, in 64 MiB blocks, the ends as before — a 24 GB card 10 GB in keeps all 64 blocks, one at or past 85 % keeps 2, memory pressure (`room`'s `keep == false`) keeps 2, and with the switch off the choice is exactly as today. Composes with `VICTORY_RESIDENCY` unchanged: it only feeds `spares()` a smaller number. The issue's sketch, with the boundary cases spelled out: 16 GB at 12 GB in -> 12 blocks (768 MiB), 8 GB at 5.5 GB in -> ~5 blocks. ### Measurements or Tested - New unit test `pool::tests::spares_follow_the_cards_headroom_when_asked` (exact GiB arithmetic, both modes, all boundary cases), alongside the existing `empty_blocks_stay_while_the_card_has_room`, which keeps passing through the unchanged default path. - Cross-checked from a non-Windows machine: `CARGO_FEATURE_PURE=1 cargo clippy -p victory-gpu --all-targets [--all-features] --locked --target x86_64-pc-windows-msvc -- -D warnings` is clean apart from the two errors already on main (`missing_transmute_annotations` #169, `unnecessary_mut_passed` watch.rs:3626 #241). - Windows runners (my fork's CI, this branch): parallel Default **381 passed; 1 failed** and Diagnostics **432 passed; 1 failed**, the one failure in both being `depth_bounds_pipeline_loads_and_filters_draws` (WARP, #169); the new test passes in both jobs. ### Not run - Not run: the game. The frame-time and VRAM effect of the smaller spare set on 8-16 GB cards is a game-run measurement — per #94/#76 the pool overshoot paged over PCIe (~1 fps on a 16 GB card at high use). A run on a 16 GB card with `VICTORY_SPARES_BY_HEADROOM=1` (for example #76's and #124's setups) would say the number; the 7900 XTX should be unchanged, as the clamp keeps 64 blocks there. AI-assisted: yes
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/285:upstream-pr/285'
git switch 'upstream-pr/285'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/285'
git switch 'upstream-pr/285'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/285'
git switch 'upstream-pr/285'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/285'
git switch 'main'
git merge --squash 'upstream-pr/285'
git switch 'main'
git merge --ff-only 'upstream-pr/285'
git switch 'main'
git merge 'upstream-pr/285'
git push origin 'main'
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
avatarmanz/VIctory-7900XTX!285
No description provided.