Reuse fenced GPU upload scratch across command lists #1524
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1525"
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?
Imported from Marvisak/VIctory. Originally posted by franticfrostin on 2026-11-24T18:45:32Z.
Summary
Recycle idle D3D12 upload scratch across command lists after the GPU has finished using it. The shared pool holds up to 4 MiB. If the fence wait fails, the submission stops through VIctory’s existing GPU failure reporter before the buffers can be recycled.
Testing
On an RTX 4060 Laptop GPU, two 170-second Series S runs compared pooling on and off in the same build. New scratch allocations dropped from 1,669 to 118, while peak scratch capacity rose from 27.5 to 28.5 MiB. A 150-second Series X run also reached world rendering with the pool enabled.
The earlier live runs used 256 KiB chunks and PR #431. The current patch is rebased onto
940d32fand preserves upstream’s on-demand chunk sizing from 64 KiB to 4 MiB. The shared idle pool is capped at 4 MiB in total and reuses chunks of the requested capacity.On the rebased patch, four scratch tests passed on hardware and WARP. Workspace Clippy with all features, the default-feature GPU Clippy check, and the asset-policy check also passed. Frame rate and long-session stability remain unverified.
Related work includes dedicated upload pooling in #982 and scratch chunk sizing in #1246. Codex helped write and test this patch.
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T18:57:03Z.
Review: APPROVED
Verified locally merged onto
origin/main(Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC):cargo test -p victory-gpu— 53 passed, 0 failed (1 ignored) on both RTX 5090 hardware andVICTORY_D3D12_WARP=1(including the 3 new scratch pool/reclaim tests)cargo clippy -p victory-gpu --all-targets— 0 warningscargo xtask policy— okClean fenced upload scratch pooling and reuse across command lists within the shared budget. Looks good.
AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:30:13Z.
Automated triage for the maintainers.
Merge candidate. It merges cleanly. In
crates/victory-gpu/src/host.rs,HostList::resetnow trims each list's scratch to the peak of its last two recordings, and hands the rest to a process-wide idle pool (IDLE_SCRATCH, at most 4 MiB, reused by exact capacity).Scratch::reservekeeps the old growth policy, and it no longer moves the cursor when an allocation fails. This is only safe if no list is reset while its work is still running. I checked that:Host::executehas the onlyExecuteCommandListsin the crate, and it waits on the fence for every group. The PR makes a failed fence wait fatal (fail(..)with the removal report) instead of a warning, which closes the one path where a chunk could be recycled while still in use. That behaviour change is deliberate and worth a maintainer's glance. The measured drop from 1,669 to 118 new scratch allocations in a 170 s run is in the description. Overlap with #982 (dedicated uploads) and #1246 (chunk sizing) is noted there.CI: passing (
check).Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:01:32Z.
Automated triage for the maintainers, second look (a review against current
main, with builds and tests where they could change the verdict).Closing because the gain is not shown on
main. The measurement (new scratch allocations 1,669 to 118) was taken on an older base with fixed 256 KiB chunks plus another PR. Onmaineach host list already keeps its scratch chunks across resets, and since9cc37c5fhost lists themselves are recycled with their chunks, so the churn the pool removes is not known to exist; the trimming can add some, because a list whose use alternates would free chunksmainkeeps. The fatal fence-wait change is unrelated and should be its own PR.If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.
Pull request closed