First uploads over the line: the widest free range is what fits in either texture pool #4200

Closed
github-bot wants to merge 13 commits from github-bot/gh-4199 into main AGit
Owner

@⁠marquezlale-creator on GitHub · 2026-11-30 17:22 UTC · original
marquezlale-creator:pr/texture-widest-free → main · +829 −826 · 33 files · 13 commits · closed without merging

What it changes

resource::first_upload_decision lets a first upload past the room line go without a new block when it fits a free range of the texture pools (pool::texture_widest_free). That took the wider of the large and small pools. A small face (4-12 KiB) can only be cut from the small pool (pool_for), so it was admitted on the large pool's room while its own pool grew a new 64 MiB block for it, with none refused at the whole card.

Now texture_widest_free(bytes) looks at the pool the texture goes to, told by its size (after review): 64 KiB or less in all → the small pool; over 256 KiB → the large pool, whatever the small one holds; in between, where the size alone does not tell (4 KiB placement depends on the first level), it must fit in both. Each pool's range counts after its start is moved up to the pool's alignment (64 KiB / 4 KiB), and the small pool only where small textures go (VICTORY_POOL_SMALL placement and VICTORY_POOL_SMALL_APART both on). A unit test covers it (widest_free_is_its_own_pools).

How it was tested

  • GPU and profile: RTX 5070 12 GB, Series X, 2560x1440, DLSS balanced, frame generation off, ray tracing off.
  • Before (v2026.11.29.05 base, a 7-hour session): from about 6 h in, "first host texture admitted just over the room line" went from about 0 to 1.25 million in 20 minutes; the first-upload decisions said 5.4 million allowed, 0 refused at the whole-card budget; texture copies grew 2.0 -> 4.5 GB and the card 10.0 -> 13.7 GB of a 10.6 GB budget; frames over 100 ms rose about 5x and the game fell to 13-17 fps.
  • After: in the next run "refused at the whole-card budget" counted again (157 in the first five seconds over the line) instead of staying 0.
  • For shader changes: none.
  • cargo test passed for the crates it touches: cargo test -p victory-gpu widest_free first_upload yes; cargo check -p victory --tests yes.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #1944, #3500 (both on first uploads past the budget; neither changes texture_widest_free).

🤖 Generated with Claude Code

**@⁠marquezlale-creator** on GitHub · 2026-11-30 17:22 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4199) `marquezlale-creator:pr/texture-widest-free` → `main` · +829 −826 · 33 files · 13 commits · closed without merging ## What it changes `resource::first_upload_decision` lets a first upload past the room line go without a new block when it fits a free range of the texture pools (`pool::texture_widest_free`). That took the **wider** of the large and small pools. A small face (4-12 KiB) can only be cut from the small pool (`pool_for`), so it was admitted on the large pool's room while its own pool grew a new 64 MiB block for it, with none refused at the whole card. Now `texture_widest_free(bytes)` looks at the pool the texture goes to, told by its size (after review): 64 KiB or less in all → the small pool; over 256 KiB → the large pool, whatever the small one holds; in between, where the size alone does not tell (4 KiB placement depends on the first level), it must fit in both. Each pool's range counts after its start is moved up to the pool's alignment (64 KiB / 4 KiB), and the small pool only where small textures go (`VICTORY_POOL_SMALL` placement and `VICTORY_POOL_SMALL_APART` both on). A unit test covers it (`widest_free_is_its_own_pools`). ## How it was tested - GPU and profile: RTX 5070 12 GB, Series X, 2560x1440, DLSS balanced, frame generation off, ray tracing off. - Before (v2026.11.29.05 base, a 7-hour session): from about 6 h in, "first host texture admitted just over the room line" went from about 0 to **1.25 million in 20 minutes**; the first-upload decisions said 5.4 million allowed, **0 refused at the whole-card budget**; texture copies grew 2.0 -> 4.5 GB and the card 10.0 -> 13.7 GB of a 10.6 GB budget; frames over 100 ms rose about 5x and the game fell to 13-17 fps. - After: in the next run "refused at the whole-card budget" counted again (157 in the first five seconds over the line) instead of staying 0. - For shader changes: none. - `cargo test` passed for the crates it touches: `cargo test -p victory-gpu widest_free first_upload` yes; `cargo check -p victory --tests` yes. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #1944, #3500 (both on first uploads past the budget; neither changes `texture_widest_free`). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
texture_widest_free took the wider of the large and small pools, so small faces
were admitted on the large pool's room while their own pool grew a block each
time: 1.25 million faces over the line in 20 minutes, none refused at the whole
card, the card at 13.7 GB of a 10.6 GB budget (2026-11-30 13:00-13:40).
Now the smaller of the two, after the start is aligned to the pool's alignment.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit b1addb9b0774596951324babd8e2641398f0f1d8)
(cherry picked from commit 7fb710719741cc7a3d86439d8f0b2fde640f07f4)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 18:08:30 +00:00
Author
Owner

