Adaptive 16/8 MiB texture pool, block-aware idle eviction, and pop-in priority #1562

Open
github-bot wants to merge 2 commits from github-bot/gh-1562 into main AGit
Owner

@⁠mikael-jarvinen on GitHub · 2026-11-28 21:45 UTC · original
mikael-jarvinen:pr-adaptive-texture-pool-and-popin → main · +769 −171 · 6 files · 2 commits · open

Rebased replacement for #1168 onto main (923e38c), preserving upstream's VICTORY_POOL_SMALL=0 default, unlocked take_from heap creation (#816), UPLOADS/SHARED buffer pools (#991), KEY/is_pooled (#999), and dense TextureQueue layout.

Summary of Changes

  • Adaptive 16 MiB / 8 MiB size-segregated texture pools (pool.rs): splits small (<= 256 KiB) and large textures into separate pools with 16/8 MiB blocks on <= 12 GiB VRAM cards, best-fit Ranges::take, fullest-non-empty-block-first placement, and VICTORY_POOL_GATE with no_fit caching so lightly-used blocks drain back to Windows.
  • Block-aware idle eviction & target-reserve settle (resource.rs): tracks each texture's encoded pool block (pool_block) for drain-a-block eviction, caps trapped pool-free credit during eviction so fragmented blocks still drain, and settles targets_kept_from_peak to 0 after targets stabilize (preventing ~690 MB from staying permanently locked on DLSS / lower internal resolutions).
  • Pop-in upload priority (descriptor/host.rs): splits periodic already-uploaded recheck scans into a 3rd tier behind again and fresh inside Due::ordered() while keeping upstream's O(N) select_nth_unstable_by_key and 16-byte tuple layout.
  • Tight-VRAM pre-allocated buffer cap (ahead.rs) & staging admission (texture/ahead.rs): scales pre-allocated card buffers on <= 12 GiB cards and gates speculative prefetch on general texture admission.

Verification & Re-Measurement on main (923e38c)

  • Unit tests: 24/24 pool + 29/29 resource::tests + 59/59 descriptor::host::tests pass; 0 new warnings.
  • Live benchmark (RTX 3080 10 GB, Ryzen 7 7800X3D, diag build, warm cache, 1440p DLSS Performance, FG off, 115 s scripted run):
Metric main (923e38c, ~7,650 draws) This PR (bc6a02a, ~8,100 draws) Delta
Steady 3D FPS (med / peak) 15.7 / 17.3 (stall to 5.9) 18.3 / 20.1 (0 stalls) +16.6% FPS
GPU busy (%) / idle behind CPU (ms) 66.0% / 21.65 ms 90.0% / 5.40 ms +24.0 pp / −75.1% idle
Submit prep TOTAL 58.50 ms 49.10 ms −9.40 ms (−16.1%)
Kept for render targets 692 MB (permanent) 0 MB (settled) −692 MB freed
Texture queue weighed VRAM 8,806 MB 8,244 MB −562 MB
Slots held back for room (last 5 s) 580–991 0 −100% starvation
Empty pool blocks returned to Windows 14 (896 MB) 18 (1,152 MB) +256 MB reclaimed
Textures uploaded since start 68,310 (2,514 MB) 71,126 (2,415 MB) +2,816 textures, −99 MB
**@⁠mikael-jarvinen** on GitHub · 2026-11-28 21:45 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1562) `mikael-jarvinen:pr-adaptive-texture-pool-and-popin` → `main` · +769 −171 · 6 files · 2 commits · open Rebased replacement for #1168 onto `main` (`923e38c`), preserving upstream's `VICTORY_POOL_SMALL=0` default, unlocked `take_from` heap creation (#816), `UPLOADS`/`SHARED` buffer pools (#991), `KEY`/`is_pooled` (#999), and dense `TextureQueue` layout. ### Summary of Changes - **Adaptive 16 MiB / 8 MiB size-segregated texture pools (`pool.rs`)**: splits small (`<= 256 KiB`) and large textures into separate pools with 16/8 MiB blocks on `<= 12 GiB` VRAM cards, best-fit `Ranges::take`, fullest-non-empty-block-first placement, and `VICTORY_POOL_GATE` with `no_fit` caching so lightly-used blocks drain back to Windows. - **Block-aware idle eviction & target-reserve settle (`resource.rs`)**: tracks each texture's encoded pool block (`pool_block`) for drain-a-block eviction, caps trapped pool-free credit during eviction so fragmented blocks still drain, and settles `targets_kept_from_peak` to 0 after targets stabilize (preventing ~690 MB from staying permanently locked on DLSS / lower internal resolutions). - **Pop-in upload priority (`descriptor/host.rs`)**: splits periodic already-uploaded `recheck` scans into a 3rd tier behind `again` and `fresh` inside `Due::ordered()` while keeping upstream's `O(N)` `select_nth_unstable_by_key` and 16-byte tuple layout. - **Tight-VRAM pre-allocated buffer cap (`ahead.rs`) & staging admission (`texture/ahead.rs`)**: scales pre-allocated card buffers on `<= 12 GiB` cards and gates speculative prefetch on general texture admission. ### Verification & Re-Measurement on `main` (`923e38c`) - **Unit tests:** 24/24 `pool` + 29/29 `resource::tests` + 59/59 `descriptor::host::tests` pass; 0 new warnings. - **Live benchmark** (RTX 3080 10 GB, Ryzen 7 7800X3D, `diag` build, warm cache, 1440p DLSS Performance, FG off, 115 s scripted run): | Metric | `main` (`923e38c`, ~7,650 draws) | This PR (`bc6a02a`, ~8,100 draws) | Delta | |---|---:|---:|---:| | Steady 3D FPS (med / peak) | 15.7 / 17.3 (stall to 5.9) | **18.3 / 20.1 (0 stalls)** | **+16.6% FPS** | | GPU busy (%) / idle behind CPU (ms) | 66.0% / 21.65 ms | **90.0% / 5.40 ms** | **+24.0 pp / −75.1% idle** | | Submit prep TOTAL | 58.50 ms | **49.10 ms** | **−9.40 ms (−16.1%)** | | `Kept for render targets` | 692 MB (permanent) | **0 MB (settled)** | **−692 MB freed** | | Texture queue weighed VRAM | 8,806 MB | **8,244 MB** | **−562 MB** | | Slots held back for room (last 5 s) | 580–991 | **0** | **−100% starvation** | | Empty pool blocks returned to Windows | 14 (896 MB) | **18 (1,152 MB)** | **+256 MB reclaimed** | | Textures uploaded since start | 68,310 (2,514 MB) | **71,126 (2,415 MB)** | **+2,816 textures, −99 MB** |
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 21:48:40 +00:00
Author
Owner

