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

Open
mikael-jarvinen wants to merge 2 commits from upstream-pr/1562 into main
mikael-jarvinen commented 2026-11-28 21:45:12 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mikael-jarvinen on 2026-11-28T21:45:12Z.


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
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5544868428 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1562). Originally posted by [mikael-jarvinen](https://github.com/mikael-jarvinen) on 2026-11-28T21:45:12Z. --- 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** |
crashoverride1995 commented 2026-11-29 00:14:39 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by crashoverride1995 on 2026-11-29T00:14:39Z.


Still iterating, claude messed up lol

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7247976632 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1562#issuecomment-7247976632). Originally posted by [crashoverride1995](https://github.com/crashoverride1995) on 2026-11-29T00:14:39Z. --- Still iterating, claude messed up lol
Saturcolor commented 2026-11-29 13:44:49 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Saturcolor on 2026-11-29T13:44:49Z.


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)?

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7256770103 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1562#issuecomment-7256770103). Originally posted by [Saturcolor](https://github.com/Saturcolor) on 2026-11-29T13:44:49Z. --- 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 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/1562:upstream-pr/1562'
git switch 'upstream-pr/1562'

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/1562'
git switch 'upstream-pr/1562'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1562'
git switch 'upstream-pr/1562'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1562'
git switch 'main'
git merge --squash 'upstream-pr/1562'
git switch 'main'
git merge --ff-only 'upstream-pr/1562'
git switch 'main'
git merge 'upstream-pr/1562'
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
trustno1-coder/VIctory-NVIDIA!1562
No description provided.