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

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

@⁠Batushn on GitHub · 2026-11-25 18:33 UTC · original
Batushn:fix/evict-preserve-taken-dynamic-slots → main · +268 −6 · 1 files · 1 commits · open

Fixes #2597

Summary

  • Split \HostHeap::evict\ into title slots (\
**@⁠Batushn** on GitHub · 2026-11-25 18:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/2707) `Batushn:fix/evict-preserve-taken-dynamic-slots` → `main` · +268 −6 · 1 files · 1 commits · open Fixes #2597 ### Summary - Split \HostHeap::evict\ into title slots (\
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:12:28 +00:00
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 18:54 UTC · original

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().

**@⁠kotekompotek** on GitHub · 2026-11-25 18:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/2707#issuecomment-7171573599) 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().
Author
Owner

@⁠oni-swr on GitHub · 2026-11-25 18:56 UTC · original

Independent WARP/CPU verification (claim: Marvisak/VIctory#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.

**@⁠oni-swr** on GitHub · 2026-11-25 18:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/2707#issuecomment-7171620260) **Independent WARP/CPU verification** (claim: Marvisak/VIctory#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.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 19:32 UTC · original

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 #1744 1M view-heap cap assertion in dynamic_slots_are_held_until_released).

Review Notes

  • Splitting HostHeap::evict into title slots (0..self.count) and dynamic slots (self.count..self.count + self.dynamic) under next -> kept lock ordering (with crate::host::retire called outside both locks) is deadlock-free, closes the race against concurrent dynamic() allocation, and keeps in-flight dynamic table descriptors backed by a live ID3D12Resource.
  • Merge-ordering notes: cleanly orthogonal to #2601 (zero overlap); overlaps HostHeap::evict with #2650 (self.title_of mapping on the title-slot half, straightforward rebase once either lands).
**@⁠fuzeofficlal** on GitHub · 2026-11-25 19:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/2707#issuecomment-7172436020) 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 #1744 1M view-heap cap assertion in `dynamic_slots_are_held_until_released`). ### Review Notes - Splitting `HostHeap::evict` into title slots (`0..self.count`) and dynamic slots (`self.count..self.count + self.dynamic`) under `next -> kept` lock ordering (with `crate::host::retire` called outside both locks) is deadlock-free, closes the race against concurrent `dynamic()` allocation, and keeps in-flight dynamic table descriptors backed by a live `ID3D12Resource`. - **Merge-ordering notes:** cleanly orthogonal to #2601 (zero overlap); overlaps `HostHeap::evict` with #2650 (`self.title_of` mapping on the title-slot half, straightforward rebase once either lands).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 22:16 UTC · original

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

**@⁠Marvisak** on GitHub · 2026-11-25 22:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/2707#issuecomment-7176148796) <!-- victory-triage v1 head=fb10ff37a684fb65f5c9076437c6f3ff349c822d verdict=needs-rebase at=2026-11-25T22:17:00Z --> 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](https://claude.ai/code)_
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/descriptor/host.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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