@⁠crashoverride1995 on GitHub · 2026-11-29 00:14 UTC · original

Still iterating, claude messed up lol

**@⁠crashoverride1995** on GitHub · 2026-11-29 00:14 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1562#issuecomment-7247976632) Still iterating, claude messed up lol
github-bot force-pushed github-bot/gh-1562 from 36321ad0a6 to 8b4b42b708 2026-11-29 08:44:40 +00:00 Compare
Author
Owner

@⁠Saturcolor on GitHub · 2026-11-29 13:44 UTC · original

Data point on a 12 GB card: RTX 3080 12 GB (budget 11.3 GB), Ryzen 7 5700X3D, Windows 11, driver 621.24.
#1562 (8b4b42b7) on main 829188e9, Series S, DLSS Quality, DLSS frame generation 2x, ray tracing off.

Textures look clean, but the 16/8 MiB blocks this picks for <= 12 GiB budgets gave a hitch every ~2 s.
With VICTORY_TEXTURE_BLOCK_MB=64 (64/16 MiB), same save, same settings:

  • frames over 100 ms: 1 in 38 -> 1 in 117
  • frames over 50 ms: 29 % -> 5 %
  • rendered fps (mean in world): 20.9 -> 25.5
  • DLSS-FG "Frame rate over 100 ms, resetting frame timer": 326 -> 40

Maybe keep 64 MiB large blocks on 12 GB cards (16 MiB only below that)?

**@⁠Saturcolor** on GitHub · 2026-11-29 13:44 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1562#issuecomment-7256770103) Data point on a 12 GB card: RTX 3080 12 GB (budget 11.3 GB), Ryzen 7 5700X3D, Windows 11, driver 621.24. #1562 (8b4b42b7) on main 829188e9, Series S, DLSS Quality, DLSS frame generation 2x, ray tracing off. Textures look clean, but the 16/8 MiB blocks this picks for <= 12 GiB budgets gave a hitch every ~2 s. With VICTORY_TEXTURE_BLOCK_MB=64 (64/16 MiB), same save, same settings: - frames over 100 ms: 1 in 38 -> 1 in 117 - frames over 50 ms: 29 % -> 5 % - rendered fps (mean in world): 20.9 -> 25.5 - DLSS-FG "Frame rate over 100 ms, resetting frame timer": 326 -> 40 Maybe keep 64 MiB large blocks on 12 GB cards (16 MiB only below that)?
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/ahead.rs
  • crates/victory-gpu/src/descriptor/host.rs
  • crates/victory-gpu/src/draw.rs
  • crates/victory-gpu/src/pool.rs
  • crates/victory-gpu/src/resource.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1562'
git switch 'github-bot/gh-1562'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1562'
git switch 'github-bot/gh-1562'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1562'
git switch 'main'
git merge --squash 'github-bot/gh-1562'
git switch 'main'
git merge --ff-only 'github-bot/gh-1562'
git switch 'main'
git merge 'github-bot/gh-1562'
git push origin 'main'
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/trustno1-coder--VIctory-NVIDIA!1562
No description provided.