shadow: prune idle unreferenced exact views below EXACT_MANY under pressure #4716

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

@⁠nidea1 on GitHub · 2026-12-01 03:10 UTC · original
nidea1:fix/shadow-exact-trim-under-pressure → main · +82 −2 · 1 files · 1 commits · open

What it changes

Under host memory pressure, ExactStore::trim() in crates/victory-gpu/src/shadow.rs previously only drained already-graduated pool buffers and left idle unreferenced exact-view map entries pinned indefinitely whenever total entries stayed below EXACT_MANY (256).

  • When pressured is true and the store is non-empty (self.count.load(Ordering::Relaxed) > 0), ExactStore::trim() now evicts idle unreferenced entries (last_frame + EXACT_IDLE_FRAMES <= now, Arc::strong_count == 1, host::references == 1) even below EXACT_MANY, retiring the evicted shadows via host::retire(shadow) outside all locks (matching existing maybe_prune semantics).
  • Fast-paths empty stores (count == 0) so trim() under pressure does not acquire map.write() unnecessarily.

How it was tested

  • GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): RTX 3060 Ti 8 GB / 32 GB RAM, Series S profile, DLSS Quality, FSR 3 frame generation (--fg-type fsr --framegen 3), ray tracing off, VICTORY_SAMPLED_EVICT=1, VICTORY_WINDOW_GROW=1, VICTORY_POOL_SMALL=0, VICTORY_RIPE_BLOCKS=12.
  • Before: Under host memory pressure, ExactStore::trim() left idle unreferenced exact views below EXACT_MANY (256) retained indefinitely.
  • After:
    • Unit tests verify that trim() under pressure skips acquiring map.write() when empty, evicts idle unreferenced entries below EXACT_MANY, and retains active/referenced entries.
    • Included in a full 12-minute (720.7 s in-world, 16,447 frames) uncontested live soak on 7d93ee0759 (combined 14-branch local stack) with 0 crashes, 0 device losses, 0 Victory errors, HERO LEAD = 0, UPLOAD OVER HOST WRITE = 0, and 0 memory leaks (process PrivateBytes and Shared GPU RAM flat/decreasing across M03–M13).
  • For shader changes, the wave sizes tested (32 and/or 64 lanes): N/A (no shader changes)
  • cargo test passed for the crates it touches: yes (on 2e74dffc, base 7d93ee0759)
    • cargo test -j 2 -p victory-gpu --locked --lib shadow::: 86 passed, 0 failed, 6 ignored (new: empty_exact_store_trim_under_pressure_skips_map_write_lock [bare-runner safe] and exact_trim_under_pressure_evicts_idle_entries_below_many_and_keeps_active)
    • cargo clippy -j 2 -p victory-gpu --all-targets --locked -- -D warnings and --all-features: 0 warnings on 7d93ee0759 (note: current main 5fabb46e has 5 pre-existing clippy errors in font.rs/menu.rs/panel.rs from #4634, tracked in #4679 / #4707).
    • cargo xtask policy: 464 files ok (--staged: 1 file ok).

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #4243, #4637
    • Searched all open PRs touching crates/victory-gpu/src/shadow.rs (#4242, #4636, #4145, #4305, #4558, #2910, #4682, etc.); none touch ExactStore::trim() or prune idle exact views below EXACT_MANY under pressure.
**@⁠nidea1** on GitHub · 2026-12-01 03:10 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4715) `nidea1:fix/shadow-exact-trim-under-pressure` → `main` · +82 −2 · 1 files · 1 commits · open ## What it changes Under host memory pressure, `ExactStore::trim()` in `crates/victory-gpu/src/shadow.rs` previously only drained already-graduated pool buffers and left idle unreferenced exact-view map entries pinned indefinitely whenever total entries stayed below `EXACT_MANY` (`256`). - When `pressured` is true and the store is non-empty (`self.count.load(Ordering::Relaxed) > 0`), `ExactStore::trim()` now evicts idle unreferenced entries (`last_frame + EXACT_IDLE_FRAMES <= now`, `Arc::strong_count == 1`, `host::references == 1`) even below `EXACT_MANY`, retiring the evicted shadows via `host::retire(shadow)` outside all locks (matching existing `maybe_prune` semantics). - Fast-paths empty stores (`count == 0`) so `trim()` under pressure does not acquire `map.write()` unnecessarily. ## How it was tested - GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): RTX 3060 Ti 8 GB / 32 GB RAM, Series S profile, DLSS Quality, FSR 3 frame generation (`--fg-type fsr --framegen 3`), ray tracing off, `VICTORY_SAMPLED_EVICT=1`, `VICTORY_WINDOW_GROW=1`, `VICTORY_POOL_SMALL=0`, `VICTORY_RIPE_BLOCKS=12`. - Before: Under host memory pressure, `ExactStore::trim()` left idle unreferenced exact views below `EXACT_MANY` (`256`) retained indefinitely. - After: - Unit tests verify that `trim()` under pressure skips acquiring `map.write()` when empty, evicts idle unreferenced entries below `EXACT_MANY`, and retains active/referenced entries. - Included in a full 12-minute (`720.7 s` in-world, `16,447` frames) uncontested live soak on `7d93ee0759` (combined 14-branch local stack) with `0` crashes, `0` device losses, `0` Victory errors, `HERO LEAD = 0`, `UPLOAD OVER HOST WRITE = 0`, and `0` memory leaks (process PrivateBytes and Shared GPU RAM flat/decreasing across M03–M13). - For shader changes, the wave sizes tested (32 and/or 64 lanes): N/A (no shader changes) - `cargo test` passed for the crates it touches: yes (on `2e74dffc`, base `7d93ee0759`) - `cargo test -j 2 -p victory-gpu --locked --lib shadow::`: 86 passed, 0 failed, 6 ignored (new: `empty_exact_store_trim_under_pressure_skips_map_write_lock` [bare-runner safe] and `exact_trim_under_pressure_evicts_idle_entries_below_many_and_keeps_active`) - `cargo clippy -j 2 -p victory-gpu --all-targets --locked -- -D warnings` and `--all-features`: 0 warnings on `7d93ee0759` (note: current `main` `5fabb46e` has 5 pre-existing clippy errors in `font.rs`/`menu.rs`/`panel.rs` from `#4634`, tracked in `#4679` / `#4707`). - `cargo xtask policy`: 464 files ok (`--staged`: 1 file ok). ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #4243, #4637 - Searched all open PRs touching `crates/victory-gpu/src/shadow.rs` (`#4242`, `#4636`, `#4145`, `#4305`, `#4558`, `#2910`, `#4682`, etc.); none touch `ExactStore::trim()` or prune idle exact views below `EXACT_MANY` under pressure.
Under host memory pressure, ExactStore::trim() previously only drained
already-graduated pool buffers and left idle unreferenced map entries
below EXACT_MANY (256) pinned indefinitely.

Evict idle unreferenced entries (last_frame + EXACT_IDLE_FRAMES <= now,
Arc::strong_count == 1, D3D12 refcount == 1) during trim() when pressured
and retire them outside all locks. Skip acquiring map.write() when the
store is empty (count == 0).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 03:16:31 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

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