Skip to content

GPU: preserve taken dynamic descriptor slots across texture eviction - #2707

Open
Batushn wants to merge 1 commit into
Marvisak:mainfrom
Batushn:fix/evict-preserve-taken-dynamic-slots
Open

Batushn wants to merge 1 commit into
Marvisak:mainfrom
Batushn:fix/evict-preserve-taken-dynamic-slots

Conversation

@Batushn

@Batushn Batushn commented Nov 25, 2026

Copy link
Copy Markdown

Fixes #2597

Summary

  • Split \HostHeap::evict\ into title slots (\

@kotekompotek

Copy link
Copy Markdown

Correct split of the two slot families: title slots evict as before (viewed + forget_read), while dynamic slots are only cleared when not still taken by an in-flight list - and the guard lock is held across the whole scan so a slot cannot be reallocated mid-evict. Nulling the CPU descriptor before taking the kept entry keeps the slot safe against late shader reads. Retiring the old resources after dropping the locks avoids holding next/kept across retire().

@oni-swr

oni-swr commented Nov 25, 2026

Copy link
Copy Markdown

Independent WARP/CPU verification (claim: #1633)

  • PR head: fb10ff37a684fb65f5c9076437c6f3ff349c822d / origin/main: 13f91caee25f2fdf2c062be5f7a27f058e51cbca
  • State: OPEN, non-draft; git merge-tree --write-tree origin/main <head> merges cleanly; no prior oni-swr comment on this head.
  • Environment: Windows 11 Pro 10.0.26200, VICTORY_WARP=1 + VICTORY_D3D12_WARP=1 (WARP only, no physical GPU, no game files/dumps/retail hashes), dxil.dll 1.8.2502.11 (Windows SDK 10.0.26100.0, via VICTORY_DXIL), rustc 1.98.1 (48a229cea 2026-09-01), debug profile, --locked.

Commands / results (baseline = origin/main, same environment)

cargo test -p victory-shader --locked
cargo test -p victory-gpu --locked
cargo clippy -p victory-gpu --locked --all-targets
  • victory-gpu: 196 passed / 0 failed / 1 ignored (+1 vs baseline 195). New descriptor::host::tests::evict_keeps_taken_dynamic_slots_until_released ok; it executes on WARP (creates a texture, compiles with FXC, dispatches a compute shader and reads back 0xCAFEBABE).
  • Also cargo test -p victory-gpu --locked --features diagnostics: 199 / 0 / 1 (baseline with the feature: 198 / 0 / 1); cargo clippy -p victory-gpu --locked --all-targets --features diagnostics: clean.
  • victory-shader: 267 / 3 / 3, identical to baseline (the same 3 pre-existing WARP failures; unaffected by this PR).
  • clippy -p victory-gpu: 0 warnings, 0 errors (baseline 0).

Negative control: with the eviction restored to the old behaviour (loop over all kept slots incl. dynamic ones, no dynamic pass), the new test FAILS; reverted afterwards.

Code review: No correctness bugs found. Lock order: next then kept only in the new pass; no other site nests them the other way, so no deadlock risk seen. Taken dynamic slots keep their view and reference; released ones are nulled and retired. Nits (non-blocking): the test silently returns (passes) when no host device exists, so it only has value where WARP/GPU is available; let _ = index; is a leftover for non-diagnostics builds; the test depends on process-global host::release_retired() timing (bounded 5 s wait).

Not tested: physical GPU hardware (RX 7800 XT or any), retail game run, release build, other crates.

AI use: Claude Code (Claude Sonnet 5.5) ran the commands and reviewed the diff; the results above are from the actual runs.

@fuzeofficlal

Copy link
Copy Markdown
Contributor

Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP verification and code review of fb10ff37 (on 13f91ca):

Verification (rustc 1.98.1 MSVC)

  • cargo xtask policy: 184 files ok.
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings and --features diagnostics: 0 warnings.
  • WARP (VICTORY_D3D12_WARP=1): cargo test --locked -p victory-gpu --features diagnostics -> 199 passed, 0 failed, 1 ignored (including evict_keeps_taken_dynamic_slots_until_released).
  • RTX 5090: cargo test --locked -p victory-gpu --lib -- descriptor -> 18 passed, 1 failed (evict_keeps_taken_dynamic_slots_until_released passes on hardware; the sole failure is the pre-existing Test report: RTX 5070 (Blackwell), Windows 11, 70564ae: 471 passed, 5 failed, 7 ignored (4 from the 1,000,000 view heap cap) #1744 1M view-heap cap assertion in dynamic_slots_are_held_until_released).

Review Notes

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Needs rebase. This branch no longer merges cleanly into main: the conflict is in crates/victory-gpu/src/descriptor/host.rs. No content review was done yet; it will be reviewed once it is rebased onto current main.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GPU: giving up a texture nulls the dynamic descriptor slots of lists recorded before

5 participants