Slot eviction: a slot another thread is making is not waited for (a freeze with the sampled marks) #1557

Manually merged
github merged 1 commit from github-bot/gh-1557 into main 2026-11-29 08:21:53 +00:00 AGit
Owner

@⁠Amar-D3V on GitHub · 2026-11-28 21:43 UTC · original
Amar-D3V:fix/slot-evict-deadlock → main · +39 −12 · 3 files · 1 commits · merged 2026-11-29 08:16 UTC

Related: #846 (one way to get its stall and the watchdog crash), #1425, #807

What it changes

Slot eviction (resource::slot_evict) holds the table of textures (textures()) while it puts each slot back to null, and texture_slot_evicted waited for the slot's lock. A thread making a slot takes the same locks the other way round, the table last: mirror_inner holds the slot's lock, then begun_before → texture_at (PLACED_TEXTURES) → create_at_address → hand_out_resource (textures()). So the two can wait for each other forever:

victory-submit:   holds textures()          -> waits for a slot's lock  (evict_slots -> texture_slot_evicted)
victory-views-1:  holds that slot's lock     -> waits for textures()     (mirror_inner ... hand_out_resource)
                  and PLACED_TEXTURES
victory-list-* (8), victory-views-2/3: wait behind them (texture_at, mirror_inner)

That is the stack dump (VICTORY_STACKS, symbolized with the diag build's PDB) taken 25 s into a freeze. About 30 s after the frames stopped, the title's own hang watchdog ended the process with the write to 0 at +0x23cf683 that #846 describes.

The slot's lock is now only tried there (Made::try_lock). A slot that another thread is making at that moment is in use, so it is not one to let go: evict_slots reports it, and slot_evict keeps that texture's host copy and goes through its existing "used meanwhile" branch, which makes the slots it already put back again before the next submission.

It is rare without the sampled marks, because eviction then takes few slots. With VICTORY_SAMPLED_MARKS=1 VICTORY_SAMPLED_EVICT=1 it takes many (82,972 slots in nine minutes here), and it froze in both runs with them.

How it was tested

  • GPU and profile: RTX 5070 Ti 16 GB, Ryzen 7 9800X3D, Windows 11 26300, driver 621.40. Series X, 2560x1440, DLSS Quality and without DLSS, frame generation off; Series S with DLSS frame generation 3x. No ray tracing. Diagnostics and release builds.
  • Before: with both sampled switches on, the game froze about three minutes into a drive in both runs (4 and 3 minutes). The second freeze's dump is the one above.
  • After: three starts with both switches on. A 9-minute diagnostics run and a 4.5-minute release run (after its warm-up restart), both with drives through the same area, did not freeze. In the 9-minute run eviction put 82,972 slots back to null and 38,763 of them were queued again as a shader read them.
  • One more release start stalled while loading, on the first start of a new build with about 2,200 pipelines still being made: no present for 32 s, then the watchdog crash. That was #846's other pattern, not this one: the last line before it was "a queue still stood at a wait at a present", and eviction had taken nothing ("of 0 textures"). The next start of the same build loaded normally.
  • For shader changes: none.
  • cargo test -p victory-gpu passed (550 passed, 43 ignored). Clippy reports nothing in the changed lines; main's own findings elsewhere are unchanged.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #1425 (moves the marks' buffer, not the eviction's locking), #807 (already adds VICTORY_SAMPLED_MARKS to the shader cache key, which this needed too, so it is not repeated here), #972 and #943 (eviction's log lines).
**@⁠Amar-D3V** on GitHub · 2026-11-28 21:43 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1557) `Amar-D3V:fix/slot-evict-deadlock` → `main` · +39 −12 · 3 files · 1 commits · merged 2026-11-29 08:16 UTC Related: #846 (one way to get its stall and the watchdog crash), #1425, #807 ## What it changes Slot eviction (`resource::slot_evict`) holds the table of textures (`textures()`) while it puts each slot back to null, and `texture_slot_evicted` waited for the slot's lock. A thread making a slot takes the same locks the other way round, the table last: `mirror_inner` holds the slot's lock, then `begun_before` → `texture_at` (`PLACED_TEXTURES`) → `create_at_address` → `hand_out_resource` (`textures()`). So the two can wait for each other forever: ``` victory-submit: holds textures() -> waits for a slot's lock (evict_slots -> texture_slot_evicted) victory-views-1: holds that slot's lock -> waits for textures() (mirror_inner ... hand_out_resource) and PLACED_TEXTURES victory-list-* (8), victory-views-2/3: wait behind them (texture_at, mirror_inner) ``` That is the stack dump (`VICTORY_STACKS`, symbolized with the diag build's PDB) taken 25 s into a freeze. About 30 s after the frames stopped, the title's own hang watchdog ended the process with the write to 0 at `+0x23cf683` that #846 describes. The slot's lock is now only tried there (`Made::try_lock`). A slot that another thread is making at that moment is in use, so it is not one to let go: `evict_slots` reports it, and `slot_evict` keeps that texture's host copy and goes through its existing "used meanwhile" branch, which makes the slots it already put back again before the next submission. It is rare without the sampled marks, because eviction then takes few slots. With `VICTORY_SAMPLED_MARKS=1 VICTORY_SAMPLED_EVICT=1` it takes many (82,972 slots in nine minutes here), and it froze in both runs with them. ## How it was tested - GPU and profile: RTX 5070 Ti 16 GB, Ryzen 7 9800X3D, Windows 11 26300, driver 621.40. Series X, 2560x1440, DLSS Quality and without DLSS, frame generation off; Series S with DLSS frame generation 3x. No ray tracing. Diagnostics and release builds. - Before: with both sampled switches on, the game froze about three minutes into a drive in both runs (4 and 3 minutes). The second freeze's dump is the one above. - After: three starts with both switches on. A 9-minute diagnostics run and a 4.5-minute release run (after its warm-up restart), both with drives through the same area, did not freeze. In the 9-minute run eviction put 82,972 slots back to null and 38,763 of them were queued again as a shader read them. - One more release start stalled while loading, on the first start of a new build with about 2,200 pipelines still being made: no present for 32 s, then the watchdog crash. That was #846's other pattern, not this one: the last line before it was "a queue still stood at a wait at a present", and eviction had taken nothing ("of 0 textures"). The next start of the same build loaded normally. - For shader changes: none. - `cargo test -p victory-gpu` passed (550 passed, 43 ignored). Clippy reports nothing in the changed lines; `main`'s own findings elsewhere are unchanged. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #1425 (moves the marks' buffer, not the eviction's locking), #807 (already adds `VICTORY_SAMPLED_MARKS` to the shader cache key, which this needed too, so it is not repeated here), #972 and #943 (eviction's log lines).
Slot eviction (`resource::slot_evict`) holds the table of textures and took
each slot's lock in `texture_slot_evicted`; a thread making a slot takes that
table under the slot's lock (`mirror_inner` -> `begun_before` -> `texture_at`
-> `hand_out_resource`). With VICTORY_SAMPLED_MARKS=1 and
VICTORY_SAMPLED_EVICT=1 an RTX 5070 Ti froze in a drive three minutes in,
twice; the stacks of the second had victory-submit waiting in
texture_slot_evicted and victory-views-1 in hand_out_resource, with the list
and other view threads behind them. About 30 s later the title's own hang
watchdog ended the process (the crash at +0x23cf683 of #846).

The slot's lock is now only tried: a slot being made is in use, so its
texture stays, and the slots already put back are made again as for one used
meanwhile.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 21:48:35 +00:00
github manually merged commit c2135dc575 into main 2026-11-29 08:21:53 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!1557
No description provided.