8 GB cards: sweep() takes 28-79 ms every second on the submitting thread (slot_evict walks) #1644
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#1644
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?
@icdmkg2 on GitHub · 2026-11-28 22:56 UTC · original
On an 8 GB card,
sweep()(host.rs) takes 28–79 ms every second on the submitting thread, the thread every frame waits for. It runs "once a second, before a submission starts".Setup: RTX 5060 Laptop GPU (8 GB, local budget 7.1 GB), Ryzen 7 H 260, Windows 11,
mainplus the #43 revert, release build, Series S, DLSS performance, slot eviction on (VICTORY_SLOT_EVICT=1from the launcher), the prologue's cell.Measured by timing each step of
sweep(). Every sweep in 90 s of play logged over 4 ms; values in ms:resource::let_go_idle(withslot_evict)trim_spare_uploads+trim_spare_chunkspool::roomlet_go_idle's own pass over textures is only about 3 ms (its "looks for textures to let go" line). The other 25–45 ms isslot_evict. On an 8 GB card the line is always crossed, so every pass walks every texture and thendescriptor::evictable_slotswalks the heap's slots. A sampling profile of the diagnostics build hasevictable_slotsat about 4% ofvictory-submit, andhost::sweepat about 6%.What I tried, and why it isn't a PR: resting
slot_evictfor 8 s after a pass that let nothing go brought that part down to 2–5 ms most seconds. But in an alternating A/B (two runs each), frames got worse: median frame time 50–53 ms against 47 ms, and 9–10 frames over 50 ms per 5 s window against 6–7. The likely cause is that VRAM goes past its line and the driver starts paging. Freeing spare upload chunks on another thread was in the same A/B. So the passes are needed. The cost seems to come from where they run (the submitting thread) and how (whole-table walks), not from how often.Ideas that might keep the eviction and lose the stall:
There are probably constraints in
evict_slots/texture_madethat I don't know, hence an issue rather than a guess.@github-actions[bot] on GitHub · 2026-11-28 22:56 UTC · original
Please attach both logs from the run that went wrong. Without them we can only guess. Paste
%LOCALAPPDATA%into the address bar of File Explorer to get there.%LOCALAPPDATA%\victory\logs\: the newestvictory-nvidia-play-<date>-<time>-<number>.log(fromvictory.exe) orvictory-nvidia-<date>-<time>.log(from the script launcher). The window shows its path at the start, on the lineLog: ....%LOCALAPPDATA%\VIctory\data\7952987A\crashes.log, and, if there is one from that run, the newestvictory-<date>-<time>-<number>.crash.login%LOCALAPPDATA%\VIctory\data\7952987A\temp\.Also say which GPU, Windows version (10 or 11)
@kalberts0089-hash on GitHub · 2026-11-29 08:00 UTC · original · edited 2026-11-29 08:50 UTC
I can't reproduce the timings (I can't run the game here, and my card is 12 GB), but I read the code at
e1f2eb6and it fits what you measured. Notes below, plus a microbenchmark of the slot walk.Where it runs.
sweep()(crates/victory-gpu/src/host.rs:524) is called fromHostQueue::submit(host.rs:6283) at the stage"submit: the sweep"(host.rs:6389, calls at6399and6409), before the submission counts as started. WithVICTORY_ASYNC_SUBMITthat is thevictory-submitthread (queue/behind.rs:794).Why the logged number hides it.
resource::let_go_idlerecordsSWEPT_US(resource.rs:2966-2968) before it callsslot_evict(resource.rs:2972). So the "looks for textures to let go, X ms each" line (host.rs:10734-10739) only covers the texture pass.What
slot_evictwalks once the card is over its line (it returns early whenneed == 0,resource.rs:3170, and when no idle candidate is found,resource.rs:3204):textures(), takingr.host.madefor each idle candidate (resource.rs:3179-3203);descriptor::evictable_slots(descriptor.rs:1693) holds theSHADER_HEAPSread lock for the whole walk and callsHostHeap::slots_showing(descriptor/host.rs:3579) on each heap. That goes over every entry ofkeptand locks each slot's ownMutex;kepthascount + extraentries (descriptor/host.rs:2501). For a view heap,dynamic_slots_fornever makesextrasmaller thanDYNAMIC = 1 << 18(descriptor/host.rs:2296,2319-2345; on NVIDIA it is between 2^18 and 2^19). Sampler heaps get 0 (descriptor/host.rs:2413-2414). So every shader-visible view heap costs at least 262,144 mutex locks per pass;evict_slotsthen takes theSHADER_HEAPSread lock again and does a linearheaps.iter().any(..)for every slot in each victim's list (descriptor.rs:1757-1762).The dynamic tail isn't wasted work. A dynamic slot that shows a candidate puts it in
blocked/other(descriptor.rs:1723-1728), and that keeps the texture (descriptor.rs:1739-1741). Soslots_showingcan't just stop atcountunless that information comes from somewhere else.Heap creation (
descriptor.rs:2189) andDrop for Heap(descriptor.rs:989) takeSHADER_HEAPS.write(), so a thread making or dropping a heap waits for the whole walk in step 2. I haven't checked whether that happens during play.Microbenchmark. This is a standalone release-build model of
slots_showing: aMutex<Option<_>>per slot, read the pointer, look it up in aHashSetof candidates. i7-13700KF, uncontended, warm caches, best of 20:That's about 9 ns per slot, linear in the total slot count across heaps. At that rate 25-45 ms would mean roughly 3-5M slots in total. The other possibility is that the per-slot cost is much higher in the game (cold caches, slot mutexes shared with the recording threads, a slower laptop CPU). I haven't measured which. Two cheap things would settle it: log the total
kept.len()acrossSHADER_HEAPS, and timeevictable_slotson its own.Counters nobody reads.
SLOT_EVICT(resource.rs:3017) andSLOT_STATE(resource.rs:3026) are only written (fetch_add/store). Nothing in the repo loads them, so a play log can't show evictions (SLOT_EVICT[0]), slots reset ([2]), bad victims ([4]) or give-ups ([6]). (sampled::COLDis logged, but only withVICTORY_SAMPLED_MARKS=1,sampled.rs:203-219.) If those two were logged next to theSWEPT_USline, with a separate timer aroundslot_evict, 8 GB logs would show this without a custom build.Minor: the doc comment at
resource.rs:3035still saysVICTORY_SLOT_EVICT=1is "off by default". Since63b902fthe launcher sets it (apps/victory/src/play.rs:123,scripts/play-foxhound.ps1:112). That commit is in both main and v2026.11.28.03.cargo test --locked -p victory-gpu --lib slot_passes (7 tests), but nothing there measures the cost of the walk.Your first idea fits the code. A per-heap index from texture raw to the slots showing it, kept up to date where
keptis written, would replace step 2 with lookups for the candidates only. It would have to carry the title/dynamic/indexed distinction soblockedandotherstill come out the same.Update: the counters part is out of date. Current
main(since49cec75b, which brought in0b6f6a5d, "Slot eviction: what it did is in the frame-rate lines") logs aslot eviction since the last linesummary with the once-a-second frame-rate lines whenever eviction did something, so a normal play log onmainnow shows evictions and textures that came back. What it still doesn't show isslot_evict's own time:SWEPT_USis still recorded beforeslot_evictruns.@icdmkg2 on GitHub · 2026-11-29 08:07 UTC · original
@kalberts0089-hash, thanks, that reading was spot on. I measured both things you named in the game, on the same laptop (RTX 5060 Laptop 8 GB, Ryzen 7 H 260, Windows 11),
mainate1f2eb6plus a throwaway probe inslot_evict. Release build, Series S, DLSS performance, the prologue's cell, about 85 s of play: 84 passes, one a second.evictable_slotsevictable_slotstextures()loop)evictable_slotsSo it's about a million slots at about twice the uncontended cost per slot, plus a texture scan nearly as long as the slot walk. The scan takes
r.host.madefor tens of thousands of idle candidates each second.What it buys: almost nothing here. Over the 84 passes, slot eviction let go of 10 textures in total (6 → 16 since the start; slots reset 13 → 32, made again 1, bad victims 0, given up 0). Nearly every pass finds 30–44k candidates and lets go of 0–1, because almost all of them come back
blocked(a slot shows them). So the submitting thread spends about 34 ms a second to free about one texture every eight seconds, and the card stays over its line.That points to the index you and I both suggested (texture → slots showing it, kept up to date where
keptis written): the per-second cost would scale with candidates, not with a million slots. And the scan could skip textures already known to be blocked until something changes their slots, instead of re-takingmadefor all of them every second. From my earlier A/B, it isn't the eviction itself that should be cut: slowing it down filled VRAM and made frames worse.The probe is two
AtomicU64s inevictable_slotsand oneinfo!line per pass inslot_evict. I can turn it into a proper log line next to theSWEPT_USone, withSLOT_EVICT/SLOT_STATEread out, as you suggested, if that's wanted in a PR.@kodifan on GitHub · 2026-11-29 12:45 UTC · original
Independent data on a 16 GB card with v2026.11.29.01 — and it shows the sweep has a second cost
after slot eviction is turned off.
Machine: RTX 5060 Ti 16 GB, Ryzen 7 7700, 32 GB DDR5-6000, Windows 11 26200, driver 621.24.
Series S and Series X, DLSS Performance, frame generation 2X, texture room 70,
THIN=0,ASYNC_SUBMIT=1, quiet logging (VICTORY_LOG=warn,victory_gpu::frame_times=info),VICTORY_PROCESS_MEMORY=0. Frame times fromVICTORY_BENCH_CSV(one row per frame: elapsed, ms,draws), first 60 s dropped.
Series S (1280x720 scene -> 1920x1080 out, 3–4k draws):
VICTORY_SLOT_EVICT=1(default)VICTORY_SLOT_EVICT=0Series X (1280x720 scene -> 2560x1440 out, 8–16k draws),
VICTORY_SLOT_EVICT=0:So on a 16 GB card
SLOT_EVICT=0fixes the low-draw case but not the high-draw one: the 1 s pass isstill there, and its cost grows with the texture table / draw count (your 14.5 ms at 55–74k textures
becomes 160–373 ms here at 15k draws). That points at the sweep's texture scan as the remaining cost
after slot eviction is off — so moving the whole sweep off the submitting thread, or making its
texture pass incremental, looks like the fix rather than only resting
slot_evict.Happy to run a specific A/B on request (Series X,
SLOT_EVICT=1vs0, same save, per-frame CSV).@Machad3x on GitHub · 2026-11-29 12:46 UTC · original
Same symptom on a 12 GB card (RTX 3080 Ti, 1080-to-1440, Series X,
main829188e9, diagnostics build, ~5 min from boot into the prologue, card over its line: VRAM 10.2 to 11.3 GB). I timed each step ofsweep()and logged any step over 2 ms (about 290 sweeps):resource::let_go_idletrim_spare_uploads,trim_spare_chunks,trim_read_backs,send::trim)pool::roomSo
let_go_idleaverages about 62 ms in 209 of ~290 sweeps. The timeline recorder (VICTORY_TIMELINE) agrees: one sweep of 59.75 ms inside a 62 ms frame (submit: the sweepwas the largest item of that frame, 19.9 ms averaged over the 3 recorded frames). The log line says:sweeps with a limit since the start (card over its line): 198, asked to let go 206432 MB, let go 4623 MB, 12024890 old enough copies looked at, about 60k copies looked at per sweep for 2% of the bytes asked.Not a fix: I did not change the sweep, since the A/B in this issue shows resting the pass makes frames worse. It does mean the 8 GB framing is not needed to hit it; any card whose line is crossed pays it. #2075's per-second cost line would make this visible without a custom build.
@Machad3x on GitHub · 2026-11-29 12:53 UTC · original
A/B on the same 12 GB card and scene (about 5 min from boot into the prologue, card over its line,
victory play, 1080-to-1440), onlyVICTORY_SLOT_EVICTchanged:VICTORY_SLOT_EVICT=0let_go_idleper sweepIn the
onrun the eviction let go 0 textures (0 MB) all the way (textures let go with their slots under pressure ... since the start: 0 textures) while looking at 46-52k idle-looking textures each second. So on this card the slot walk costs about 28 ms per sweep and returns nothing. It is one run each, with a slightly different scene mix (3800 vs 3365 draws/frame median), so treat the frame numbers as indicative; thelet_go_idlestep times are the solid part. The remaining 34 ms with eviction off is the other loop inlet_go_idle(about 60k copies looked at per sweep, 12 M over 198 limited sweeps). Both stay on the submitting thread.@HailLucifer666 on GitHub · 2026-11-29 18:36 UTC · original
Opened #2720 (rebased on \2026.11.29.01/\
github-bot referenced this issue2026-11-30 05:57:22 +00:00
@Yoruiopz on GitHub · 2026-11-30 07:26 UTC · original · edited 2026-11-30 07:37 UTC
Independent reproduction on an RTX 5070 Laptop GPU (8 GB), Core Ultra 9 275HX, 64 GB RAM, Windows 11. I ran a diagnostics build from
41adb551with the Series X 1080p startup change in #3774 and submit-sweep timers. Series X at 1920×1080 output, DLSS Performance, 2× DLSS FG, and a 15 rendered FPS cap. Slot eviction remained enabled. This is the control run with idle-sweep slicing disabled.The measured late window had a 66.62 ms median and a 100.06 ms p95 rendered interval. I aligned the present CSV to cumulative frame-log intervals before pairing the sweep timestamps. The largest alignment residual was 0.027 ms.
The last sweep saw 26,157 idle candidates, all blocked by indexed slots. It recorded zero texture evictions and zero descriptor resets over the run. Local VRAM was around 6.6 GB against a roughly 7.0 GB WDDM budget in the heavy window. This supports the diagnosis that the lookup itself is expensive on a second 8 GB mobile GPU. The smaller streamed-out scan and ordinary texture reclaim timings leave room for improvement, but the descriptor scan is the largest measured cost here. #2720 and #3750 target that cost in different ways. These numbers establish the baseline for testing those changes.
A second run with finer instrumentation counted 38 eviction passes in the 90–130 s window. Each walked 1,000,127 slots across two heaps. The median pass matched 25,432 slots and found zero eligible textures, zero resets, and zero evictions. Median times were 3.33 ms to enumerate texture candidates, 16.53 ms inside
HostHeap::slots_showing, 5.98 ms for the remainder of descriptor matching, and 0.61 ms for selection/accounting/apply. The scan dominates here, and the remaining descriptor cost is large enough to measure separately.@trustno1-coder on GitHub · 2026-11-30 15:41 UTC · original
Closing this because it was opened before v2026.11.29.01, and a great deal has changed since then. The latest release is v2026.11.30.01.
If this still happens, or still applies, on the latest release, please open a new issue. For a bug, attach both logs from that run:
victory-nvidia-play-<date>-<time>-<number>.login%LOCALAPPDATA%\victory\logs\.%LOCALAPPDATA%\VIctory\data\7952987A\crashes.log, plus the newest.crash.login%LOCALAPPDATA%\VIctory\data\7952987A\temp\if there is one from that run.