GPU: grow per-list upload scratch on demand #1246
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1246"
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 LaunchDoesntCode on 2026-11-24T16:46:17Z.
The first scratch allocation on each host command list currently reserves 4 MiB, even for a 256-byte request. This starts per-list chunks at 64 KiB, grows them to fit up to 4 MiB, and reuses them after a fenced reset. Larger requests still get a dedicated upload. The optional
victory_gpu::scratch=debugtrace reports each new chunk's requested and allocated sizes.On an integrated Windows WARP playtest build, 158 distinct command lists allocated 261 scratch chunks totaling 30.4 MiB during loading. At the old fixed size, the first chunk of each of those lists alone would account for 632 MiB. These figures describe cumulative chunk allocations. They do not measure peak process memory or frame time.
The regression test uses a D3D12 list to check 256-byte alignment, small and large requests, overflow, and reuse of the same upload addresses after submission and reset. On this branch based on
ffe310e, the Windows diagnostics GPU suite passed 54 tests with one ignored. Workspace Clippy with all targets and features, the default workspace check with all targets, and the asset-policy check also passed.Related to #982, which pools transient uploads across lists. This change sizes the scratch chunks retained by each list.
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T16:56:50Z.
Review: APPROVED
Tested merged cleanly onto
main(ffe310e) on Windows 11 x64 (Rust 1.98.1 MSVC) with NVIDIA GeForce RTX 5090 (Blackwell) and WARP (VICTORY_D3D12_WARP=1):cargo test -p victory-gpu(RTX 5090): 51 passed, 0 failed, 1 ignoredVICTORY_D3D12_WARP=1 cargo test -p victory-gpu(WARP): 51 passed, 0 failed, 1 ignoredcargo clippy -p victory-gpu --all-targets: 0 warningscargo xtask policy: okClean on-demand growth for per-list upload scratch buffers, verified on Blackwell hardware and WARP. Approving.
AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T17:40:09Z.
Review: APPROVED
Tested
59035de9on Windows 11, RTX 5070, MSVC:cargo test -p victory-gpupasses on the head (51 passed, 1 ignored), including the new scratch test.clippy -D warnings(default and all features) are all clean.The change is right:
len <= SCRATCH_CHUNKholds on the chunk path, so a new chunk is always big enough: at leastlenrounded up to 64 KiB, at most 4 MiB.while letwalks past reused chunks that are too small, andchunk.capacity - s.usedcan't underflow, becauseusednever passes the capacity.checked_next_multiple_ofturns au64::MAXrequest intoNone, where it used to overflow.One trade-off worth a comment: after a reset, a request bigger than the current chunk skips that chunk for the rest of the list, even if later small requests would have fit in it. That's fine for a scratch arena.
AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T17:59:28Z.
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at
59035de:cargo test -p victory-gpupasses, 51 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).Tested with AI assistance (Claude).
Imported from Marvisak/VIctory. Originally posted by fladit123 on 2026-11-24T18:02:10Z.
Independent focused validation of
59035de94c4a7c42361994ea861641a7ac78c2e9on NVIDIA Ada Lovelace.Environment
The regression test
list_scratch_grows_to_fit_and_reuses_fenced_chunkspassed on both the physical RTX 4060 and WARP. Separate instrumentation confirmed that the test reached both GPU submissions rather than returning early.The existing alignment, allocation growth and fenced reuse assertions passed.
Limitations: The build used a zero-byte BCPack placeholder with the original table excluded. This is focused validation, not a clean full-workspace result. Peak memory reduction and scratch payload integrity were not independently measured.
No game data or proprietary console SDK material was used.
AI use: OpenAI Codex assisted with test execution and instrumentation; ChatGPT (GPT-6.2) assisted with reporting.