GPU: grow the write snapshot in place, and cap idle pool memory #472
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!472
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-472"
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?
@SaymonMaster14 on GitHub · 2026-11-24 03:49 UTC · original
SaymonMaster14:memory/peak-during-world-load→main· +53 −22 · 3 files · 1 commits · openFour leaks in the copy bridge, found while measuring #471. Each one is small on
its own; together they cost the peak exactly where commit is tight.
shadow.rs,Shadow::writing: the snapshot grown to span a submission'sdeclared ranges allocated a second buffer of the new size, copied the old
into it and only then returned the old to the pool. At the largest growth that
holds both, and the world's heap is 174 MB — the peak doubles there. It is now
grown in place:
reserve_exactfor exactly the growth (the amortized doublingof a buffer this size would double the capacity, and a copying realloc its
peak), then extend on either side.
shadow.rs,give_back: the pool kept its eight largest buffers whatevertheir size, so one world load left eight 174 MB snapshots — about 1.4 GB idle,
never shrunk. The largest is now always kept (its reuse is what saves the
millions of page faults the 64 KiB pages were chosen for) and further buffers
only while they add up to 256 MiB, still at most eight.
texture.rs: everyStagingkept aVecof the whole texture for good, so theresident cost was the sum of every texture that had been refreshed. One shared
SCRATCH, kept and already touched, makes it the largest texture instead. Thehash path does not use the buffer (it hashes the mapping directly), and the
staging mapping is written only at submission, so the lock costs nothing there.
dstorage.rs,staging_bytes: a zlib-then-BCPack request inflates into anintermediate buffer that counted against no limit. It now counts against the
32 MiB staging cap, so the cap bounds what is really held. Requests of that
shape serialize more when one is large; no throughput was measured either way.
What is in it: those four, and nothing else. No interface change.
Tested:
cargo build --release -p victory,cargo test -p victory-gpu -p victory-hle— 130 passed, 1 ignored, 0 failed. Live, release, world load, 16 GBmachine: the process reached 18.0 GB private and died at
memory allocation of 70426816 bytes failed, system commit 48.8 GB of 49.0 GB. It still dies — thesereduce the slope, they do not remove the ceiling.
Not tested: the headroom case. The earlier runs measured the page file, not
PrivateMemorySize64, and there are no per-component counters, so "the peakwent down" cannot be claimed from the two side by side; #471 has the samples
and the counters that would settle it. Also unmeasured: whether the 256 MiB cap
is the right number (it keeps ~1.5 world heap snapshots; 192 MiB or 384 MiB are
as arguable), and the DStorage serialization cost.
Not a #407 fix. This is bridge work, which #407 proposes to delete. It holds
until stage 2 there — xmem asking a GPU-visible arena first — replaces the
copies. Worth merging only as the stopgap it is.
Fixes #471.
AI use: Claude (Sonnet 5.5) in a Maestri terminal drove the code reading, the
edits, the build and the test run; the memory sampling and the reproduction
were set up outside it.
@DaviTostes on GitHub · 2026-11-24 03:51 UTC · original
Verified
f200a2aon Arch Linux x86_64, Windows MSVC release build under Wine 11.22 (victory-gpu,--test-threads=1): 43 passed, 0 failed, 1 ignored (same count asmain, no new test in this head).Not covered: the snapshot growth and idle-pool cap under a real world frame (no game data here).
@erickbobd on GitHub · 2026-11-24 13:08 UTC · original
Companion test-only PR against your
memory/peak-during-world-loadbranch: SaymonMaster14/VIctory#1, based exactly onf200a2a.Two synthetic tests cover snapshot byte preservation/allocation reuse with spare capacity and intermediate DStorage staging for file and memory inputs. On the pure parent plus these tests: 46 victory-gpu passed / 1 ignored; 87 victory-hle passed, serial. Replacing each function with its real pre-#472 version makes its test fail; restoring both passes the full suites again. Asset policy: 151 files OK.
Tested on RTX 5070 Ti / NVIDIA 617.14, Windows 11 26200.9974, Rust 1.98.1 / MSVC x64. This verifies the regression fixtures, not live-game memory savings. AI-assisted (Codex); synthetic inputs only.
@BaggyALPHA on GitHub · 2026-11-24 15:42 UTC · original
I tried a Series S WARP comparison with
f200a2aapplied on top of the PresentX fix from #211 and the diagnostics from #484 and #602. For the patched build I adjusted the local #602 probe to read the new shared texture scratch buffer. Both runs used copies of the same profile, separate caches, and the same commit guard.The fresh control stopped at its time limit before opening the story archive. The patched run opened it, then reached the commit guard before a confirmed world frame. An earlier run of the same control binary and profile did open the story archive. Against that earlier control, private commit differed by less than 1% at archive open and at the 10- and 20-second marks after it. The sampled idle snapshot capacity stayed zero, and the cached upload peak was the same in those two runs.
This is a comparison of early loading only. It does not establish whether the patch lowers peak commit during world rendering or whether the snapshot-pool cap was exercised. Neither run logged an out-of-memory error or device removal before stopping.
AI-assisted testing and write-up (OpenAI Codex).
@AgneyaK on GitHub · 2026-11-24 16:37 UTC · original
Test report on an RTX 3050 6 GB Laptop (i7-13700H, 16 GB RAM, Windows 11 26300), diag build, title 1.0.2.1, Series X profile. Base tree:
mainffe310e+ #208 + #223 #233 #320 #439 + #452 + #579 (VICTORY_SKIP_WAVE64=mesh), from #1232. #472, #322 and #1024 merge cleanly onto it.So about 12% shorter frames, mostly copies (−36%) and copy-back (−18%). One run each, and the three were
not separated.
On this 16 GB machine much of the rest looks like paging: private bytes reach 22.9 GB and the working set is trimmed to 2-5 GB (numbers in #1232).
AI use: Claude Code (Claude Opus 5.5) merged and built the trees, ran the title on my machine and drafted this note; results are from the runs described.
@Marvisak on GitHub · 2026-11-25 00:20 UTC · original
Automated triage for the maintainers.
Needs rebase. This PR does not merge cleanly into current
main(ac2525d). Conflicting files:crates/victory-gpu/src/shadow.rs,crates/victory-gpu/src/texture.rs.The content has not been reviewed yet; it will be once the branch is rebased onto
main.Generated by Claude Code
@desplmfao on GitHub · 2026-11-25 06:21 UTC · original
Your commit here now conflicts with
main, so I opened #2153 with it brought up to date. Your commit is kept with you as author, and only the conflicts are resolved. The details are in #2153:mainhas since split the snapshot into segments, so the in-place growth part no longer applies, but the pool cap and the sharedSCRATCHcarry over unchanged.Measured in Grand Theft Auto VI's world (RTX 5080, Linux): the snapshot pool held 2,040 MB on
mainand 111–214 MB with your change, with no change in frame time. If you rebase this PR yourself, I'll close #2153.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.