Upload and shared buffers cut from blocks, not each an allocation of its own #991
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/991"
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 0xkn0wh3r3 on 2026-11-28T10:48:59Z.
Every upload buffer and every shared buffer (PC memory the CPU maps) was its own committed resource, made resident on the thread that asked for it. That's about a millisecond each, and more while the system pages. A play log (RTX 5070 Ti, 2026-11-28) counted, in each 5 seconds of play:
All of it on the threads that translate and submit the title's lists.
What changes
crate::pool), the way the texture pool places textures. A block is made resident once; a buffer is then one placement and one mapping.Reclaim, which now names its pool), and rests 2.5 s before it's used again.VICTORY_BUFFER_POOL=0makes each buffer an allocation of its own again.Host::upload_buffer_ownandshared_buffer_ownare that path.Tests
buffers_up_to_four_mib_are_cut_at_multiples_of_64_kib: which sizes are pooled and the piece each takes.buffers_cut_from_blocks_start_as_zeros_and_come_back: buffers don't overlap, are mapped and start as zeros, also when a piece is used again after its rest.the_card_reads_and_writes_buffers_cut_from_blocks: the card copies what the CPU wrote into a pooled upload buffer into a pooled shared buffer, and the CPU reads it back. Both lie past another buffer in their block.acceptance_buffers_cut_from_blocks: 256 buffers of 64 KiB of each kind, pooled against allocations of their own. WithVICTORY_ACCEPTANCE=1in a release build it fails below 5 times as fast.Measured (RTX 5070 Ti, release,
--test-threads=1), two runs:Next to a thread that keeps the system paging, as while a scene loads, one 64 KiB upload buffer took 1.01 ms on average (median 1.15). Pooled it takes 0.06 ms (median 0.003). The slowest pooled call, about 22 ms, is making the block itself, once per 1,024 buffers. 8 MiB buffers aren't pooled: 3.0 ms either way.
About flaky tests under load
With several suites running at once beside busy processes, some watch, descriptor and frame tests in
mainfail now and then, with this change and without it. They assert on process-wide state that other tests' threads change. This PR doesn't touch them; a fix is in its own commit, to follow separately. On a quiet machine, and in single runs, the suite behaves the same with or without this PR.Checked
cargo test --workspace --locked: all pass (victory-gpu lib: 457 passed, 36 ignored).cargo clippy -p victory-gpu --all-targets, with and without--all-features: nothing in the changed files.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Exopus-0x65f7ad0 on 2026-11-28T13:23:05Z.
A play session on this branch, since the PR says it hasn't had one yet.
Setup: RTX 5060 Ti 8 GB (DXGI local budget ~7.0 GB), 16 GB RAM (64 GB page file), Windows 11 26300.
63b902fplus this PR, plus a few local commits that don't touchhost.rsbuffers orpool.rs. README launcher defaults (Series X, native 1440p, DLSS Quality, no frame generation). Opening prison room, same save as my baseline from this morning. 90 s scripted walk (stick input), fps read from the window title every 2 s.no upload buffer/no shared bufferno block of buffers/a block of buffers is not residentvictory.exeprivate bytes at the endtexture queue's room … 90.0 % of a budget of 7013 MB: no roommost of the run). The submitting threads' buffer-creation time this PR removes is real, but this card is limited elsewhere, so I wouldn't expect a big number here. A CPU-bound machine should show it better.No regressions seen. 👍