Textures: slot eviction lets the table go before it touches a slot (lock ring, watchdog) #1969
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!1969
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1969/head"
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?
@joeypercia on GitHub · 2026-11-29 04:51 UTC · original
joeypercia:resource-slot-evict-without-table→main· +19 −4 · 1 files · 1 commits · closed without mergingPart of #1900 and #1936 (stalls that end in the +0x23cf683 watchdog); it fixes one cause of them, which may not be their only one.
What it changes
Slot eviction (
slot_evictinresource.rs, which the submitting thread'ssweepreaches throughlet_go_idle) held the texture tableTEXTURESfrom picking its candidates to the end of the call. Under that lock it emptied their view slots (evict_slots→HostHeap::texture_slot_evicted), each under the slot'sMadelock. Two other paths take the same locks in the other order, and the three together form a ring:sweep→let_go_idle→slot_evict→evict_slots→texture_slot_evictedTEXTURESMadelockvictory-views-*,victory-aside):HostHeap::mirror_inner→begun_before→placed_texture→texture_atMadelockPLACED_TEXTUREStexture_at→create_at_address→hand_out_resource(textures().insert)PLACED_TEXTURESTEXTURESOnce the three meet, nothing presents again, and 30 s later the title's watchdog writes to 0 (
+0x23cf683).Now the candidates are still picked under
TEXTURES, but each one is pinned withobject::add_ref_aliveandHeld, the wayalias_ofkeeps a texture alive. One already being released is skipped. The table is then let go before any slot is touched. The slots are emptied and the host copies let go with only their own locks held. The pins are let go at the end, with no lock held, so a last reference can takeTEXTURESagain. What gets evicted, and when, doesn't change.How it was tested
main568c5e5, one run stalled 150 s in; frames had already reached 7.7–8.9 s before it. Thread stacks taken withcdb21 s into the stall show the three threads in the table above, in those frames: fivevictory-records, twovictory-views,victory-aside, the list threads and a resource release waiting behind them. The run then ended with the watchdog (0xc0000005at+0x23cf683).mainrun under the same conditions entered the world and ran 4 min without it, so a handful of short runs can't show the fix working. The reason for the change is the stacks and the lock order read in the code, not a measured before/after rate. With this change the ring can't close: the submitting thread no longer waits for aMadelock while holdingTEXTURES.cargo testpassed for the crates it touches: yes,cargo test --locked -p victory-gpuon098400f: 589 passed, 0 failed, 44 ignored.Not tested: a long session or many runs with the change (to see the stalls stop), AMD, and 8 GB cards, where slot eviction runs much more often (#1644).
Checked for overlap
texture_slot_evicted,mirror_inner,PLACED_TEXTURESandhand_out_resourcefound no PR or report of this ring. Related: #1644 (the cost ofslot_evicton 8 GB cards) and #1763 (slot eviction on 8 GB), which change what is evicted, not the locks.Written with Claude Code (Claude Opus 5.5): it took the stacks, traced the lock ring through the code, wrote the change and this description, and ran the tests above.
@joeypercia on GitHub · 2026-11-29 04:52 UTC · original
Closing as a duplicate: #1763 already lets the texture table go before
evict_slots, which breaks the lock ring described above. The stacks and the lock order are now on #1763. (Claude Code, Claude Opus 5.5.)Pull request closed