VICTORY_WAIT_RESIDENT's synchronous MakeResident costs 40-80 s in a few minutes of play on an 8 GB NVIDIA card (single waits up to 205 ms) #371
Labels
No labels
accessibility
already-solved
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
merged
needs-decision
needs-game-run
needs-rebase
not-merged
nvidia
obsolete
question
security
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/avatarmanz--VIctory-7900XTX#371
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@Jesper-Andersson on GitHub · 2026-11-26 19:45 UTC · original
VICTORY_WAIT_RESIDENT(on by default since0322b39) makes every new heap or resource wait for a synchronousMakeResidenton the thread that made it. On an 8 GB NVIDIA card that wait adds up to 40-80 s in a few minutes of play, with single waits up to 205 ms.Where
crates/victory-gpu/src/host.rs:341-348atc9c932c:Why it matters
The switch's own log line, RTX 2070 SUPER 8 GB, Ryzen 7 5800X, 32 GB, driver 621.14:
c9c932c, Series Xc9c932c+ open PRs, Series S, DLSSFrames there take 355-430 ms with the card about half idle (see the hardware report #370). These waits are summed over all threads, so not all of them sit on the frame's critical path. Waits of up to 200 ms on whatever thread makes memory are a likely part of the long frames (p90 460-930 ms). On this card the budget is tight: 6.5 GB, 5.5 GB in use, "passes that made none for lack of room: 992".
The wait guards against real device losses (the comment on
wait_resident, run n08 on 2026-11-25), so it shouldn't simply be turned off.Suggestion
ID3D12Device3::EnqueueMakeResidentwith a fence, and a GPU-side wait (ID3D12CommandQueue::Wait) on the queue whose lists name the new memory. That keeps the guarantee (no list runs before the mapping) without a CPU wait. The tree already does this inindirect.rs:1953.Not checked
Only the counters and the source above. I have not timed which thread these waits fall on, or how much of them is on the path to Present. A
VICTORY_TIMELINEcapture would show that, and I will add it. I have not triedVICTORY_WAIT_RESIDENT=0here, because of the device losses it guards against.AI use
AI-assisted (Claude Code): log reading and source reading. Runs played by me; no game files attached.
@Jesper-Andersson on GitHub · 2026-11-26 20:25 UTC · original
Most of these waits have a known cause now, see #367 (same PC, runs B and D are the ones above):
shadow::exact's own-bytes copies: about 330 shared buffers a frame, made under one lock, each made resident and mapped (the cause #221 describes).So for this issue, what is left is the other 9-15 % of the callers. Moving
MakeResidentoff the CPU (EnqueueMakeResidentplus a queue wait) still applies to them, but it matters much less once the pool is in.@Jesper-Andersson on GitHub · 2026-11-26 21:24 UTC · original
Building on the comment above: what is left with the own-bytes pool in, from an ordinary build on the same PC.
testatb9b32e4(main with open PRs, the pool from #221, card buffers of 64 KiB to 1024 MB).The median frame: with the card 98 % busy, the remaining waits no longer set it on this PC.
They are still not small: about 6 s a minute summed over threads, with single waits up to 592 ms. Waits that long on a thread the title needs would show as hitches.
The timeline can't say which ones those are.
host::resident()andmapped()have no timeline span of their own, so their waits show up only as anonymous kernel waits.A useful next step:
timeline::span("new memory: resident")inresident(), and one inmapped();That would show whether the 592 ms waits sit on the path to a Present, and from which kind of memory (textures, upload or card buffers).
AI use: log reading and write-up with AI assistance (Claude Code). The runs are my own.