Repository navigation
Conversation
The snapshot `Shadow::writing` keeps, to tell later what a submission's shaders wrote, is grown to span every range the submission declares. Growing it allocated a second buffer of the new size, copied the old one in, and only then returned it to the pool: at the largest growth that holds twice the buffer, and the world's heap is 174 MB, so the peak doubles right where commit is already tight. Grow the old buffer in place instead (`reserve_exact` for exactly the growth, then extend on either side). The pool that feeds the snapshot kept its eight largest buffers whatever their size, so after the world had grown once it could hold eight 174 MB buffers, about 1.4 GB idle. Keep the largest (its reuse is what saves the millions of page faults the 64 KiB pages were chosen for) and further buffers only up to 256 MiB. Measured on a 16 GB machine, world load, release build: the process reached 18.0 GB private and died at `memory allocation of 70426816 bytes failed` with the system commit at 48.8 GB of a 49.0 GB limit. It is not a fix for that limit, and not comparable to earlier runs (those measured the page file, not `PrivateMemorySize64`) — the counters to compare it against do not exist yet. Refs Marvisak#407: this is bridge work, which that issue proposes to delete. It stays valid until stage 2 there (xmem asks a GPU-visible arena first) replaces the copies.
catminou4
left a comment
There was a problem hiding this comment.
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
Idle snapshot pool memory capped (#472 rebased, 2 GB RAM) — memory-cap fix for long sessions; mixed gpu+hle, Windows-only.
|
Independent Windows x64 CPU-only probe on parent
|
Adapt the snapshot-pool part of Marvisak#2153 (also Marvisak#472). Do not import the unrelated texture or storage changes. Cap total idle capacity including the largest buffer, preserve the best-fitting allocation path, and limit idle entries to eight. Active snapshot correctness is unchanged. Portable pool regression and Windows all-feature workspace test source checks passed. Co-authored-by: Davi Andrei <67552001+SaymonMaster14@users.noreply.github.com>
… fails A pool miss allocated with Vec::with_capacity, which aborts the process when the allocation fails, even while the pool still holds idle buffers (too small to fit, but up to POOL_BYTES plus the largest one). Try the allocation with try_reserve_exact first; when it fails and the pool is not empty, drop the idle buffers and make one last attempt with reserve_exact, which aborts as before if that fails too. Pool hits and successful misses are unchanged. Idea from fxceless/victory-fork#360. Co-Authored-By: avt0m4t48 <56218626+avt0m4t48@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Added |
|
@yualk thanks for the independent probe. That matches the intent: the largest idle buffer is always kept, and others only up to 256 MiB more, so |
|
Automated triage for the maintainers. Merge candidate. Thanks for What's left, all of which I checked:
The measured effect: the idle pool goes from 2,040 MB to 111–214 MB, with world frame time unchanged (428–452 ms against 442–451 ms). The CPU-only probe in the thread shows the refill cost of the smaller buffers. CI For the maintainers: this is #472 (by @SaymonMaster14) brought up to date, with credit. #472 does not merge, so whichever lands, the other should be closed. Generated by Claude Code |
The pool cap doesn't need it, and counting a zlib-then-BCPack request's intermediate buffer against the staging budget changes when the title's reads start, without evidence that the console counts it. As asked in the triage, it goes from this PR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the triage. Done in |
This is #472 by @SaymonMaster14, brought up to date with
main. Their commit is kept as is, with them as author, and only the conflicts are resolved. #472 conflicts withmain, and I didn't want to push to someone else's branch. If #472 gets rebased, close this one.What it does (from #472)
shadow.rs,give_back: the idle snapshot pool kept the largest buffers up to 2 GiB (POOL_BYTES = 2 << 30onmain). Now it always keeps the largest buffer, whose reuse saves the page faults, and keeps others only up to 256 MiB, 8 at most.texture.rs: everyStagingkept aVecthe size of its whole texture for good. One shared, already-touchedSCRATCHbuffer replaces them.dstorage.rs: the intermediate buffer of zlib-then-BCPack requests (merged without conflict).Conflict resolution
give_back: GPU: grow the write snapshot in place, and cap idle pool memory #472's version, andmain's separate 2 GiBPOOL_BYTESis removed.Shadow::writing:main's version. Since GPU: grow the write snapshot in place, and cap idle pool memory #472 was written,mainchanged the snapshot to several segments, merged on growth (c75fdba), so GPU: grow the write snapshot in place, and cap idle pool memory #472's in-place growth of the single snapshot no longer applies. The extra peak that GPU: grow the write snapshot in place, and cap idle pool memory #472 described during a growth may still exist in the segment merge. I didn't change that here.texture.rsLast:main's fields minus the per-texturereadbuffer, whichSCRATCHreplaces.Measured
Grand Theft Auto VI (Series X 1.0.2.1) in the world, RTX 5080, Linux, proton-cachyos 11.0. Live allocations of 1 MiB or more by call site, from a counting global allocator (diagnostics, not part of this PR):
mainShadow::writingsnapshots (pool + live)Staging::refreshbuffersThe frame time is within run-to-run noise, so I can't see a slowdown from the smaller pool.
Recommended with it: #2099
Once the pool was capped, VIctory's heap still grew about 200 MB every 30 s in the world. That growth is the descriptor view table, which #2099 (@0xkn0wh3r3) fixes. It merges cleanly with this PR. With both (and #2151), VIctory's own heap stayed flat at about 1.4 GB in the world, against about 4.2 GB and growing before.
Tested
cargo clippy -p victory-gpu -p victory-hle --all-targets -- -D warnings: clean.victory-gputests on the RTX 5080 under Proton: 129 passed, 13 failed, the same 13 asmainon this setup.AI-assisted (Claude Code).
🤖 Generated with Claude Code