GPU: a slot rewritten during a run keeps its view's copy of title memory until the run is over #2293

Open
github-bot wants to merge 2 commits from github-bot/gh-2293 into main AGit
Owner

@⁠denkencar-sketch on GitHub · 2026-11-25 10:05 UTC · original
denkencar-sketch:fix/dhost-001 → main · +34 −5 · 3 files · 2 commits · open

Summary

A descriptor slot rewritten during a run retired only its host buffer; the view's copy of title memory went at once, together with the marks the submission's copy-back still had to read. The copy is now kept until the run is over.

Testing

Test a_rewritten_slot_retires_its_copy_of_title_memory fails on main and passes with this change. The branch has a second, comment-only commit that moves two doc comments back to their items. cargo test --workspace --locked passes apart from known flakes: modules::dstorage::tests::a_page_list_filled_after_its_request_starts fails now and then on main too, and so does a parallel-run flake in victory-gpu's lib tests (watch:: and descriptor::host:: tests, 2 of 40 runs on pristine main).

Not tried: a run in the game. The test depends on the global release_retired.

AI-assisted.

**@⁠denkencar-sketch** on GitHub · 2026-11-25 10:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/2293) `denkencar-sketch:fix/dhost-001` → `main` · +34 −5 · 3 files · 2 commits · open ## Summary A descriptor slot rewritten during a run retired only its host buffer; the view's copy of title memory went at once, together with the marks the submission's copy-back still had to read. The copy is now kept until the run is over. ## Testing Test `a_rewritten_slot_retires_its_copy_of_title_memory` fails on `main` and passes with this change. The branch has a second, comment-only commit that moves two doc comments back to their items. `cargo test --workspace --locked` passes apart from known flakes: `modules::dstorage::tests::a_page_list_filled_after_its_request_starts` fails now and then on `main` too, and so does a parallel-run flake in `victory-gpu`'s lib tests (`watch::` and `descriptor::host::` tests, 2 of 40 runs on pristine `main`). Not tried: a run in the game. The test depends on the global `release_retired`. AI-assisted.
Only the host buffer was retired; the copy went at once, with its marks
the submission's copy-back still had to read.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:01:17 +00:00
Author
Owner

@⁠welisonzika14-jpg on GitHub · 2026-11-25 12:00 UTC · original

First run on NVIDIA hardware here, as far as I can see (the reviews above are static or WARP). RTX 5070 (Blackwell, driver 621.24), Ryzen 7 5700X, Windows 11, Rust 1.98.1 MSVC, no game files. Head 0318c56 merged onto main 940d32f, cargo test -p victory-gpu -p victory-shader --lib --no-fail-fast.

The PR's test descriptor::host::tests::a_rewritten_slot_retires_its_copy_of_title_memory passes on this card. The rest is the same as main on this card: the 5 known NVIDIA failures from #1744 (2 view heap cap tests in victory-gpu, 3 in victory-shader), nothing new.

One run, unit tests only, title not run.

Written with AI help (Claude/Kiro); the numbers are from runs on my machine.

**@⁠welisonzika14-jpg** on GitHub · 2026-11-25 12:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/2293#issuecomment-7161785184) First run on NVIDIA hardware here, as far as I can see (the reviews above are static or WARP). RTX 5070 (Blackwell, driver 621.24), Ryzen 7 5700X, Windows 11, Rust 1.98.1 MSVC, no game files. Head `0318c56` merged onto `main` `940d32f`, `cargo test -p victory-gpu -p victory-shader --lib --no-fail-fast`. The PR's test `descriptor::host::tests::a_rewritten_slot_retires_its_copy_of_title_memory` passes on this card. The rest is the same as `main` on this card: the 5 known NVIDIA failures from #1744 (2 view heap cap tests in `victory-gpu`, 3 in `victory-shader`), nothing new. One run, unit tests only, title not run. Written with AI help (Claude/Kiro); the numbers are from runs on my machine.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 14:51 UTC · original · edited 2026-11-26 03:22 UTC

Automated triage for the maintainers.

Verdict: merge candidate. I reviewed the rebased head ad5440a. HostHeap::keep (crates/victory-gpu/src/descriptor/host.rs) now passes the old slot's Arc<Shadow> to host::retire together with its resource, so the copy outlives the run. This matters because the copy owners in shadow::Marks are Weak, and copy_back_marks (host.rs ~1396) runs before release_retired (~1428). Without the change, a slot rewritten mid-run dropped its copy, and its marked writes were lost. retire has no other callers. The draw.rs test now waits for the release thread, which matches release_later.

Minor: a_rewritten_slot_retires_its_copy_of_title_memory asserts an exact strong_count while other tests may call the global release_retired in parallel. It could flake under the default thread count.

CI: check passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 14:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/2293#issuecomment-7165914070) · edited 2026-11-26 03:22 UTC <!-- victory-triage v1 head=ad5440a91b715b66c87b73bfb75b1140c63458fe verdict=merge-candidate at=2026-11-26T03:22:05Z --> Automated triage for the maintainers. **Verdict: merge candidate.** I reviewed the rebased head `ad5440a`. `HostHeap::keep` (`crates/victory-gpu/src/descriptor/host.rs`) now passes the old slot's `Arc<Shadow>` to `host::retire` together with its resource, so the copy outlives the run. This matters because the copy owners in `shadow::Marks` are `Weak`, and `copy_back_marks` (host.rs ~1396) runs before `release_retired` (~1428). Without the change, a slot rewritten mid-run dropped its copy, and its marked writes were lost. `retire` has no other callers. The `draw.rs` test now waits for the release thread, which matches `release_later`. Minor: `a_rewritten_slot_retires_its_copy_of_title_memory` asserts an exact `strong_count` while other tests may call the global `release_retired` in parallel. It could flake under the default thread count. CI: `check` passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠catminou4 on GitHub · 2026-11-25 10:19 UTC · original · reviewed

