Slot eviction: hang probe and stack dump, compute protection, opt-in guards, memory by holder #2372

Open
github-bot wants to merge 1 commit from github-bot/gh-2372 into main AGit
Owner

@⁠Ahadfahim on GitHub · 2026-11-29 12:28 UTC · original
Ahadfahim:fix/slot-evict-deadlock → main · +680 −22 · 13 files · 1 commits · open

What this adds

Tools and guards built while chasing the Unsignaled CrossQueueBarrier crash with VICTORY_SAMPLED_MARKS=1 + VICTORY_SAMPLED_EVICT=1 (RTX 5080, 16 GB). The crash turned out to be the same slot-lock / texture-table inversion that cf338eab already fixes, so this keeps that fix as it is and adds what helped find it.

  • Hang probe (queue/behind.rs; VICTORY_HANG_PROBE=0 turns it off): after 3 s without a presented frame it logs each queue's front (fence/value wait and whether met, submission, signal, present), every fence wait and signal in the line, and the submission counts. It repeats every 5 s (at most 6 times) and logs when frames come back.

  • Hang dump (new hangdump.rs; VICTORY_HANG_DUMP=0 turns it off): on the probe's 1st and 3rd look it writes every thread's named stack to %LOCALAPPDATA%\victory\logs\hang-<unix>-<pid>.txt. Each thread is suspended in turn, unwound with no allocation, then resumed. This is what showed the ABBA (submit thread: table → slot lock; list thread: slot lock → table).

  • Compute protection: compute programs mark the slots they read in the upper half of the marks buffer (SAMPLED_COMPUTE), and those textures are never evictable. VICTORY_SAMPLED_PROTECT=nonpixel extends this to every non-pixel stage. The setting is keyed in the shader cache.

  • Slot eviction guards, all off by default:

    • VICTORY_SLOT_EVICT_IDLE_MS: 60000 cut "made again" from about 50% to 2–20% here.
    • VICTORY_SLOT_EVICT_MAX
    • VICTORY_SLOT_EVICT_MIN_FPS

    F8 and F7 flushes bypass them.

  • Every 10 s: a "slot eviction since the start" line and a "card memory by holder (MiB)" line. The holder line covers texture blocks with their free and widest-free space, buffer copies split into copies / windows / arenas / mapped, staging blocks, targets and the rest. It's how a texture pool with 2 GB free but only 29 MiB widest free was spotted.

  • play-foxhound.ps1: optional -Victory <exe> and -SettingsFile <file> to run a saved build with its own settings. Both are carried through F1 restarts.

Testing

  • cargo test -p victory-gpu --lib: 916 passed. cargo test -p victory-shader --lib: 462 passed.
  • The features were played for several hours on a 568c5e5 base: 13 minutes with eviction active and no freeze after the lock fix, and compute protection running through 11+ minutes of eviction.
  • Not yet played on this exact base (current main). The merge with 739f8339 / cf338eab was done by hand.

🤖 Generated with Claude Code

**@⁠Ahadfahim** on GitHub · 2026-11-29 12:28 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2372) `Ahadfahim:fix/slot-evict-deadlock` → `main` · +680 −22 · 13 files · 1 commits · open ## What this adds Tools and guards built while chasing the `Unsignaled CrossQueueBarrier` crash with `VICTORY_SAMPLED_MARKS=1` + `VICTORY_SAMPLED_EVICT=1` (RTX 5080, 16 GB). The crash turned out to be the same slot-lock / texture-table inversion that cf338eab already fixes, so this keeps that fix as it is and adds what helped find it. - **Hang probe** (`queue/behind.rs`; `VICTORY_HANG_PROBE=0` turns it off): after 3 s without a presented frame it logs each queue's front (fence/value wait and whether met, submission, signal, present), every fence wait and signal in the line, and the submission counts. It repeats every 5 s (at most 6 times) and logs when frames come back. - **Hang dump** (new `hangdump.rs`; `VICTORY_HANG_DUMP=0` turns it off): on the probe's 1st and 3rd look it writes every thread's named stack to `%LOCALAPPDATA%\victory\logs\hang-<unix>-<pid>.txt`. Each thread is suspended in turn, unwound with no allocation, then resumed. This is what showed the ABBA (submit thread: table → slot lock; list thread: slot lock → table). - **Compute protection**: compute programs mark the slots they read in the upper half of the marks buffer (`SAMPLED_COMPUTE`), and those textures are never evictable. `VICTORY_SAMPLED_PROTECT=nonpixel` extends this to every non-pixel stage. The setting is keyed in the shader cache. - **Slot eviction guards, all off by default**: - `VICTORY_SLOT_EVICT_IDLE_MS`: 60000 cut "made again" from about 50% to 2–20% here. - `VICTORY_SLOT_EVICT_MAX` - `VICTORY_SLOT_EVICT_MIN_FPS` F8 and F7 flushes bypass them. - **Every 10 s**: a "slot eviction since the start" line and a "card memory by holder (MiB)" line. The holder line covers texture blocks with their free and widest-free space, buffer copies split into copies / windows / arenas / mapped, staging blocks, targets and the rest. It's how a texture pool with 2 GB free but only 29 MiB widest free was spotted. - **`play-foxhound.ps1`**: optional `-Victory <exe>` and `-SettingsFile <file>` to run a saved build with its own settings. Both are carried through F1 restarts. ## Testing - `cargo test -p victory-gpu --lib`: 916 passed. `cargo test -p victory-shader --lib`: 462 passed. - The features were played for several hours on a 568c5e5 base: 13 minutes with eviction active and no freeze after the lock fix, and compute protection running through 11+ minutes of eviction. - **Not yet played on this exact base (current main).** The merge with 739f8339 / cf338eab was done by hand. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Found while chasing the "Unsignaled CrossQueueBarrier" crash with
VICTORY_SAMPLED_MARKS=1 + VICTORY_SAMPLED_EVICT=1 on an RTX 5080 (16 GB).
The deadlock itself was the same lock-order inversion cf338eab fixes; this
keeps that fix and adds the tools and guards built along the way.

