fix(gpu): respect completed sampling windows in slot eviction #3697

Closed
github-bot wants to merge 1 commit from github-bot/gh-3697 into main AGit
Owner

@⁠victorportelada on GitHub · 2026-11-30 04:18 UTC · original
victorportelada:pr/eviction-readback → main · +70 −4 · 2 files · 1 commits · closed without merging

Problem

With VICTORY_SAMPLED_EVICT=1, the GPU→CPU readback of sampled-slot marks is asynchronous. A slot eviction cutoff can advance past a whole 30-frame readback window before its marks have arrived, so recently sampled textures look cold and become eligible for eviction. On an RTX 5060 8 GB this caused a heavy re-upload storm: 24,458 textures evicted, 3,114 remade, 519 within 2 seconds, with texture first-serve latency spiking to 13+ frames.

Fix

Clamp the eviction cutoff to the last readback whose marks have actually been written into seen. A current token then skips a redundant full dependency scan; stale or inconclusive results still use the authoritative wait check. The regression test checks that a current token is not aged out, that arrivals and landings invalidate it, and that no completed readbacks leaves the result unknown.

Verification

  • New regression test added; all three sampled tests pass on this branch.
  • Targeted cargo test -p victory-gpu --lib sampled: 3 passed.
  • cargo xtask policy: 441 files ok.
  • Note: cargo clippy -D warnings currently fails on clean upstream main itself with pre-existing lints (unused imports/variables, MSRV is_multiple_of); this patch does not add any.

Matched headless A/B on the RTX 5060 8 GB / Ryzen 5 5600 rig with a gated replay driver: quick rebuilds (<2 s) fell from 1,394 to 283 and total remakes from 13,307 to 4,981, with zero VRAM warnings in both. The fix is correctness-directed; fps impact on a 6-core CPU was within scene noise.

**@⁠victorportelada** on GitHub · 2026-11-30 04:18 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3697) `victorportelada:pr/eviction-readback` → `main` · +70 −4 · 2 files · 1 commits · closed without merging ## Problem With `VICTORY_SAMPLED_EVICT=1`, the GPU→CPU readback of sampled-slot marks is asynchronous. A slot eviction cutoff can advance past a whole 30-frame readback window before its marks have arrived, so recently sampled textures look cold and become eligible for eviction. On an RTX 5060 8 GB this caused a heavy re-upload storm: 24,458 textures evicted, 3,114 remade, 519 within 2 seconds, with texture first-serve latency spiking to 13+ frames. ## Fix Clamp the eviction cutoff to the last readback whose marks have actually been written into `seen`. A current token then skips a redundant full dependency scan; stale or inconclusive results still use the authoritative wait check. The regression test checks that a current token is not aged out, that arrivals and landings invalidate it, and that no completed readbacks leaves the result unknown. ## Verification - New regression test added; all three `sampled` tests pass on this branch. - Targeted `cargo test -p victory-gpu --lib sampled`: 3 passed. - `cargo xtask policy`: 441 files ok. - Note: `cargo clippy -D warnings` currently fails on clean upstream `main` itself with pre-existing lints (unused imports/variables, MSRV `is_multiple_of`); this patch does not add any. Matched headless A/B on the RTX 5060 8 GB / Ryzen 5 5600 rig with a gated replay driver: quick rebuilds (<2 s) fell from 1,394 to 283 and total remakes from 13,307 to 4,981, with zero VRAM warnings in both. The fix is correctness-directed; fps impact on a 6-core CPU was within scene noise.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 04:22:07 +00:00
Author
Owner

@⁠tyr0nsur on GitHub · 2026-11-30 07:47 UTC · original

A pre-fix 8 GiB data point for this path. One long v2026.11.29.05 run on an RTX 4060 with 32 GB RAM and VICTORY_SAMPLED_EVICT=1 ended at 167,763 recorded indexed-slot resets and 129,589 requeue events after shader marks (about 77 requeues per 100 resets). These are cumulative descriptor events and the same slot can recur. They do not measure unique textures, re-upload latency, or bytes returned to DXGI. I have no matched in-game post-fix run yet.

I also applied 2353047 together with #3750 and its busy-descriptor follow-up on 41adb551. The three sampling tests and the locked-descriptor regression passed under Windows WARP. This verifies that those changes build and pass the targeted tests together.

**@⁠tyr0nsur** on GitHub · 2026-11-30 07:47 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3697#issuecomment-7272133047) A pre-fix 8 GiB data point for this path. One long `v2026.11.29.05` run on an RTX 4060 with 32 GB RAM and `VICTORY_SAMPLED_EVICT=1` ended at 167,763 recorded indexed-slot resets and 129,589 requeue events after shader marks (about 77 requeues per 100 resets). These are cumulative descriptor events and the same slot can recur. They do not measure unique textures, re-upload latency, or bytes returned to DXGI. I have no matched in-game post-fix run yet. I also applied `2353047` together with #3750 and its busy-descriptor follow-up on `41adb551`. The three sampling tests and the locked-descriptor regression passed under Windows WARP. This verifies that those changes build and pass the targeted tests together.
Author
Owner

@⁠trustno1-coder on GitHub · 2026-12-01 18:49 UTC · original

Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

**@⁠trustno1-coder** on GitHub · 2026-12-01 18:49 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3697#issuecomment-7321628976) Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.
github-bot closed this pull request 2026-12-01 18:58:00 +00:00

Pull request closed

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!3697
No description provided.