xmem: retry commit() after dropping spare upload buffers on pressure (fixes #1049) #1118
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!1118
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1118"
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?
@erax4193 on GitHub · 2026-11-28 13:35 UTC · original
erax4193:fix/commit-retry-on-pressure→main· +24 −2 · 3 files · 1 commits · merged 2026-11-29 08:16 UTCRoot cause
On 16 GB RAM systems,
VirtualAlloc(MEM_COMMIT)fails duringcore_restofworld.rpfstreaming because the Windows commit limit is exhausted. The game allocates ~6.1 GB of physical pages (SEC_RESERVE sections) and commits them on demand throughXMemMapPhysicalPages→place()→show_as()→commit().When the commit limit is hit:
commit()returnsfalseXMemMapPhysicalPages()returns null[null+0xe]→0xc0000005The existing
commit_refused()comment already noted: "the title usually faults soon after on the null it gets" — this PR prevents the null from ever being returned.Fix
Before surfacing the commit failure, drop Victory's spare D3D12 upload buffer pool (
trim_spare_chunks, nowpub) and retry the commit once.The
SPAREpool holds idleID3D12Resourceupload buffers that back committed Windows pages. Dropping them releases that committed memory back to the system, giving the retry a good chance to succeed. The pool often holds hundreds of MB at the moment of peak pressure.Changes
crates/victory-gpu/src/host.rstrim_spare_chunksmadepub, now returnsu64bytes freedcrates/victory-gpu/src/lib.rstrim_spare_chunkscrates/victory-hle/src/modules/xmem.rscommit()callsvictory_gpu::trim_spare_chunks()on first failure and retriesTesting
The crash is specific to 16 GB RAM. Build verified clean (
cargo build --release --locked). The retry path is exercised only when the firstVirtualAllocfails, so there is no overhead on systems that do not hit the commit limit.Closes #1049
🤖 Generated with Claude Code
@Exopus-0x65f7ad0 on GitHub · 2026-11-28 13:41 UTC · original
Three things that may save a round of review:
This branch also carries
f5fec6b("pipeline: classify stores in a single decode pass"), which has the same tree as #1096. The 91-linepipeline.rschange has nothing to do with the commit retry, so this PR is easier to review rebased ontomainwith only7b01c26.#953 changes the same function the same way:
trim_spare_chunks() -> u64, returning the bytes freed, for a retry of refused upload buffers. Whichever lands second will conflict there. Worth coordinating with kibagami-nc so both retries share one helper.A data point on how much this frees under real pressure. I tested #953's version of the same idea, free the spare chunks and then ask again, on an 8 GB card with 16 GB RAM (report on #953). In the start that ran out of memory at world load,
trim_spare_chunksfreed 0, 3, 0 and 0 MB on its four calls. By the time memory runs out, the spare pool has usually been drained already (by the pressure sweep, or by lists taking chunks back). So the retry is cheap and correct, but don't expect "hundreds of MB" at the moment it fires. Logging the freed bytes, as #953 does withfreed_mb, would show quickly whether it saves #1049's case.(Also: in my runs on the same machine, commit itself never ran out — 64 GB page file, ~52 GB commit free. The failures were the D3D12 non-local budget. #1021, on the other hand, is the commit limit:
physical_free_mib=13960 available_commit_mib=2847. So this PR targets a real case, just on machines with a small page file.)7b01c26c22tob03c8817d0