perf(gpu): opt in to global best-fit texture placement #3711
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!3711
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3711"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@fladit123 on GitHub · 2026-11-30 04:26 UTC · original
fladit123:perf/texture-pool-best-fit-v2-global→main· +115 −8 · 1 files · 1 commits · closed without mergingSupersedes #543 on
41adb55167fa778fcaa5dc36fa18a1fa8dacd657.Enable
VICTORY_POOL_BEST_FIT=1to use global best-fit in the standard and small-alignment texture pools. Among ripe heaps, it selects the smallest suitable range, using alignment padding, block slot and offset to break ties. The existing oldest-first fallback still handles requests that cannot use a ripe heap. Fullest-block-first remains the default. With best-fit disabled,VICTORY_POOL_FULLEST=0still selects first-fit.The texture path uses the existing accounting, quarantine, submission marks, growth and reclaim operations. D3D12 heap creation stays outside the mutex. Staging and CPU-visible pools continue through the upstream selector.
Capacity and reclaim
Contention
In the isolated 30-run confirmation on the dense 64-block contention fixture, enabling global best-fit reduced median paired throughput by 17.42% at two threads, 17.48% at four threads and 14.98% at eight threads. These are allocator measurements from a synthetic fixture.
With best-fit disabled, the paired capacity replay matched clean main in all 210 comparisons. The timing runs did not establish a consistent disabled-path regression above the observed variability. At eight threads, the median difference was +1.16% in the first isolated run and −3.31% in the confirmation. The confirmation's interquartile range was −10.15% to +5.15%, and repeated executions of the same clean binary showed variation of similar magnitude.
Experimental campaign and final-candidate validation
Both physical suites ran on the RTX 4060 and WARP. They cover synthetic upload and readback, fence completion, quarantine, concurrent placement, small alignment, ahead heaps and committed fallback. Release and diagnostics builds, targeted tests and the staged asset-policy check passed. Strict workspace Clippy and the full-tree asset policy reproduced existing failures on clean main.
Related work and scope
#1337 and #1562 explore related hybrid strategies that prioritize block occupancy and use best-fit within a block. This patch compares suitable ranges across ripe heaps and keeps the existing heap size, streaming, eviction and spare policies.
The campaign provides no gameplay, FPS or frametime results.
AI assistance was used to develop and review the patch, write the test harnesses and prepare the evidence and this description.
@dyshay on GitHub · 2026-11-30 05:49 UTC · original
Merged into our fork's integration branch for testing (dyshay/VIctory-NVIDIA, branch
janus-prs). I read the full diff first: no network access, process spawning, binaries, build or dependency changes, or game data. It builds with--profile diag --features diagnostics, and the CPU tests of the touched crates pass. A run on an RTX 4090 is queued (Series S with ray tracing, DLSS Quality). Frame times will follow here.@tyr0nsur on GitHub · 2026-11-30 08:44 UTC · original
I tested removing the sorts from the shared placement paths while keeping the selected block and offset. Follow-up commit
316593cis based on020f78a. The default selects the fullest fitting ripe block in one pass. The fallback selects the oldest fitting unripe block in one pass. Both keep slot order for equal ranks and use the existing range split. Global best-fit's ripe-range selection stays as in this PR.I compared 250,000 placement decisions before/after with deterministic allocation and return traces across fullest-first, first-fit and opt-in best-fit. Every slot/offset or miss matched, including with 4 KiB, 64 KiB and 4 MiB alignment. The diagnostics pool test filter returned 31 passed and 3 ignored. The staged asset-policy check passed.
Synthetic Windows CPU timings on a Ryzen 7 5800X, with 64 slots (56 live blocks), fragmented ranges and identical requests per pair. The single-thread p99 is the median of seven repetitions of 16,000 cuts per arm. For contention, one shared mutex with four threads, 12,000 attempts each and seven paired runs.
The throughput ratios compare each policy with itself. The mixed best-fit fixture includes requests that fall back or miss. Timing covers the CPU allocator, with synthetic ranges and no title data. Review assisted by Claude Opus 5.5.
@fladit123 on GitHub · 2026-11-30 13:29 UTC · original
Thanks for the independent review and validation! I'm looking forward to the RTX 4090 results, particularly the frame times and memory behavior. I appreciate your help testing this on different hardware.
@fladit123 on GitHub · 2026-11-30 13:29 UTC · original
Excellent follow-up, thank you! Removing the sorts under the lock while preserving placement decisions is particularly interesting given the contention costs measured in my original campaign.
I'll independently validate your commit on my RTX 4060 and compare it against both clean main and the original best-fit implementation, including allocation throughput, capacity, reclaim behavior, and GPU correctness.
Thanks for building on this contribution!
@trustno1-coder on GitHub · 2026-12-01 18:49 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.
Pull request closed