@⁠IRennie74 on GitHub · 2026-11-30 18:23 UTC · original · edited 2026-11-30 18:44 UTC

The fix is right for the flood you saw. One side effect of taking the smaller of the two pools: when the small pool's widest range is small or 0, every large texture over the line is now judged by the small pool's room too. A large texture that would fit the large pool's free range then falls through to the next check.

The caller knows which pool the texture goes to. first_upload_decision's argument at resource.rs:2677 is computed where the texture's size and placement are at hand, and pool_for(alignment, apart) picks the pool. Passing the alignment into texture_widest_free and looking only at that pool would keep the fix for small faces without refusing large textures on the small pool's account. On 8-12 GB cards, which run over the line most, extra refusals of large first uploads mean more textures shown at lower levels.

**@⁠IRennie74** on GitHub · 2026-11-30 18:23 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4199#issuecomment-7287769097) · edited 2026-11-30 18:44 UTC The fix is right for the flood you saw. One side effect of taking the smaller of the two pools: when the small pool's widest range is small or 0, every large texture over the line is now judged by the small pool's room too. A large texture that would fit the large pool's free range then falls through to the next check. The caller knows which pool the texture goes to. `first_upload_decision`'s argument at `resource.rs:2677` is computed where the texture's size and placement are at hand, and `pool_for(alignment, apart)` picks the pool. Passing the alignment into `texture_widest_free` and looking only at that pool would keep the fix for small faces without refusing large textures on the small pool's account. On 8-12 GB cards, which run over the line most, extra refusals of large first uploads mean more textures shown at lower levels.
texture_widest_free takes the texture's size and looks at the pool it goes
to: 64 KiB or less in all, the small pool (its first level fits 4 KiB
placement); over 256 KiB, the large pool, whatever the small one holds; in
between, where the size alone does not tell, both. A large texture is no
longer refused on the small pool's room.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠marquezlale-creator on GitHub · 2026-11-30 18:42 UTC · original

Thanks, agreed. texture_widest_free now takes the texture's size and looks only at the pool it goes to: 64 KiB or less in all → the small pool; over 256 KiB → the large pool, whatever the small one holds; in between (where the size alone doesn't tell, since the 4 KiB placement depends on the first level) → both, as before. The alignment itself isn't known at that call site, so the size decides; the test covers all three cases (9392a57e).

**@⁠marquezlale-creator** on GitHub · 2026-11-30 18:42 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4199#issuecomment-7288249479) Thanks, agreed. `texture_widest_free` now takes the texture's size and looks only at the pool it goes to: 64 KiB or less in all → the small pool; over 256 KiB → the large pool, whatever the small one holds; in between (where the size alone doesn't tell, since the 4 KiB placement depends on the first level) → both, as before. The alignment itself isn't known at that call site, so the size decides; the test covers all three cases (9392a57e).
github-bot closed this pull request 2026-12-01 18:50:32 +00:00
Author
Owner

@⁠trustno1-coder on GitHub · 2026-12-01 18:45 UTC · original

Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

**@⁠trustno1-coder** on GitHub · 2026-12-01 18:45 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4199#issuecomment-7321497821) Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

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/trustno1-coder--VIctory-NVIDIA!4200
No description provided.