GPU: release resource references with dynamic descriptor slots #2198

Closed
andrewpozdnakov7-jpg wants to merge 1 commit from upstream-pr/2200 into main
andrewpozdnakov7-jpg commented 2026-11-25 07:36:05 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-25T07:36:05Z.


Change

When a command-list state releases a dynamic descriptor range, drop the references kept by those slots before returning the range to the allocator. The displaced D3D12 resources still pass through the existing retirement queue.

Verification

Tested on WARP against 940d32f69b22265690a0b5a15d6ded572ba33baf. The same regression creates two structured-buffer copies in separate dynamic slots and releases one through command-list state teardown.

  • Before: the released slot still holds its copy. GPU suite: 145 passed, 1 failed, 2 ignored.
  • After: the released copy is gone and the other slot keeps its copy until its own release. GPU suite: 146 passed, 0 failed, 2 ignored.
  • Strict victory-gpu Clippy passed with default features and with diagnostics. Staged asset policy passed.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6599585427 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2200). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-25T07:36:05Z. --- ## Change When a command-list state releases a dynamic descriptor range, drop the references kept by those slots before returning the range to the allocator. The displaced D3D12 resources still pass through the existing retirement queue. ## Verification Tested on WARP against `940d32f69b22265690a0b5a15d6ded572ba33baf`. The same regression creates two structured-buffer copies in separate dynamic slots and releases one through command-list state teardown. - Before: the released slot still holds its copy. GPU suite: 145 passed, 1 failed, 2 ignored. - After: the released copy is gone and the other slot keeps its copy until its own release. GPU suite: 146 passed, 0 failed, 2 ignored. - Strict `victory-gpu` Clippy passed with default features and with diagnostics. Staged asset policy passed.
DenRakEiw commented 2026-11-25 08:06:22 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T07:42:21Z.

Review: APPROVED


Verified locally merged onto origin/main (940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090, Rust 1.98.1 MSVC):

  • cargo test -p victory-gpu --lib descriptor::tests:: — 5 passed, 0 failed
  • cargo clippy -p victory-gpu --all-targets — 0 warnings
  • cargo xtask policy — ok (183 files ok)

Clean release of kept resource references alongside dynamic descriptor slot release. Looks good.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6053615140 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2200#pullrequestreview-6053615140). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-25T07:42:21Z. **Review:** APPROVED --- Verified locally merged onto `origin/main` (`940d32f`, Windows 11 x64, NVIDIA GeForce RTX 5090, Rust 1.98.1 MSVC): - `cargo test -p victory-gpu --lib descriptor::tests::` — 5 passed, 0 failed - `cargo clippy -p victory-gpu --all-targets` — 0 warnings - `cargo xtask policy` — ok (`183 files ok`) Clean release of kept resource references alongside dynamic descriptor slot release. Looks good. AI-assisted (Gemini 4 Neon).
catminou4 commented 2026-11-25 08:06:22 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T08:03:07Z.

Review: COMMENTED


Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.

Resource references released with dynamic descriptor slots — descriptor-slot lifetime fix.

<!-- greyfinch-sync:Marvisak/VIctory:review:6053836937 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2200#pullrequestreview-6053836937). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T08:03:07Z. **Review:** COMMENTED --- Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff. Resource references released with dynamic descriptor slots — descriptor-slot lifetime fix.
MamaLeVrai commented 2026-11-25 09:06:22 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by MamaLeVrai on 2026-11-25T08:52:08Z.


Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present, so the hardware-only shader checks run. I merged this PR's head e3ec7843 into main 940d32f in a throwaway tree (no conflict). cargo clippy --workspace --all-targets --locked -- -D warnings: clean; the same with --all-features: clean. cargo test --workspace --locked: 701 passed, 0 failed, 10 ignored, two runs (main alone on the same machine: 701 passed, 0 failed, 10 ignored). The title was not run, so this says nothing about in-game effect. No game data.

AI-assisted (Claude Code); no game data.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7157572613 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2200#issuecomment-7157572613). Originally posted by [MamaLeVrai](https://github.com/MamaLeVrai) on 2026-11-25T08:52:08Z. --- Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present, so the hardware-only shader checks run. I merged this PR's head `e3ec7843` into `main` `940d32f` in a throwaway tree (no conflict). `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean; the same with `--all-features`: clean. `cargo test --workspace --locked`: 701 passed, 0 failed, 10 ignored, two runs (`main` alone on the same machine: 701 passed, 0 failed, 10 ignored). The title was not run, so this says nothing about in-game effect. No game data. AI-assisted (Claude Code); no game data.
Marvisak commented 2026-11-25 14:07:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T13:28:52Z.


Automated triage for the maintainers.

Merge candidate (worth a look). HostHeap::release in descriptor/host.rs now drops the resource references kept by the released dynamic slots (through the same host::retire queue keep uses, factored out as replace_kept), so host copies are no longer held until the slot happens to be reused; the slice it touches is within the count + extra length kept is created with, and the new draw.rs test checks that only the released table's copy goes. CI check passes on this head.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7163838544 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2200#issuecomment-7163838544). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T13:28:52Z. --- <!-- victory-triage v1 head=e3ec7843fdd161e0d7103607febe5a62496cc1dc verdict=merge-candidate at=2026-11-25T13:35:00Z --> Automated triage for the maintainers. **Merge candidate (worth a look).** `HostHeap::release` in `descriptor/host.rs` now drops the resource references kept by the released dynamic slots (through the same `host::retire` queue `keep` uses, factored out as `replace_kept`), so host copies are no longer held until the slot happens to be reused; the slice it touches is within the `count + extra` length `kept` is created with, and the new `draw.rs` test checks that only the released table's copy goes. CI `check` passes on this head. --- _Generated by [Claude Code](https://claude.ai/code)_
upstream-sync closed this pull request 2026-11-25 23:04:01 +00:00
Marvisak commented 2026-11-25 23:05:57 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:06:20Z.


Automated triage for the maintainers, second look (a review against current main, with builds and tests where they could change the verdict).

Closing because it breaks the rule the kept field documents: a slot holds the resource its descriptor names for as long as that descriptor is in the heap. release() does not null the descriptors, so a released dynamic slot would still name a resource that is freed after the next submission, and shaders index heaps directly. On capped heaps, where indices can land in the dynamic range, a stale read that is harmless today would become a GPU page fault. No cost of the current retention is shown.

If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7175941507 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2200#issuecomment-7175941507). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T22:06:20Z. --- Automated triage for the maintainers, second look (a review against current `main`, with builds and tests where they could change the verdict). Closing because it breaks the rule the `kept` field documents: a slot holds the resource its descriptor names for as long as that descriptor is in the heap. `release()` does not null the descriptors, so a released dynamic slot would still name a resource that is freed after the next submission, and shaders index heaps directly. On capped heaps, where indices can land in the dynamic range, a stale read that is harmless today would become a GPU page fault. No cost of the current retention is shown. If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

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
Marvisak/VIctory!2198
No description provided.