A slot rewritten during a run keeps its view's copy of title memory until the work ran (retire(old, copy)). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Lifetime fix with regression test.

**@⁠catminou4** on GitHub · 2026-11-25 10:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2293#pullrequestreview-6055712174) · **reviewed** A slot rewritten during a run keeps its view's copy of title memory until the work ran (retire(old, copy)). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Lifetime fix with regression test.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 15:13 UTC · original · approved these changes

Reviewed descriptor/host.rs, draw.rs, and host.rs at ad5440a9 merged onto origin/main (63bcca43) and verified on RTX 5090 and WARP (VICTORY_D3D12_WARP=1) with VICTORY_D3D12_DEBUG=1.

Lifetime & locking audit

  • Safe retirement & timely drainage: HostHeap::keep (crates/victory-gpu/src/descriptor/host.rs:561) passes both the displaced ID3D12Resource and Option<Arc<Shadow>> to host::retire (crates/victory-gpu/src/host.rs:3677,3683), keeping the shadow copy (and its Weak-referenced Marks entry) alive until Host::submit finishes copy_back_marks and calls release_retired() (host.rs:3688).
  • No lock-held drops: release_retired() swaps RETIRED out with std::mem::take and sends the Vec to the background victory-release thread (release_later), so Arc<Shadow> drops (which lock ARENA/MARKS) happen completely outside both HostHeap::kept and RETIRED, and RETIRED is drained on every submission.
  • Test synchronization: draw.rs:3634-3637 cleanly updates structured_views_off_their_buffers_elements_get_their_own_copy to drain release_retired() and wait for the background release thread. (Minor non-blocking note: a_rewritten_slot_retires_its_copy_of_title_memory at descriptor/host.rs:2095 asserts an exact Arc::strong_count against the process-global RETIRED list, which can contend if another test calls release_retired() concurrently.)
  • Merge compatibility: git merge-tree confirms clean merges with both #2329 and #2298.

Verification

  • cargo run -p xtask -- policy: 191 files ok.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings (default and --all-features): clean.
  • descriptor:: draw:: host:: with VICTORY_D3D12_DEBUG=1: 62/62 passed on RTX 5090 (skipping dynamic_slots_are_held_until_released) and 63/63 passed on WARP (--features diagnostics, skipping the pre-existing main compositor_failure_presents_primary_in_the_same_frame Debug Layer mismatch), including a_rewritten_slot_retires_its_copy_of_title_memory (descriptor/host.rs:2095) and structured_views_off_their_buffers_elements_get_their_own_copy.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 15:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/2293#pullrequestreview-6076555016) · **approved these changes** Reviewed `descriptor/host.rs`, `draw.rs`, and `host.rs` at `ad5440a9` merged onto `origin/main` (`63bcca43`) and verified on RTX 5090 and WARP (`VICTORY_D3D12_WARP=1`) with `VICTORY_D3D12_DEBUG=1`. ### Lifetime & locking audit - **Safe retirement & timely drainage**: `HostHeap::keep` (`crates/victory-gpu/src/descriptor/host.rs:561`) passes both the displaced `ID3D12Resource` and `Option<Arc<Shadow>>` to `host::retire` (`crates/victory-gpu/src/host.rs:3677,3683`), keeping the shadow copy (and its `Weak`-referenced `Marks` entry) alive until `Host::submit` finishes `copy_back_marks` and calls `release_retired()` (`host.rs:3688`). - **No lock-held drops**: `release_retired()` swaps `RETIRED` out with `std::mem::take` and sends the `Vec` to the background `victory-release` thread (`release_later`), so `Arc<Shadow>` drops (which lock `ARENA`/`MARKS`) happen completely outside both `HostHeap::kept` and `RETIRED`, and `RETIRED` is drained on every submission. - **Test synchronization**: `draw.rs:3634-3637` cleanly updates `structured_views_off_their_buffers_elements_get_their_own_copy` to drain `release_retired()` and wait for the background release thread. (Minor non-blocking note: `a_rewritten_slot_retires_its_copy_of_title_memory` at `descriptor/host.rs:2095` asserts an exact `Arc::strong_count` against the process-global `RETIRED` list, which can contend if another test calls `release_retired()` concurrently.) - **Merge compatibility**: `git merge-tree` confirms clean merges with both `#2329` and `#2298`. ### Verification - `cargo run -p xtask -- policy`: 191 files ok. - `cargo clippy -p victory-gpu --all-targets -- -D warnings` (default and `--all-features`): clean. - `descriptor:: draw:: host::` with `VICTORY_D3D12_DEBUG=1`: **62/62 passed** on RTX 5090 (skipping `dynamic_slots_are_held_until_released`) and **63/63 passed** on WARP (`--features diagnostics`, skipping the pre-existing `main` `compositor_failure_presents_primary_in_the_same_frame` Debug Layer mismatch), including `a_rewritten_slot_retires_its_copy_of_title_memory` (`descriptor/host.rs:2095`) and `structured_views_off_their_buffers_elements_get_their_own_copy`.
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/2293/head:github-bot/gh-2293'
git switch 'github-bot/gh-2293'

Merge

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