perf(gpu): avoid full texture pool scans on first-upload admission #4454

Closed
v8816 wants to merge 11 commits from upstream-pr/4454 into main
v8816 commented 2026-11-30 20:34:16 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by v8816 on 2026-11-30T20:34:16Z.


Problem

When the card is at or over budget, first-upload admission computes the largest free range across both texture pools for each candidate. The earlier budget guards can settle some decisions without that scan. The remaining candidates only need to know whether a single reusable range fits.

Change

Defer the range lookup until it can affect admission, and stop at the first fitting range. Keep the existing budget limits and decision counters. A new test covers fragmented ranges, the cooldown before returned pieces become reusable, and coalescing after reclaim. The admission tests also verify that guard decisions skip the lookup.

Validation

  • Release resource and pool suites: 96 passed, 4 ignored. The asset policy passed for both changed files.
  • Synthetic CPU comparison with 57 blocks, 29 ranges per block, and 6,000 requests: median of nine runs was 9.84 ms before and 1.43 ms after for mixed fits. With every lookup missing, it was 9.90 ms before and 11.64 ms after. This microbenchmark isolates one pool lookup. Gameplay and sustained FPS have not been measured.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5573273437 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4454). Originally posted by [v8816](https://github.com/v8816) on 2026-11-30T20:34:16Z. --- ## Problem When the card is at or over budget, first-upload admission computes the largest free range across both texture pools for each candidate. The earlier budget guards can settle some decisions without that scan. The remaining candidates only need to know whether a single reusable range fits. ## Change Defer the range lookup until it can affect admission, and stop at the first fitting range. Keep the existing budget limits and decision counters. A new test covers fragmented ranges, the cooldown before returned pieces become reusable, and coalescing after reclaim. The admission tests also verify that guard decisions skip the lookup. ## Validation - Release resource and pool suites: 96 passed, 4 ignored. The asset policy passed for both changed files. - Synthetic CPU comparison with 57 blocks, 29 ranges per block, and 6,000 requests: median of nine runs was 9.84 ms before and 1.43 ms after for mixed fits. With every lookup missing, it was 9.90 ms before and 11.64 ms after. This microbenchmark isolates one pool lookup. Gameplay and sustained FPS have not been measured.
tikD1337 commented 2026-11-30 20:51:10 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by tikD1337 on 2026-11-30T20:51:10Z.


Tested headlessly on origin/main (e1251c31, Windows 11, no game run):

  • Merge check: clean against origin/main.
  • cargo test -p victory-gpu --lib -- pool::tests: 31 passed, 0 failed, 3 ignored (1166 filtered).
  • cargo test -p victory-gpu --lib -- first_upload: 10 passed, 0 failed (1190 filtered), no new warnings.

(AI-assisted build/unit-test check; game runtime not launched.)

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7291560426 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4454#issuecomment-7291560426). Originally posted by [tikD1337](https://github.com/tikD1337) on 2026-11-30T20:51:10Z. --- Tested headlessly on `origin/main` (`e1251c31`, Windows 11, no game run): - Merge check: clean against `origin/main`. - `cargo test -p victory-gpu --lib -- pool::tests`: **31 passed, 0 failed, 3 ignored** (1166 filtered). - `cargo test -p victory-gpu --lib -- first_upload`: **10 passed, 0 failed** (1190 filtered), no new warnings. *(AI-assisted build/unit-test check; game runtime not launched.)*
trustno1-coder commented 2026-12-01 18:41:29 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:41:29Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7321353159 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4454#issuecomment-7321353159). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-12-01T18:41:29Z. --- 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

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!4454
No description provided.