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

Merged
Amar-D3V merged 1 commit from upstream-pr/1557 into main 2026-11-29 08:16:55 +00:00
Amar-D3V commented 2026-11-28 21:43:30 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Amar-D3V on 2026-11-28T21:43:30Z.


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).
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5544855350 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1557). Originally posted by [Amar-D3V](https://github.com/Amar-D3V) on 2026-11-28T21:43:30Z. --- 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).
Sign in to join this conversation.
No reviewers
No labels
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.

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