GPU: a list's small first scratch chunk may be a kept 4 MiB one (port of fxceless#1367, first part) #700
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/700"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by kibagami-nc on 2026-11-28T03:46:56Z.
Rebased on main (
f9dfb76f). Main has since given scratch chunks a memory kind (Chunk::wb: write-back or write-combined) and takes a kept one only of the kind asked (Spare::take_if).take_keptfollows it: a small first chunk takes a kept 4 MiB one of the same memory only, and the test checks that one of the other memory is not taken.cargo test -p victory-gpu --lib --locked: 590 passed, 44 ignored. Clippy: nothing new against main's own findings.The problem
A list's first scratch chunk is a small one (
SCRATCH_FIRST, 256 KiB).Spare::take(crates/victory-gpu/src/host.rs) gives back only a chunk of the exact size asked for.When the kept spares were all 4 MiB ones, every small first chunk was made new, as a committed upload buffer. As many came back past the bound and were freed. fxceless measured about 35 a frame on an RTX 5080 (Series S, a balcony scene), about 1 ms each to free.
The change
take_chunkgives a kept 4 MiB chunk for a small first one when no chunk of the small size is kept.take_kept).VICTORY_SCRATCH_ANY_SIZE=0turns this off.plane_upload, the other user oftake_chunk, keeps the size it is given back too.This is a port of the first part of Ym1r1710's change (fxceless/victory-fork#1367).
Its second part, a 512 MiB bound on the kept spares, is left out. This tree already raises that bound to 1 GiB where the PC's memory is not limited (
SPARE_KEPTwithkeep_freed), and keeps 128 MiB elsewhere. Several reports here are about commit charge on 16 GB PCs, so I did not raise it further for everyone.fxceless measured both parts together: 63-84 ms a frame before, 52-56 ms after, and 0 chunk drops a frame instead of 30-52. I have not measured this part alone in the game. A run with
VICTORY_SCRATCH_ANY_SIZE=0, and one without it, would show its share.Tests
host::spare::a_small_first_chunk_takes_a_kept_4_mib_one. It covers the switch, sizes other than the small first one, a kept small chunk taken before a 4 MiB one, and the size given back.cargo test -p victory-gpu --locked --lib: 453 passed, 0 failed.cargo clippy -p victory-gpu --all-targets -- -D warnings, with and without--all-features: nothing in the changed lines.main's own findings are fixed by #665.No game files, dumps or extracted data are included.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Dukestar69 on 2026-11-28T04:30:06Z.
Review: APPROVED
LGTM — verified on Windows (RTX 5090):
cargo test -p victory-gpu --lib host::passed (121/121)cargo xtask policypassed (294 files ok)Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).