- Hang probe (queue/behind.rs, VICTORY_HANG_PROBE=0 turns it off): after 3 s
  without a presented frame it logs the line's length, each queue's front
  (fence or value wait and whether met, submission, signal, present), every
  fence wait and signal in the line, and submissions; repeats every 5 s, at
  most 6 times; logs when frames come back.
- Hang dump (new hangdump.rs, VICTORY_HANG_DUMP=0 turns it off): on the
  probe's 1st and 3rd look, suspends each thread in turn, walks its stack
  (RtlVirtualUnwind, no allocation while suspended), resumes it, names the
  frames (dbghelp with victory.pdb) and writes
  %LOCALAPPDATA%\victory\logs\hang-<unix>-<pid>.txt. This is what showed the
  ABBA between the submit thread (texture table -> slot lock) and a list
  thread (slot lock -> texture table).
- Compute protection: compute programs mark the slots they read in the upper
  half of the marks buffer (SAMPLED_COMPUTE = SAMPLED_MARKS / 2; the lower
  half still covers 2^21 slots). Those textures are never evictable
  (descriptor::evictable_slots). VICTORY_SAMPLED_PROTECT=nonpixel marks every
  non-pixel stage there too (keyed in the shader cache).
- Slot eviction guards, all off unless set: VICTORY_SLOT_EVICT_IDLE_MS (least
  idle time; 60000 cut textures made again from ~50% to 2-20% here),
  VICTORY_SLOT_EVICT_MAX (most textures a pass), VICTORY_SLOT_EVICT_MIN_FPS
  (waits while frames are slow). F8/F7 flushes bypass them.
- Every 10 s: "slot eviction since the start" and "card memory by holder
  (MiB)" (host textures, texture blocks and their free/widest-free space,
  tiles, buffer copies split into copies/windows/arenas/mapped, staging
  blocks, targets, rest). It is how a 2 GB free / 29 MiB widest-free texture
  pool and the buffer-copy share were found.
- play-foxhound.ps1: optional -Victory <exe> and -SettingsFile <file> (carried
  through F1 restarts) to run a saved build with its own settings.

cargo test -p victory-gpu --lib: 916 passed; -p victory-shader --lib: 462
passed. Not yet played on this base (it was played on the 568c5e5 base).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 12:32:49 +00:00
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/resource.rs
  • crates/victory-gpu/src/sampled.rs
  • crates/victory-gpu/src/shader_cache.rs
  • crates/victory-shader/src/emit/mod.rs
  • scripts/play-foxhound.ps1
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2372/head:github-bot/gh-2372'
git switch 'github-bot/gh-2372'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2372'
git switch 'github-bot/gh-2372'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2372'
git switch 'github-bot/gh-2372'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2372'
git switch 'main'
git merge --squash 'github-bot/gh-2372'
git switch 'main'
git merge --ff-only 'github-bot/gh-2372'
git switch 'main'
git merge 'github-bot/gh-2372'
git push origin 'main'
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!2372
No description provided.