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

Open
Ahadfahim wants to merge 1 commit from upstream-pr/2372 into main
Ahadfahim commented 2026-11-29 12:28:50 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Ahadfahim on 2026-11-29T12:28:50Z.


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

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5550707857 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2372). Originally posted by [Ahadfahim](https://github.com/Ahadfahim) on 2026-11-29T12:28:50Z. --- ## 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)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2372:upstream-pr/2372'
git switch 'upstream-pr/2372'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2372'
git switch 'upstream-pr/2372'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2372'
git switch 'upstream-pr/2372'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2372'
git switch 'main'
git merge --squash 'upstream-pr/2372'
git switch 'main'
git merge --ff-only 'upstream-pr/2372'
git switch 'main'
git merge 'upstream-pr/2372'
git push origin 'main'
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!2372
No description provided.