gpu: honour slot eviction backoff on the aside path and keep fast readback while evicted #4432

Closed
nidea1 wants to merge 6 commits from upstream-pr/4432 into main
nidea1 commented 2026-11-30 20:19:40 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nidea1 on 2026-11-30T20:19:40Z.


What it changes

Two correctness bugs in texture slot eviction and sampled-slot readback cadence, observed on an 8 GB VRAM GPU (RTX 3060 Ti):

  1. slot_evict_aside() never updates NEXT_SLOT_MS backoff and allows overlapping background looks (crates/victory-gpu/src/resource.rs)

    • slot_evict() returns immediately after dispatching slot_look_aside(job), skipping the NEXT_SLOT_MS store that follows the inline path (#2549).
    • When VICTORY_SLOT_EVICT_ASIDE is on (default), NEXT_SLOT_MS stays at 0 forever:
      • With VICTORY_SAMPLED_EVICT=0 (default), empty background looks spin on every 1 s sweep instead of backing off 15 s.
      • With VICTORY_SAMPLED_EVICT=1, consecutive sweeps launch overlapping/back-to-back evictions without the 2 s / 5 s cooldown, over-evicting live textures and churning remakes.
    • Fix:
      • Promote NEXT_SLOT_MS to a module-level static shared via schedule_slot_backoff(now_ms, evicted, over_budget).
      • In slot_look_aside, claim SLOT_LOOKING first and then check SLOT_HAS_READY.load(Acquire) || now_ms < NEXT_SLOT_MS.load(Acquire) (closing the TOCTOU window where a finishing look or slot_evict_ready publishes state right before SLOT_LOOKING is claimed).
      • Record empty-pass backoff before clearing SLOT_LOOKING when victims.is_empty().
      • In slot_evict_ready, keep SLOT_HAS_READY set (via a Drop guard) across slot_apply and schedule_slot_backoff(now_ms, n, job.over_budget) so a concurrent slot_evict cannot start a second look before backoff is published, and a batch whose candidates were all kept at their second look gets the 15 s empty backoff.
  2. sampled::on_present falls back to 30-frame readback cadence while evicted indexed slots wait to wake (crates/victory-gpu/src/sampled.rs)

    • sweep_cadence only checked descriptor::host::any_held_textures(), not EVICTED_ANY.
    • Under VICTORY_SAMPLED_EVICT=1, once newly freed VRAM allowed held textures to drop back to 0, thousands of evicted indexed slots were still sitting null while readback dropped from every 4 frames to every 30 frames (~0.5–1.5 s wake latency when a previously evicted texture comes back into view).
    • Fix: pass EVICTED_ANY.load(Relaxed) into sweep_cadence(any_held, any_evicted) so readback stays at HELD_SWEEP_EVERY (4 frames) while any indexed slots are evicted.

Intentionally leaves VICTORY_SAMPLED_EVICT off by default pending extended outdoor/foliage verification.

How it was tested

  • GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): Windows 11 x64, RTX 3060 Ti 8 GB, 32 GB RAM, Series S profile (720p -> 1080p), DLSS Quality, FSR 3 FG, RT off; matched 40 s world runs.
  • Before:
    • VICTORY_SAMPLED_EVICT=0: 64 empty slot eviction aside looks in 38 s (avg 28.9 ms, max 49.4 ms).
    • VICTORY_SAMPLED_EVICT=1: 32+ looks (40,793 evicted), 2,417 quick remakes (<2 s), 9,518 total remakes, readback cadence fell back to 30 frames with 31,015 slots still null.
  • After (both standalone and combined with #4463 on latest commit a99138aa):
    • VICTORY_SAMPLED_EVICT=0: 4 empty slot eviction aside looks in 40 s (honouring 15 s empty-pass backoff).
    • VICTORY_SAMPLED_EVICT=1: 8 looks (24,194–26,707 evicted), quick remakes (<2 s) 378–669 (-72% to -84%), total remakes 2,026–2,339 (-75% to -79%), readback cadence stayed locked at 4 frames throughout, steady VRAM 6.2–6.4 / 6.5–6.6 GB, WAITS FOR GPU 0.0–0.6 ms.
  • For shader changes, the wave sizes tested (32 and/or 64 lanes): N/A.
  • cargo test passed for the crates it touches: yes (cargo test -j 4 -p victory-gpu --locked --lib -- resource::tests:: sampled::tests::: 72 passed, 0 failed, 1 pre-existing ignored; cargo clippy -j 4 -p victory-gpu --all-targets --locked --no-deps: 0 warnings in resource.rs and sampled.rs; cargo run -p xtask -- policy --staged: ok).

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #3858 (bounds inline sweeps, does not update NEXT_SLOT_MS on the aside path), #3697, #4339, #3750, and #4465 (opened shortly after this PR for the resource.rs backoff part only; this PR also closes the slot_look_aside/slot_evict_ready concurrency windows and fixes the sampled.rs wake cadence).
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5573051955 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4432). Originally posted by [nidea1](https://github.com/nidea1) on 2026-11-30T20:19:40Z. --- ## What it changes Two correctness bugs in texture slot eviction and sampled-slot readback cadence, observed on an 8 GB VRAM GPU (RTX 3060 Ti): 1. **`slot_evict_aside()` never updates `NEXT_SLOT_MS` backoff and allows overlapping background looks (`crates/victory-gpu/src/resource.rs`)** - `slot_evict()` returns immediately after dispatching `slot_look_aside(job)`, skipping the `NEXT_SLOT_MS` store that follows the inline path (#2549). - When `VICTORY_SLOT_EVICT_ASIDE` is on (default), `NEXT_SLOT_MS` stays at `0` forever: - With `VICTORY_SAMPLED_EVICT=0` (default), empty background looks spin on every 1 s sweep instead of backing off 15 s. - With `VICTORY_SAMPLED_EVICT=1`, consecutive sweeps launch overlapping/back-to-back evictions without the 2 s / 5 s cooldown, over-evicting live textures and churning remakes. - Fix: - Promote `NEXT_SLOT_MS` to a module-level static shared via `schedule_slot_backoff(now_ms, evicted, over_budget)`. - In `slot_look_aside`, claim `SLOT_LOOKING` first and then check `SLOT_HAS_READY.load(Acquire) || now_ms < NEXT_SLOT_MS.load(Acquire)` (closing the TOCTOU window where a finishing look or `slot_evict_ready` publishes state right before `SLOT_LOOKING` is claimed). - Record empty-pass backoff before clearing `SLOT_LOOKING` when `victims.is_empty()`. - In `slot_evict_ready`, keep `SLOT_HAS_READY` set (via a `Drop` guard) across `slot_apply` and `schedule_slot_backoff(now_ms, n, job.over_budget)` so a concurrent `slot_evict` cannot start a second look before backoff is published, and a batch whose candidates were all kept at their second look gets the 15 s empty backoff. 2. **`sampled::on_present` falls back to 30-frame readback cadence while evicted indexed slots wait to wake (`crates/victory-gpu/src/sampled.rs`)** - `sweep_cadence` only checked `descriptor::host::any_held_textures()`, not `EVICTED_ANY`. - Under `VICTORY_SAMPLED_EVICT=1`, once newly freed VRAM allowed held textures to drop back to `0`, thousands of evicted indexed slots were still sitting null while readback dropped from every 4 frames to every 30 frames (~0.5–1.5 s wake latency when a previously evicted texture comes back into view). - Fix: pass `EVICTED_ANY.load(Relaxed)` into `sweep_cadence(any_held, any_evicted)` so readback stays at `HELD_SWEEP_EVERY` (4 frames) while any indexed slots are evicted. Intentionally leaves `VICTORY_SAMPLED_EVICT` off by default pending extended outdoor/foliage verification. ## How it was tested - GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): Windows 11 x64, RTX 3060 Ti 8 GB, 32 GB RAM, Series S profile (720p -> 1080p), DLSS Quality, FSR 3 FG, RT off; matched 40 s world runs. - Before: - `VICTORY_SAMPLED_EVICT=0`: **64** empty `slot eviction aside` looks in 38 s (avg 28.9 ms, max 49.4 ms). - `VICTORY_SAMPLED_EVICT=1`: **32+** looks (40,793 evicted), **2,417** quick remakes (`<2 s`), **9,518** total remakes, readback cadence fell back to **30 frames** with 31,015 slots still null. - After (both standalone and combined with #4463 on latest commit `a99138aa`): - `VICTORY_SAMPLED_EVICT=0`: **4** empty `slot eviction aside` looks in 40 s (honouring 15 s empty-pass backoff). - `VICTORY_SAMPLED_EVICT=1`: **8** looks (24,194–26,707 evicted), quick remakes (`<2 s`) **378–669** (-72% to -84%), total remakes **2,026–2,339** (-75% to -79%), readback cadence stayed locked at **4 frames** throughout, steady VRAM 6.2–6.4 / 6.5–6.6 GB, `WAITS FOR GPU` 0.0–0.6 ms. - For shader changes, the wave sizes tested (32 and/or 64 lanes): N/A. - `cargo test` passed for the crates it touches: yes (`cargo test -j 4 -p victory-gpu --locked --lib -- resource::tests:: sampled::tests::`: 72 passed, 0 failed, 1 pre-existing ignored; `cargo clippy -j 4 -p victory-gpu --all-targets --locked --no-deps`: 0 warnings in `resource.rs` and `sampled.rs`; `cargo run -p xtask -- policy --staged`: ok). ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #3858 (bounds inline sweeps, does not update `NEXT_SLOT_MS` on the aside path), #3697, #4339, #3750, and #4465 (opened shortly after this PR for the `resource.rs` backoff part only; this PR also closes the `slot_look_aside`/`slot_evict_ready` concurrency windows and fixes the `sampled.rs` wake cadence).
tikD1337 commented 2026-11-30 20:51:06 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by tikD1337 on 2026-11-30T20:51:06Z.


Tested headlessly on origin/main (e1251c31, Windows 11, no game run):

  • Merge check: clean against origin/main.
  • cargo test -p victory-gpu --lib -- slot_evict / sampled::tests: 13 passed, 0 failed (1187 filtered).

Note: the crates/victory-gpu/src/resource.rs backoff/guard change overlaps with #4465 (merging both would conflict in resource.rs). #4432 uses Acquire/Release on NEXT_SLOT_MS and additionally updates sweep_cadence in crates/victory-gpu/src/sampled.rs to keep fast readback while evicted slots are waiting to wake.

(AI-assisted build/unit-test check and diff review; game runtime not launched.)

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7291558906 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4432#issuecomment-7291558906). Originally posted by [tikD1337](https://github.com/tikD1337) on 2026-11-30T20:51:06Z. --- Tested headlessly on `origin/main` (`e1251c31`, Windows 11, no game run): - Merge check: clean against `origin/main`. - `cargo test -p victory-gpu --lib -- slot_evict` / `sampled::tests`: **13 passed, 0 failed** (1187 filtered). Note: the `crates/victory-gpu/src/resource.rs` backoff/guard change overlaps with #4465 (merging both would conflict in `resource.rs`). #4432 uses `Acquire`/`Release` on `NEXT_SLOT_MS` and additionally updates `sweep_cadence` in `crates/victory-gpu/src/sampled.rs` to keep fast readback while evicted slots are waiting to wake. *(AI-assisted build/unit-test check and diff review; game runtime not launched.)*
IRennie74 commented 2026-11-30 22:38:27 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by IRennie74 on 2026-11-30T22:38:27Z.


For whoever merges this together with #4558 (whole sweep off the submitting thread, VICTORY_SWEEP_OFF_THREAD=1): on that path slot_evict runs on the sweep's own thread and does not hand off to slot_look_aside (... && slot_evict_aside() && !crate::host::sweeper::here()). The inline NEXT_SLOT_MS backoff therefore already applies there, and this PR changes nothing for it. It fixes the default path. Both edit the same if !forced && slot_evict_aside() line in slot_evict, so expect a small textual conflict, and keep the !here term when resolving it.

Of this and #4465, this one is the superset (the same backoff hoist plus the slot_evict_ready window and the sampled.rs cadence), so only one of the two should land.

(The CI failure is main's clippy errors, loop_caps / ranged / is_multiple_of, not this change. The new test therefore has not run in CI yet.)

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7294112344 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4432#issuecomment-7294112344). Originally posted by [IRennie74](https://github.com/IRennie74) on 2026-11-30T22:38:27Z. --- For whoever merges this together with #4558 (whole sweep off the submitting thread, `VICTORY_SWEEP_OFF_THREAD=1`): on that path `slot_evict` runs on the sweep's own thread and does not hand off to `slot_look_aside` (`... && slot_evict_aside() && !crate::host::sweeper::here()`). The inline `NEXT_SLOT_MS` backoff therefore already applies there, and this PR changes nothing for it. It fixes the default path. Both edit the same `if !forced && slot_evict_aside()` line in `slot_evict`, so expect a small textual conflict, and keep the `!here` term when resolving it. Of this and #4465, this one is the superset (the same backoff hoist plus the `slot_evict_ready` window and the `sampled.rs` cadence), so only one of the two should land. (The CI failure is main's clippy errors, `loop_caps` / `ranged` / `is_multiple_of`, not this change. The new test therefore has not run in CI yet.)
nidea1 commented 2026-12-01 03:09:23 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nidea1 on 2026-12-01T03:09:23Z.


@IRennie74 Thanks for the review and heads-up on #4558!

#4432 is now rebased cleanly onto 7d93ee0759 (90687a75). If #4558 lands first, I will rebase and make sure !crate::host::sweeper::here() is preserved on if !forced && slot_evict_aside() so the off-thread sweep path stays untouched.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7299386355 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4432#issuecomment-7299386355). Originally posted by [nidea1](https://github.com/nidea1) on 2026-12-01T03:09:23Z. --- @IRennie74 Thanks for the review and heads-up on #4558! #4432 is now rebased cleanly onto `7d93ee0759` (`90687a75`). If #4558 lands first, I will rebase and make sure `!crate::host::sweeper::here()` is preserved on `if !forced && slot_evict_aside()` so the off-thread sweep path stays untouched.
Maverick0351a commented 2026-12-01 03:51:17 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Maverick0351a on 2026-12-01T03:51:17Z.


Confirming this bug on a 16 GB GPU as well (Windows 11 x64, RTX 5080 Laptop 16 GB, 32 GB RAM, Series S profile, 2560x1440, DLSS Quality + DLSS FG 4x, VICTORY_SLOT_EVICT=1, VICTORY_SAMPLED_EVICT=1, VICTORY_TEXTURE_ROOM_PERCENT=88).

Over a 1h 46m run (99,983 DLSS frames), the missing NEXT_SLOT_MS backoff on the VICTORY_SLOT_EVICT_ASIDE path caused:

  • 905,763 textures evicted (98,493 MB churn), 732,611 recreated (62,339 within 2 s), and 808,429 indexed slots set back to null (35,116 still null on the 30-frame cadence).
  • Right after leaving a menu/cutscene when VRAM crossed 88% (13,815 / 15,235 MB), sweep() fired two back-to-back slot-eviction bursts 57 ms apart (2,243 copies / 256 MB, then 1,256 copies / 114 MB), with an nvlddmkm Event ID 153 / 0x887A0006 device hang occurring 31 ms after the first burst.

One minor ordering detail worth checking alongside this PR: in crates/victory-gpu/src/host.rs (sweep()), crate::resource::slot_evict_ready() currently runs after take_idle_reclaim_request() -> let_go_idle(), whereas moving slot_evict_ready() before take_idle_reclaim_request() ensures a ready batch is applied and publishes NEXT_SLOT_MS before any new reclaim request checks it.

Note: this PR currently shows unrelated base diffs from today's main update (f5c3d243), so a rebase onto f5c3d243 will keep the diff scoped cleanly to resource.rs and sampled.rs.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7300130537 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4432#issuecomment-7300130537). Originally posted by [Maverick0351a](https://github.com/Maverick0351a) on 2026-12-01T03:51:17Z. --- Confirming this bug on a 16 GB GPU as well (Windows 11 x64, RTX 5080 Laptop 16 GB, 32 GB RAM, Series S profile, 2560x1440, DLSS Quality + DLSS FG 4x, `VICTORY_SLOT_EVICT=1`, `VICTORY_SAMPLED_EVICT=1`, `VICTORY_TEXTURE_ROOM_PERCENT=88`). Over a 1h 46m run (99,983 DLSS frames), the missing `NEXT_SLOT_MS` backoff on the `VICTORY_SLOT_EVICT_ASIDE` path caused: - **905,763** textures evicted (**98,493 MB** churn), **732,611** recreated (**62,339** within 2 s), and **808,429** indexed slots set back to null (**35,116** still null on the 30-frame cadence). - Right after leaving a menu/cutscene when VRAM crossed 88% (`13,815 / 15,235 MB`), `sweep()` fired two back-to-back slot-eviction bursts **57 ms apart** (`2,243` copies / `256 MB`, then `1,256` copies / `114 MB`), with an `nvlddmkm` Event ID 153 / `0x887A0006` device hang occurring 31 ms after the first burst. One minor ordering detail worth checking alongside this PR: in `crates/victory-gpu/src/host.rs` (`sweep()`), `crate::resource::slot_evict_ready()` currently runs *after* `take_idle_reclaim_request()` -> `let_go_idle()`, whereas moving `slot_evict_ready()` before `take_idle_reclaim_request()` ensures a ready batch is applied and publishes `NEXT_SLOT_MS` before any new reclaim request checks it. Note: this PR currently shows unrelated base diffs from today's `main` update (`f5c3d243`), so a rebase onto `f5c3d243` will keep the diff scoped cleanly to `resource.rs` and `sampled.rs`.
nidea1 commented 2026-12-01 09:59:43 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nidea1 on 2026-12-01T09:59:43Z.


@Maverick0351a Thanks for the detailed 16 GB field confirmation (those 57 ms back-to-back bursts and 35k null slots stuck on the 30-frame cadence match what we saw on 8 GB).

  1. Rebased onto current main (5fabb46e): updated branch head is 24a8bb50 (ab666153 + 46748705 + 24a8bb50), cleanly MERGEABLE and scoped strictly to crates/victory-gpu/src/resource.rs and crates/victory-gpu/src/sampled.rs. Follow-up 24a8bb50 also encapsulates the four aside-coordination statics into SlotAside (SLOT_ASIDE_STATE) so the unit test runs on an isolated instance (eliminating the parallel sweep() -> slot_evict_ready() race in cargo test and directly exercising empty-look backoff, in-flight apply_ready exclusion, and panic cleanup).

  2. host.rs sweep() ordering (slot_evict_ready() vs take_idle_reclaim_request()): checked crates/victory-gpu/src/host.rs:910-917 and intentionally kept host.rs out of this PR to stay cleanly scoped to resource.rs/sampled.rs and avoid conflicting with #4558's hunk on take_idle_reclaim_request(). Even with slot_evict_ready() right after take_idle_reclaim_request(), no second burst can launch when a ready batch is pending: slot_look_aside() claims looking and immediately returns if has_ready.load(Acquire) is set, and slot_evict_ready() then runs on the very next line of the same sweep(), applying the batch and publishing next_ms (Release) before clearing has_ready. (When VICTORY_SLOT_EVICT_ASIDE=0, has_ready is never set; for F7/F8 forced flushes, backoff is bypassed regardless of order.)

Verification on 24a8bb50 (base 5fabb46e):

  • cargo test --locked -p victory-gpu --lib -- resource::tests:: sampled::tests::: 72 passed, 0 failed, 1 ignored
  • cargo test --locked -p victory-gpu --lib and -- --test-threads=1: 1096 passed, 0 failed, 66 ignored
  • cargo test --locked -p victory-gpu --features diagnostics --test replay --test replay_big: 1 passed, 0 failed, 1 ignored
  • cargo clippy -p victory-gpu --all-targets --all-features --locked --no-deps: 0 warnings in resource.rs and sampled.rs (only main's 5 pre-existing warnings in font.rs/menu.rs/panel.rs, tracked in #4707)
  • cargo xtask policy (and --staged): 464 files ok / 1 files ok
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7307509957 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4432#issuecomment-7307509957). Originally posted by [nidea1](https://github.com/nidea1) on 2026-12-01T09:59:43Z. --- @Maverick0351a Thanks for the detailed 16 GB field confirmation (those 57 ms back-to-back bursts and 35k null slots stuck on the 30-frame cadence match what we saw on 8 GB). 1. **Rebased onto current `main` (`5fabb46e`):** updated branch head is `24a8bb50` (`ab666153` + `46748705` + `24a8bb50`), cleanly `MERGEABLE` and scoped strictly to `crates/victory-gpu/src/resource.rs` and `crates/victory-gpu/src/sampled.rs`. Follow-up `24a8bb50` also encapsulates the four aside-coordination statics into `SlotAside` (`SLOT_ASIDE_STATE`) so the unit test runs on an isolated instance (eliminating the parallel `sweep() -> slot_evict_ready()` race in `cargo test` and directly exercising empty-look backoff, in-flight `apply_ready` exclusion, and panic cleanup). 2. **`host.rs` `sweep()` ordering (`slot_evict_ready()` vs `take_idle_reclaim_request()`):** checked `crates/victory-gpu/src/host.rs:910-917` and intentionally kept `host.rs` out of this PR to stay cleanly scoped to `resource.rs`/`sampled.rs` and avoid conflicting with `#4558`'s hunk on `take_idle_reclaim_request()`. Even with `slot_evict_ready()` right after `take_idle_reclaim_request()`, no second burst can launch when a ready batch is pending: `slot_look_aside()` claims `looking` and immediately returns if `has_ready.load(Acquire)` is set, and `slot_evict_ready()` then runs on the very next line of the same `sweep()`, applying the batch and publishing `next_ms` (`Release`) before clearing `has_ready`. (When `VICTORY_SLOT_EVICT_ASIDE=0`, `has_ready` is never set; for F7/F8 forced flushes, backoff is bypassed regardless of order.) Verification on `24a8bb50` (base `5fabb46e`): - `cargo test --locked -p victory-gpu --lib -- resource::tests:: sampled::tests::`: **72 passed, 0 failed, 1 ignored** - `cargo test --locked -p victory-gpu --lib` and `-- --test-threads=1`: **1096 passed, 0 failed, 66 ignored** - `cargo test --locked -p victory-gpu --features diagnostics --test replay --test replay_big`: **1 passed, 0 failed, 1 ignored** - `cargo clippy -p victory-gpu --all-targets --all-features --locked --no-deps`: **0 warnings in `resource.rs` and `sampled.rs`** (only `main`'s 5 pre-existing warnings in `font.rs`/`menu.rs`/`panel.rs`, tracked in `#4707`) - `cargo xtask policy` (and `--staged`): **464 files ok** / **1 files ok**
nidea1 commented 2026-12-01 12:33:49 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nidea1 on 2026-12-01T12:33:49Z.


Live runtime verification on updated SlotAside head 24a8bb50 (RTX 3060 Ti 8 GB (ReBAR off, driver 621.40), 32 GB RAM, Windows 11, Series S, DLSS Quality, FSR 3 FG, RT off, VICTORY_SAMPLED_EVICT=1, VICTORY_WINDOW_GROW=1, VICTORY_POOL_SMALL=0, VICTORY_RIPE_BLOCKS=12 — 5-minute (300 s in-world, 357 s total) live validation on a combined 15-PR release build over origin/main (5fabb46eaf).):

  • Completed full 300 s in-world (357 s total) with 0 nvlddmkm events (id153=0), 0 device hangs, and 0 Victory errors.
  • VICTORY_SLOT_EVICT_ASIDE: 16 looks off the submitting thread (23.9 ms avg, 49.1 ms max), 37,972 textures evicted (561 kept at second look, longest carry-out 8.96 ms).
  • VICTORY_SAMPLED_MARKS=1 maintained fast 4-frame readback cadence throughout (6,390–6,516 marked over last 4 frames; 38,377 index-picked slots nulled, 4,795 / 12.5% requeued, 33,582 null at end).
  • Steady-state (t=139..357 s): only 1 <2 s eviction remake across the final 3.5 minutes; VRAM held steady at 6,559 / 6,770 MB (-211 MB under budget), Shared GPU RAM fell 7,280 -> 5,980 MB.
  • 3 captured frames (+31 s, +151 s, +285 s) checked clean with no missing/corrupt textures.

Caveat: combined 15-PR release build over a 5-minute opening/cell sequence (not an isolated A/B or multi-hour driving session).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7311320297 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4432#issuecomment-7311320297). Originally posted by [nidea1](https://github.com/nidea1) on 2026-12-01T12:33:49Z. --- Live runtime verification on updated `SlotAside` head `24a8bb50` (RTX 3060 Ti 8 GB (ReBAR off, driver `621.40`), 32 GB RAM, Windows 11, Series S, DLSS Quality, FSR 3 FG, RT off, `VICTORY_SAMPLED_EVICT=1`, `VICTORY_WINDOW_GROW=1`, `VICTORY_POOL_SMALL=0`, `VICTORY_RIPE_BLOCKS=12` — 5-minute (`300 s` in-world, `357 s` total) live validation on a combined 15-PR release build over `origin/main` (`5fabb46eaf`).): - Completed full `300 s` in-world (`357 s` total) with **`0` `nvlddmkm` events (`id153=0`)**, **`0` device hangs**, and **`0` Victory errors**. - `VICTORY_SLOT_EVICT_ASIDE`: **`16` looks** off the submitting thread (`23.9 ms` avg, `49.1 ms` max), `37,972` textures evicted (`561` kept at second look, longest carry-out `8.96 ms`). - `VICTORY_SAMPLED_MARKS=1` maintained fast **4-frame** readback cadence throughout (`6,390–6,516` marked over last 4 frames; `38,377` index-picked slots nulled, `4,795` / `12.5%` requeued, `33,582` null at end). - Steady-state (`t=139..357 s`): only **`1`** `<2 s` eviction remake across the final 3.5 minutes; VRAM held steady at `6,559 / 6,770 MB` (`-211 MB` under budget), Shared GPU RAM fell `7,280 -> 5,980 MB`. - 3 captured frames (`+31 s`, `+151 s`, `+285 s`) checked clean with no missing/corrupt textures. *Caveat:* combined 15-PR release build over a 5-minute opening/cell sequence (not an isolated A/B or multi-hour driving session).
andrewpozdnakov7-jpg commented 2026-12-01 13:12:16 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by andrewpozdnakov7-jpg on 2026-12-01T13:12:16Z.


24a8bb50 keeps the fast readback cadence while indexed evictions wait. There is a heap-lifetime case: destroying a shader heap removes it from the heap registry, but its slots remain in EVICTED until those indices are marked again. An unused index can keep fast readback active after its heap is gone. The same condition is also in #4890.

b118f9cc records the indexed eviction while the heap is still registered, then removes that heap's entries when it unregisters. Entries for other heaps at the same index remain eligible to wake.

I ran the exact eviction registration, heap drop, and cadence functions in one Windows Rust fixture with two synthetic heaps and stubbed descriptor writes. The author head kept all three entries and a four-frame cadence after both heaps closed. The patch kept the remaining heap's one entry and four-frame cadence after the first close, then zero entries and the normal 30-frame cadence after the second. The staged asset check passed for both files. The fixture checks host state and scheduling.

Please keep the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding the change in.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7312259720 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4432#issuecomment-7312259720). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-12-01T13:12:16Z. --- `24a8bb50` keeps the fast readback cadence while indexed evictions wait. There is a heap-lifetime case: destroying a shader heap removes it from the heap registry, but its slots remain in `EVICTED` until those indices are marked again. An unused index can keep fast readback active after its heap is gone. The same condition is also in #4890. [b118f9cc](https://github.com/andrewpozdnakov7-jpg/VIctory-NVIDIA/commit/b118f9cc77efbf3412f914aafce8d7d91b9fc953) records the indexed eviction while the heap is still registered, then removes that heap's entries when it unregisters. Entries for other heaps at the same index remain eligible to wake. I ran the exact eviction registration, heap drop, and cadence functions in one Windows Rust fixture with two synthetic heaps and stubbed descriptor writes. The author head kept all three entries and a four-frame cadence after both heaps closed. The patch kept the remaining heap's one entry and four-frame cadence after the first close, then zero entries and the normal 30-frame cadence after the second. The staged asset check passed for both files. The fixture checks host state and scheduling. Please keep the Git author on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding the change in. AI-assisted with OpenAI Codex.
nidea1 commented 2026-12-01 14:48:04 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nidea1 on 2026-12-01T14:48:04Z.


Thanks @andrewpozdnakov7-jpg for catching the Heap::drop / EVICTED lifetime leak and providing the fix!

Cherry-picked b118f9cc77 onto this branch as 7b5b09d99e with your original Git author preserved, and added unit + concurrency tests (006d953c8a, 14c87fec33):

  • descriptor::tests::dropping_a_shader_heap_forgets_its_evicted_slots_and_restores_cadence: shared/unique slot cleanup on Heap::drop, unregistered heap drops, stale evict_slots, and cadence restoration back to SWEEP_EVERY (with consistent lock-held evicted_snapshot() and test serialization guard evicted_test_lock()).
  • resource::tests::indexed_evict_slots_forgets_heap_on_drop_and_concurrent_release: end-to-end live HostHeap evict_slots(..., indexed = true) -> Heap::drop cleanup plus a 16-round barrier-synchronized concurrent evict_slots vs Heap::drop race check.

Verified on 14c87fec33:

  • cargo test --locked -p victory-gpu --lib -- resource::tests:: sampled::tests:: descriptor::tests::: 91 passed, 0 failed, 1 ignored
  • cargo test --locked -p victory-gpu --lib -- --test-threads=1: 1098 passed, 0 failed, 66 ignored
  • cargo test --locked -p victory-gpu --lib: 1098 passed, 0 failed, 66 ignored (clean parallel pass; both eviction tests also passed 5/5 repeated parallel runs)
  • cargo clippy --locked -p victory-gpu --all-targets --no-deps (default and --all-features): 0 warnings in descriptor.rs, sampled.rs, and resource.rs (only main's 5 pre-existing #4707 warnings in host/{font,menu,panel}.rs)
  • cargo xtask policy: 464 files ok
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7314848475 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4432#issuecomment-7314848475). Originally posted by [nidea1](https://github.com/nidea1) on 2026-12-01T14:48:04Z. --- Thanks @andrewpozdnakov7-jpg for catching the `Heap::drop` / `EVICTED` lifetime leak and providing the fix! Cherry-picked `b118f9cc77` onto this branch as `7b5b09d99e` with your original Git author preserved, and added unit + concurrency tests (`006d953c8a`, `14c87fec33`): - `descriptor::tests::dropping_a_shader_heap_forgets_its_evicted_slots_and_restores_cadence`: shared/unique slot cleanup on `Heap::drop`, unregistered heap drops, stale `evict_slots`, and cadence restoration back to `SWEEP_EVERY` (with consistent lock-held `evicted_snapshot()` and test serialization guard `evicted_test_lock()`). - `resource::tests::indexed_evict_slots_forgets_heap_on_drop_and_concurrent_release`: end-to-end live `HostHeap` `evict_slots(..., indexed = true)` -> `Heap::drop` cleanup plus a 16-round barrier-synchronized concurrent `evict_slots` vs `Heap::drop` race check. Verified on `14c87fec33`: - `cargo test --locked -p victory-gpu --lib -- resource::tests:: sampled::tests:: descriptor::tests::`: 91 passed, 0 failed, 1 ignored - `cargo test --locked -p victory-gpu --lib -- --test-threads=1`: 1098 passed, 0 failed, 66 ignored - `cargo test --locked -p victory-gpu --lib`: 1098 passed, 0 failed, 66 ignored (clean parallel pass; both eviction tests also passed 5/5 repeated parallel runs) - `cargo clippy --locked -p victory-gpu --all-targets --no-deps` (default and `--all-features`): 0 warnings in `descriptor.rs`, `sampled.rs`, and `resource.rs` (only `main`'s 5 pre-existing `#4707` warnings in `host/{font,menu,panel}.rs`) - `cargo xtask policy`: 464 files ok
trustno1-coder commented 2026-12-01 18:41:39 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:41:39Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7321359010 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4432#issuecomment-7321359010). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-12-01T18:41:39Z. --- 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.

Pull request closed

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