GPU: retain and retire released host textures, staging, shadow buffers, and descriptor resources across submissions #609

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

@⁠LAKSHYA-cmd-tech on GitHub · 2026-11-24 05:34 UTC · original
LAKSHYA-cmd-tech:fix/gpu-deferred-resource-retirement → main · +246 −64 · 5 files · 1 commits · open

Summary

Fixes #557.

When the title streams textures or reuses title buffer ranges, it drops CPU-side objects as soon as recording completes. On PC D3D12, dropping the corresponding host resources immediately deallocates GPU virtual address ranges and underlying physical memory, while GPU work (particularly multi-list submissions, indirect draws, and mesh ExecuteIndirect dispatches reading via descriptor tables) may still be executing or queued on the GPU. This resulted in DRED page faults:

page fault at 0x3a5f76000; inside freed ["texture 1024x1024 f98 flags 0x0 (type 34)"]

Root Cause & Solution

  1. HostTexture drop path: Resource dropped self.host: Option<Arc<HostTexture>>. When no active command list named the texture (e.g. indirect mesh draws or compute shaders reading via bindless descriptor heaps), HostTexture was freed immediately on the CPU. Implemented Drop for HostTexture to forward its ID3D12Resource to crate::host::release_late.
  2. Staging buffer drop path: texture::forget removed entries from STAGING, dropping Staging and releasing upload buffers while CopyTextureRegion might still be in-flight. Implemented Drop for Staging to forward its buffer to release_late.
  3. Shadow buffer drop path: shadow::unregister dropped title buffer shadows. Implemented Drop for Shadow to forward shadow.buffer to release_late.
  4. HostHeap descriptor slot replacement: HostHeap::keep now routes displaced resources to release_late instead of inline CPU destruction.
  5. Deferred Retirement Queue: Implemented RETIREMENT_QUEUE in crates/victory-gpu/src/host.rs with a submission retirement window (RETAIN_SUBMISSIONS = 3). Resources are held across multi-list submissions and drained only after the GPU fence has confirmed execution past their retirement window.

Verification

  • Unit test host::tests::deferred_retirement_retains_resources_across_submissions added and passing.
  • cargo test -p victory-gpu -- --test-threads=1: 44 passed, 0 failed, 1 ignored.
  • cargo clippy -p victory-gpu --lib -- -D warnings: 0 warnings.
  • cargo clippy -p victory-gpu --features diagnostics --lib -- -D warnings: 0 warnings.
  • cargo run -p xtask -- policy: 151 files ok.
**@⁠LAKSHYA-cmd-tech** on GitHub · 2026-11-24 05:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/609) `LAKSHYA-cmd-tech:fix/gpu-deferred-resource-retirement` → `main` · +246 −64 · 5 files · 1 commits · open ## Summary Fixes #557. When the title streams textures or reuses title buffer ranges, it drops CPU-side objects as soon as recording completes. On PC D3D12, dropping the corresponding host resources immediately deallocates GPU virtual address ranges and underlying physical memory, while GPU work (particularly multi-list submissions, indirect draws, and mesh `ExecuteIndirect` dispatches reading via descriptor tables) may still be executing or queued on the GPU. This resulted in DRED page faults: ``` page fault at 0x3a5f76000; inside freed ["texture 1024x1024 f98 flags 0x0 (type 34)"] ``` ## Root Cause & Solution 1. **HostTexture drop path**: `Resource` dropped `self.host: Option<Arc<HostTexture>>`. When no active command list named the texture (e.g. indirect mesh draws or compute shaders reading via bindless descriptor heaps), `HostTexture` was freed immediately on the CPU. Implemented `Drop for HostTexture` to forward its `ID3D12Resource` to `crate::host::release_late`. 2. **Staging buffer drop path**: `texture::forget` removed entries from `STAGING`, dropping `Staging` and releasing upload buffers while `CopyTextureRegion` might still be in-flight. Implemented `Drop for Staging` to forward its buffer to `release_late`. 3. **Shadow buffer drop path**: `shadow::unregister` dropped title buffer shadows. Implemented `Drop for Shadow` to forward `shadow.buffer` to `release_late`. 4. **HostHeap descriptor slot replacement**: `HostHeap::keep` now routes displaced resources to `release_late` instead of inline CPU destruction. 5. **Deferred Retirement Queue**: Implemented `RETIREMENT_QUEUE` in `crates/victory-gpu/src/host.rs` with a submission retirement window (`RETAIN_SUBMISSIONS = 3`). Resources are held across multi-list submissions and drained only after the GPU fence has confirmed execution past their retirement window. ## Verification - Unit test `host::tests::deferred_retirement_retains_resources_across_submissions` added and passing. - `cargo test -p victory-gpu -- --test-threads=1`: 44 passed, 0 failed, 1 ignored. - `cargo clippy -p victory-gpu --lib -- -D warnings`: 0 warnings. - `cargo clippy -p victory-gpu --features diagnostics --lib -- -D warnings`: 0 warnings. - `cargo run -p xtask -- policy`: 151 files ok.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:09:54 +00:00
Author
Owner

@⁠fromthemoonx on GitHub · 2026-11-24 09:41 UTC · original

Tested 6d8c72b merged onto current main (8e79c80, merges cleanly) on NVIDIA.

Environment: Windows 11 Pro build 26300, AMD Ryzen 7 5700X, 16 GB, NVIDIA GeForce RTX 3060 12 GB (driver 610.88), Rust 1.98.1 x86_64-pc-windows-msvc.

CI's commands, on the merge

  • cargo clippy --workspace --all-targets --locked -- -D warnings: clean
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: clean
  • cargo test --workspace --locked: 312 passed, 0 failed, 6 ignored
  • cargo test -p victory-gpu --lib in parallel, 15 runs: all passed, including deferred_retirement_retains_resources_across_submissions

One problem: release_late takes the submission lock. current_submission() reads the counter through host.submitted.lock(), and Host::execute holds that same Mutex from preparation through the GPU wait to copy-back. Now that Drop for HostTexture, Drop for Shadow and Drop for Staging call release_late, a release waits for whatever submission is in flight. A throwaway test (not pushed) shows both cases on the merge:

result
another thread calls release_late while the lock is held for 500 ms (standing in for a submission's GPU wait) returned after 500 ms
a thread already holding the lock calls release_late did not return (3 s timeout): std::sync::Mutex is not reentrant
  • The first case is reachable today. A title thread that releases a texture, or unregisters a buffer shadow, while another thread submits now stalls until that submission's GPU work has finished. In the world that's 0.5–1.8 s per frame by the README.
  • The second case is latent. I didn't find a path in execute that drops the last Arc of one of these objects (the Shadow clones in back are also held by the lists' deferred steps). But anything added to execute later that does would deadlock.
  • A lock-free read would avoid both: a separate AtomicU64 bumped next to *submitted += 1, or the fence's GetCompletedValue() for the drain.

Smaller notes

  • About 170 of the changed lines in host.rs are rustfmt reflow of code this PR doesn't otherwise touch (SUBMISSION_US, COPY_BACK, the timing and DRED helpers, mod batch). It does reduce cargo fmt --check output for the crate (82 → 45 places), but it hides the actual change and will conflict with the other open PRs in host.rs.
  • The test checks that a released buffer is queued with retire_at == sub + 3 and is still queued after one submission. It doesn't cover the drain (that the resource is dropped once the window passes) or that the Drop impls route through release_late.

Not tested: the DRED page fault from #557 (needs the title); no game data used.

AI-assisted (Claude Code) ran the checks and drafted this comment.

**@⁠fromthemoonx** on GitHub · 2026-11-24 09:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/609#issuecomment-7127748588) Tested `6d8c72b` merged onto current `main` (`8e79c80`, merges cleanly) on NVIDIA. **Environment:** Windows 11 Pro build 26300, AMD Ryzen 7 5700X, 16 GB, NVIDIA GeForce RTX 3060 12 GB (driver 610.88), Rust 1.98.1 `x86_64-pc-windows-msvc`. **CI's commands, on the merge** - `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: clean - `cargo test --workspace --locked`: 312 passed, 0 failed, 6 ignored - `cargo test -p victory-gpu --lib` in parallel, 15 runs: all passed, including `deferred_retirement_retains_resources_across_submissions` **One problem: `release_late` takes the submission lock.** `current_submission()` reads the counter through `host.submitted.lock()`, and `Host::execute` holds that same `Mutex` from preparation through the GPU wait to copy-back. Now that `Drop for HostTexture`, `Drop for Shadow` and `Drop for Staging` call `release_late`, a release waits for whatever submission is in flight. A throwaway test (not pushed) shows both cases on the merge: | | result | |---|---| | another thread calls `release_late` while the lock is held for 500 ms (standing in for a submission's GPU wait) | returned after **500 ms** | | a thread already holding the lock calls `release_late` | **did not return** (3 s timeout): `std::sync::Mutex` is not reentrant | - **The first case is reachable today.** A title thread that releases a texture, or unregisters a buffer shadow, while another thread submits now stalls until that submission's GPU work has finished. In the world that's 0.5–1.8 s per frame by the README. - **The second case is latent.** I didn't find a path in `execute` that drops the last `Arc` of one of these objects (the `Shadow` clones in `back` are also held by the lists' deferred steps). But anything added to `execute` later that does would deadlock. - **A lock-free read would avoid both:** a separate `AtomicU64` bumped next to `*submitted += 1`, or the fence's `GetCompletedValue()` for the drain. **Smaller notes** - About 170 of the changed lines in `host.rs` are rustfmt reflow of code this PR doesn't otherwise touch (`SUBMISSION_US`, `COPY_BACK`, the timing and DRED helpers, `mod batch`). It does reduce `cargo fmt --check` output for the crate (82 → 45 places), but it hides the actual change and will conflict with the other open PRs in `host.rs`. - The test checks that a released buffer is queued with `retire_at == sub + 3` and is still queued after one submission. It doesn't cover the drain (that the resource is dropped once the window passes) or that the `Drop` impls route through `release_late`. **Not tested:** the DRED page fault from #557 (needs the title); no game data used. AI-assisted (Claude Code) ran the checks and drafted this comment.
Author
Owner

@⁠d1ll3x3 on GitHub · 2026-11-24 09:49 UTC · original

checked: #609 on RDNA3 | base: main@8e79c80 + #609 + #568 + #67 (applied locally; one conflict with #568 in descriptor/host.rs describe_slot, resolved with #568's SlotState version) | on: Windows 11, RX 7800 XT (RDNA3, 16 GB), 32 GB RAM, diag build, VICTORY_D3D12_DRED=1, Xbox Series 1.0.2.1

result: the first mission's intro cutscene runs (0–1 fps), then the device is removed after 5 min 16 s with the signature #609 targets:

page fault at 0x4070ab000; inside freed ["texture 2048x1024 f72 flags 0x0 (type 34)", "texture 2048x2048 f72 flags 0x0 (type 34)"]
stopped at command 11 of 25 (op 6): dispatch 128x64x1 [compute 2dc602192abf6288]

At 0–1 fps the cutscene makes about 13 submissions a frame, so RETAIN_SUBMISSIONS = 3 is a fraction of a frame. Raising it locally to 512 (about 40 frames) did not help: removed after 2 min 39 s, inside freed ["texture 2048x2048 f98 …"], DRED stopped at command 418 of 562 (op 15), a ResourceBarrier. Earlier stops on other bases were op 8 (CopyTextureRegion) and op 6 (Dispatch). So some freed textures are named directly by recorded commands (barriers, copies), not only through heap slots, and a longer window does not cover them.

For comparison on the same machine and base, #431 + #568 + #67 (without #609) ran 11 min 39 s; details on #431.

Run-to-run duration varies (2.5–6 min with the same build), so treat the timings as a weak signal.

AI-assisted (Claude Code).

**@⁠d1ll3x3** on GitHub · 2026-11-24 09:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/609#issuecomment-7127932846) checked: #609 on RDNA3 | base: `main@8e79c80` + #609 + #568 + #67 (applied locally; one conflict with #568 in `descriptor/host.rs` `describe_slot`, resolved with #568's `SlotState` version) | on: Windows 11, RX 7800 XT (RDNA3, 16 GB), 32 GB RAM, diag build, `VICTORY_D3D12_DRED=1`, Xbox Series 1.0.2.1 result: the first mission's intro cutscene runs (0–1 fps), then the device is removed after 5 min 16 s with the signature #609 targets: ``` page fault at 0x4070ab000; inside freed ["texture 2048x1024 f72 flags 0x0 (type 34)", "texture 2048x2048 f72 flags 0x0 (type 34)"] stopped at command 11 of 25 (op 6): dispatch 128x64x1 [compute 2dc602192abf6288] ``` At 0–1 fps the cutscene makes about 13 submissions a frame, so `RETAIN_SUBMISSIONS = 3` is a fraction of a frame. Raising it locally to 512 (about 40 frames) did **not** help: removed after 2 min 39 s, `inside freed ["texture 2048x2048 f98 …"]`, DRED stopped at `command 418 of 562 (op 15)`, a ResourceBarrier. Earlier stops on other bases were op 8 (CopyTextureRegion) and op 6 (Dispatch). So some freed textures are named directly by recorded commands (barriers, copies), not only through heap slots, and a longer window does not cover them. For comparison on the same machine and base, #431 + #568 + #67 (without #609) ran 11 min 39 s; details on #431. Run-to-run duration varies (2.5–6 min with the same build), so treat the timings as a weak signal. AI-assisted (Claude Code).
Author
Owner

@⁠dpalacios69 on GitHub · 2026-11-24 09:57 UTC · original

Thanks for putting this together! Looking through the diff, locking Host::submitted inside current_submission() introduces two deadlocks and heavy lock contention that should be fixed before this can land:

  1. Same-thread self-deadlock in Host::execute (crates/victory-gpu/src/host.rs):
    Host::execute acquires let mut submitted = self.submitted.lock()... at line 550 and holds it until the end of the function (line 689). back: Vec<(Arc<Shadow>, usize, usize)> is declared later (line 655), so Rust drops back before submitted. Whenever back holds the last Arc<Shadow> (for example, if a title thread unregisters the buffer and resets the command list after the bottom-of-pipe completion writes at lines 673–677), dropping back at line 689 triggers Shadow::drop → release_late → current_submission() → h.submitted.lock() on the same thread already holding the non-reentrant Mutex, deadlocking permanently. The same applies to any Arc<Shadow>, HostTexture, or Staging dropped while Host::execute holds submitted.

  2. AB-BA deadlock between shadow::BUFFERS and Host::submitted:

    • shadow::unregister (shadow.rs:401) runs buffers().remove(&(start, resource));, which drops the removed Entry (and thus Shadow::drop → release_late → host.submitted.lock()) before the temporary MutexGuard on BUFFERS is released (BUFFERS → Host::submitted).
    • On device removal, Host::execute holds Host::submitted while calling self.removal_data(runs) → shadow::near(va) (shadow.rs:472), which acquires BUFFERS (Host::submitted → BUFFERS).
      If a title thread unregisters a buffer during a GPU hang, DRED reporting can hang permanently instead of logging the crash.
  3. Contention against the GPU fence wait:
    Because Host::submitted is held across WaitForSingleObject(self.event, INFINITE), calling h.submitted.lock() in current_submission() stalls any worker thread releasing a texture/shadow/staging buffer or overwriting a descriptor slot (HostHeap::mirror holds HostHeap::made across keep/release_late) for the entire duration of the GPU submission.

    Suggested fix for (1)–(3): Mirror the submission counter in a separate AtomicU64 (updated when *submitted += 1 and loaded in current_submission() without locking Host::submitted), and drop the submitted guard before back/to_drop.

  4. A few smaller notes:

    • #557 status: As reported in #557 (e.g. by @⁠KingKaom and @⁠h0useadv on RX 9070 XT), runs with #609 applied still hit the same freed-texture page fault, so please drop Fixes #557 from the PR body so merging doesn't auto-close the issue.
    • VICTORY_GPU_TIMING edge case: When timing() is enabled (host.rs:516–528 on base), *submitted increments once per list in groups rather than once per execute(), so a multi-list submission advances past RETAIN_SUBMISSIONS = 3 immediately.
    • Unit test: deferred_retirement_retains_resources_across_submissions checks retention after 1 submission, but doesn't verify that the resource is actually drained once the 3-submission window passes.
    • Formatting churn: Most hunks in host.rs (14/17) and descriptor/host.rs (9/10) are unrelated rustfmt reflows—reverting those would make the diff much easier to review.

Static code review only (not executed on hardware); AI-assisted.

**@⁠dpalacios69** on GitHub · 2026-11-24 09:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/609#issuecomment-7128112541) Thanks for putting this together! Looking through the diff, locking `Host::submitted` inside `current_submission()` introduces two deadlocks and heavy lock contention that should be fixed before this can land: 1. **Same-thread self-deadlock in `Host::execute` (`crates/victory-gpu/src/host.rs`):** `Host::execute` acquires `let mut submitted = self.submitted.lock()...` at line 550 and holds it until the end of the function (line 689). `back: Vec<(Arc<Shadow>, usize, usize)>` is declared later (line 655), so Rust drops `back` **before** `submitted`. Whenever `back` holds the last `Arc<Shadow>` (for example, if a title thread unregisters the buffer and resets the command list after the bottom-of-pipe completion writes at lines 673–677), dropping `back` at line 689 triggers `Shadow::drop` → `release_late` → `current_submission()` → `h.submitted.lock()` on the same thread already holding the non-reentrant `Mutex`, deadlocking permanently. The same applies to any `Arc<Shadow>`, `HostTexture`, or `Staging` dropped while `Host::execute` holds `submitted`. 2. **AB-BA deadlock between `shadow::BUFFERS` and `Host::submitted`:** - `shadow::unregister` (`shadow.rs:401`) runs `buffers().remove(&(start, resource));`, which drops the removed `Entry` (and thus `Shadow::drop` → `release_late` → `host.submitted.lock()`) **before** the temporary `MutexGuard` on `BUFFERS` is released (`BUFFERS` → `Host::submitted`). - On device removal, `Host::execute` holds `Host::submitted` while calling `self.removal_data(runs)` → `shadow::near(va)` (`shadow.rs:472`), which acquires `BUFFERS` (`Host::submitted` → `BUFFERS`). If a title thread unregisters a buffer during a GPU hang, DRED reporting can hang permanently instead of logging the crash. 3. **Contention against the GPU fence wait:** Because `Host::submitted` is held across `WaitForSingleObject(self.event, INFINITE)`, calling `h.submitted.lock()` in `current_submission()` stalls any worker thread releasing a texture/shadow/staging buffer or overwriting a descriptor slot (`HostHeap::mirror` holds `HostHeap::made` across `keep`/`release_late`) for the entire duration of the GPU submission. **Suggested fix for (1)–(3):** Mirror the submission counter in a separate `AtomicU64` (updated when `*submitted += 1` and loaded in `current_submission()` without locking `Host::submitted`), and drop the `submitted` guard before `back`/`to_drop`. 4. **A few smaller notes:** - **#557 status:** As reported in #557 (e.g. by @⁠KingKaom and @⁠h0useadv on RX 9070 XT), runs with #609 applied still hit the same freed-texture page fault, so please drop `Fixes #557` from the PR body so merging doesn't auto-close the issue. - **`VICTORY_GPU_TIMING` edge case:** When `timing()` is enabled (`host.rs:516–528` on base), `*submitted` increments once per list in `groups` rather than once per `execute()`, so a multi-list submission advances past `RETAIN_SUBMISSIONS = 3` immediately. - **Unit test:** `deferred_retirement_retains_resources_across_submissions` checks retention after 1 submission, but doesn't verify that the resource is actually drained once the 3-submission window passes. - **Formatting churn:** Most hunks in `host.rs` (14/17) and `descriptor/host.rs` (9/10) are unrelated `rustfmt` reflows—reverting those would make the diff much easier to review. Static code review only (not executed on hardware); AI-assisted.
Author
Owner

@⁠justr4mzi on GitHub · 2026-11-24 10:03 UTC · original

Tested PR #609 (6d8c72bc) integrated cleanly onto main (8e79c80) inside a 13-PR combined stack on Windows 11 with an AMD Radeon RX 6700 XT (RDNA2) and Rust 1.98.1 (x86_64-pc-windows-msvc).

  • Clean merge alongside #688, #652, #346, #472, and #677 (plus 7 shader PRs).
  • cargo test -p victory-gpu -- --test-threads=1: 64 passed, 0 failed, 1 ignored (host::tests::deferred_retirement_retains_resources_across_submissions passes); --features diagnostics: 67 passed, 0 failed, 1 ignored.
  • Full workspace (cargo test --workspace -- --test-threads=1): 329 passed, 0 failed, 6 ignored; cargo xtask policy: 155 files ok.
  • Full combined stack notes: #49
  • Not yet tested against a live title launch (no game data included).

AI-assisted verification and stack testing (reviewed locally).

**@⁠justr4mzi** on GitHub · 2026-11-24 10:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/609#issuecomment-7128261346) Tested PR #609 (`6d8c72bc`) integrated cleanly onto `main` (`8e79c80`) inside a 13-PR combined stack on Windows 11 with an AMD Radeon RX 6700 XT (RDNA2) and Rust 1.98.1 (`x86_64-pc-windows-msvc`). - Clean merge alongside `#688`, `#652`, `#346`, `#472`, and `#677` (plus 7 shader PRs). - `cargo test -p victory-gpu -- --test-threads=1`: **64 passed, 0 failed, 1 ignored** (`host::tests::deferred_retirement_retains_resources_across_submissions` passes); `--features diagnostics`: **67 passed, 0 failed, 1 ignored**. - Full workspace (`cargo test --workspace -- --test-threads=1`): **329 passed, 0 failed, 6 ignored**; `cargo xtask policy`: `155 files ok`. - Full combined stack notes: https://git.gtahub.st/github/Marvisak--VIctory/issues/49 - Not yet tested against a live title launch (no game data included). *AI-assisted verification and stack testing (reviewed locally).*
Author
Owner

@⁠rpmaster2 on GitHub · 2026-11-24 10:06 UTC · original · edited 2026-11-24 12:31 UTC

Tested on RDNA4: Radeon RX 9070 XT 16 GB, Adrenalin 26.11.2 (32.0.32029.2010), Windows 11 26300, Ryzen 5 5600, 32 GB RAM. Diag build, VICTORY_D3D12_DRED=1, this branch merged on main @⁠58fed37, 480 s runs, the same save restored before each run.

A/B, identical start state:

build crash after lists in the failing submission max frame
main 1m39s 30 1091
this PR 3m21s 11 1186

Both end in host GPU device removed, and both are a page fault inside a freed host texture:

  • main: page fault at 0x4721d6000; inside freed ["texture 1024x1024 f95 flags 0x0 (type 34)", "texture 1024x1024 f83 flags 0x0 (type 34)"]
  • this PR: page fault at 0x55c25c000; inside freed ["texture 1024x1024 f98 flags 0x0 (type 34)", "texture 1024x1024 f78 flags 0x0 (type 34)"]

The PR does get further: in the same window it wrote a new checkpoint save, and main wrote none. But the removal is unchanged, so on this host it is not the whole of #557.

Context from six earlier runs (3x main, 2x #688, 1x this PR before the A/B): all died the same way, with 1024x1024 f98/f99/f95/f83, 1024x2048 f98, 2048x2048 f98, 512x512 f29 and 256x256 f99, always type 34. In two runs the stopped list was 7d85c9cab3c80721, whose tables come from shader f0c7efd2aceb2aaa and name placed SRVs. The log also reports a title texture was released while a list not yet reset names its host copy before the removal, which is the path this PR targets.

One correction to my earlier wording in #597, in case it misled anyone: the view heap ... past its end text in the DRED line is only where the fault address lies relative to the heaps (a texture is outside them, so it always prints that); it is not evidence of a wrong heap handle. The meaningful part is inside freed [...].

The crash is deterministic here (every run within 8 minutes, frames 1090-1290), so any probe is easy to check. If you want, I can run with extra logging you point me at, or capture the draws of the stopped list.

No game data: texture sizes, formats, shader hashes and counters only.

AI-assisted: written by DeepSeek (OpenCode harness) from my run logs and observations; the hardware, the dump and the runs are mine.

**@⁠rpmaster2** on GitHub · 2026-11-24 10:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/609#issuecomment-7128331883) · edited 2026-11-24 12:31 UTC Tested on RDNA4: Radeon RX 9070 XT 16 GB, Adrenalin 26.11.2 (32.0.32029.2010), Windows 11 26300, Ryzen 5 5600, 32 GB RAM. Diag build, `VICTORY_D3D12_DRED=1`, this branch merged on `main` @⁠58fed37, 480 s runs, the same save restored before each run. A/B, identical start state: | build | crash after | lists in the failing submission | max frame | | --- | --- | --- | --- | | `main` | 1m39s | 30 | 1091 | | this PR | 3m21s | 11 | 1186 | Both end in `host GPU device removed`, and both are a page fault inside a freed host texture: - `main`: `page fault at 0x4721d6000; inside freed ["texture 1024x1024 f95 flags 0x0 (type 34)", "texture 1024x1024 f83 flags 0x0 (type 34)"]` - this PR: `page fault at 0x55c25c000; inside freed ["texture 1024x1024 f98 flags 0x0 (type 34)", "texture 1024x1024 f78 flags 0x0 (type 34)"]` The PR does get further: in the same window it wrote a new checkpoint save, and `main` wrote none. But the removal is unchanged, so on this host it is not the whole of #557. Context from six earlier runs (3x `main`, 2x #688, 1x this PR before the A/B): all died the same way, with 1024x1024 f98/f99/f95/f83, 1024x2048 f98, 2048x2048 f98, 512x512 f29 and 256x256 f99, always `type 34`. In two runs the stopped list was `7d85c9cab3c80721`, whose tables come from shader `f0c7efd2aceb2aaa` and name placed SRVs. The log also reports `a title texture was released while a list not yet reset names its host copy` before the removal, which is the path this PR targets. One correction to my earlier wording in #597, in case it misled anyone: the `view heap ... past its end` text in the DRED line is only where the *fault address* lies relative to the heaps (a texture is outside them, so it always prints that); it is not evidence of a wrong heap handle. The meaningful part is `inside freed [...]`. The crash is deterministic here (every run within 8 minutes, frames 1090-1290), so any probe is easy to check. If you want, I can run with extra logging you point me at, or capture the draws of the stopped list. No game data: texture sizes, formats, shader hashes and counters only. AI-assisted: written by DeepSeek (OpenCode harness) from my run logs and observations; the hardware, the dump and the runs are mine.
Author
Owner

@⁠rpmaster2 on GitHub · 2026-11-24 10:25 UTC · original · edited 2026-11-24 12:31 UTC

More data, and it does not support the window being the problem.

I built this branch locally with RETAIN_SUBMISSIONS = 64 instead of 3 (no other change) and ran it from the same restored save:

build window run result
main - 1 removed at 1m39s
this PR 3 1 removed at 3m21s
this PR, local 64 1 alive for 8m (killed), 19 black frames, 0.4-2 fps
this PR, local 64 2 removed at 2m44s

The 64-window removal has the same signature again: page fault at 0x473c99000; inside freed ["texture 1024x2048 f72 flags 0x0 (type 34)"], 30 lists.

So a 64-submission window makes the removal rarer in one run and not in the next; the stale reference either outlives a much longer window than 3, or it comes from a path that does not go through release_late at all. Both would explain why the crash moved from 1m39s to 3m21s with this PR but never disappeared.

If it is useful, I can instrument locally: print every release_late and HostHeap::keep with the resource size and format, plus the slot writes for 1024x1024 f95/f98/f99/f83 and 1024x2048 f72/f98 (the formats that keep faulting here), then correlate with the stopped list 7d85c9cab3c80721. Tell me which log you want and I will produce it - the crash is still reproducible within a few minutes.

No game data: sizes, formats, hashes, counters only.

AI-assisted: written by DeepSeek (OpenCode harness) from my run logs and observations; the hardware, the dump and the runs are mine.

**@⁠rpmaster2** on GitHub · 2026-11-24 10:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/609#issuecomment-7128770986) · edited 2026-11-24 12:31 UTC More data, and it does not support the window being the problem. I built this branch locally with `RETAIN_SUBMISSIONS = 64` instead of 3 (no other change) and ran it from the same restored save: | build | window | run | result | | --- | --- | --- | --- | | main | - | 1 | removed at 1m39s | | this PR | 3 | 1 | removed at 3m21s | | this PR, local | 64 | 1 | alive for 8m (killed), 19 black frames, 0.4-2 fps | | this PR, local | 64 | 2 | removed at 2m44s | The 64-window removal has the same signature again: `page fault at 0x473c99000; inside freed ["texture 1024x2048 f72 flags 0x0 (type 34)"]`, 30 lists. So a 64-submission window makes the removal rarer in one run and not in the next; the stale reference either outlives a much longer window than 3, or it comes from a path that does not go through `release_late` at all. Both would explain why the crash moved from 1m39s to 3m21s with this PR but never disappeared. If it is useful, I can instrument locally: print every `release_late` and `HostHeap::keep` with the resource size and format, plus the slot writes for `1024x1024 f95/f98/f99/f83` and `1024x2048 f72/f98` (the formats that keep faulting here), then correlate with the stopped list `7d85c9cab3c80721`. Tell me which log you want and I will produce it - the crash is still reproducible within a few minutes. No game data: sizes, formats, hashes, counters only. AI-assisted: written by DeepSeek (OpenCode harness) from my run logs and observations; the hardware, the dump and the runs are mine.
Author
Owner

@⁠Daniel333313131 on GitHub · 2026-11-24 20:02 UTC · original

Tested on AMD (RDNA3), where main faults on freed textures in the world. With this PR the freed-resource faults remain, in all three runs.

Setup: AMD Radeon RX 7900 XTX 24 GB, driver 32.0.32029.2010; Ryzen 7 9800X3D, 32 GB; Windows 11 10.0.26300. Diag build of this PR's head 6d8c72b merged alone onto main ffe310e, compared with main itself. Each run used its own empty VICTORY_CACHE_DIR, VICTORY_D3D12_DRED=1, and VICTORY_KEYS set to Enter every 3 s from 8 s to 47 s. Each run was stopped after 180 s. Method and main numbers as in #400.

run world ms/frame watches on the GPU device removed DRED
main 1 972 140 ms 178 143 s page fault inside freed texture 2048x2048 f98 (type 34) ×2
main 2 873 139 ms 179 170 s page fault, no resource named
main 3 679 86 ms 157 76 s page fault inside freed texture 2048x1024 f98 (type 34)
#609 1 1430 34 ms 265 75 s page fault inside freed title buffer 0xcbb800000+0x455d80 (type 34)
#609 2 1089 38 ms 186 89 s page fault inside freed texture 2048x2048 f98 (type 34)
#609 3 1005 32 ms 148 114 s page fault inside freed texture 2048x2048 f99 (type 34)
  • Every run with #609 still ends in a fault inside a freed resource. All three runs were removed earlier than main's median.
  • Write-watch time per frame drops clearly, from 86–140 ms to 32–38 ms. Whole frames are not shorter, though, because GPU time and the unaccounted part grow in the early world frames.
  • Caveat: there are few world lines per run (5, 7 and 11) because removal came early, and three runs per side.

For comparison, #431 on the same machine and method had no freed-resource fault in three runs, and two of them lasted the full 180 s. Details are on that PR.

AI use: Claude Code (Claude Opus 5.5) merged and built the commits, ran the title, summarised the log lines and wrote this comment. The numbers come from the runs above.

**@⁠Daniel333313131** on GitHub · 2026-11-24 20:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/609#issuecomment-7142958356) Tested on AMD (RDNA3), where `main` faults on freed textures in the world. With this PR the freed-resource faults remain, in all three runs. **Setup:** AMD Radeon RX 7900 XTX 24 GB, driver 32.0.32029.2010; Ryzen 7 9800X3D, 32 GB; Windows 11 10.0.26300. Diag build of this PR's head `6d8c72b` merged alone onto `main` `ffe310e`, compared with `main` itself. Each run used its own empty `VICTORY_CACHE_DIR`, `VICTORY_D3D12_DRED=1`, and `VICTORY_KEYS` set to Enter every 3 s from 8 s to 47 s. Each run was stopped after 180 s. Method and `main` numbers as in https://git.gtahub.st/github/Marvisak--VIctory/issues/400. | | run | world ms/frame | watches | on the GPU | device removed | DRED | |---|---|---|---|---|---|---| | `main` | 1 | 972 | 140 ms | 178 | 143 s | page fault inside freed `texture 2048x2048 f98 (type 34)` ×2 | | `main` | 2 | 873 | 139 ms | 179 | 170 s | page fault, no resource named | | `main` | 3 | 679 | 86 ms | 157 | 76 s | page fault inside freed `texture 2048x1024 f98 (type 34)` | | **#609** | 1 | 1430 | 34 ms | 265 | 75 s | page fault inside freed `title buffer 0xcbb800000+0x455d80 (type 34)` | | **#609** | 2 | 1089 | 38 ms | 186 | 89 s | page fault inside freed `texture 2048x2048 f98 (type 34)` | | **#609** | 3 | 1005 | 32 ms | 148 | 114 s | page fault inside freed `texture 2048x2048 f99 (type 34)` | - Every run with #609 still ends in a fault inside a freed resource. All three runs were removed earlier than `main`'s median. - Write-watch time per frame drops clearly, from 86–140 ms to 32–38 ms. Whole frames are not shorter, though, because GPU time and the unaccounted part grow in the early world frames. - Caveat: there are few world lines per run (5, 7 and 11) because removal came early, and three runs per side. For comparison, #431 on the same machine and method had no freed-resource fault in three runs, and two of them lasted the full 180 s. Details are on that PR. **AI use:** Claude Code (Claude Opus 5.5) merged and built the commits, ran the title, summarised the log lines and wrote this comment. The numbers come from the runs above.
Author
Owner

@⁠J-DB0 on GitHub · 2026-11-24 21:35 UTC · original

Tested this PR (head 6d8c72b) on an RX 9070 XT (RDNA 4) with an i5-14600KF, in a diag build with VICTORY_D3D12_DRED=1.

It doesn't stop the world crash on this card. On main and with this PR alike, the title loads into the world, runs for a while, then the device is removed by a page fault inside freed textures while mesh shaders draw:

  • main: page fault at 0x486bfc000; inside freed ["texture 1024x1024 f99 flags 0x0 (type 34)"], a list stopped at command 2183 of 3383 (op 42), around draws of [mesh f0c7efd2aceb2aaa, pixel 7d85c9cab3c80721]
  • this PR: page fault at 0x46356f000; inside freed ["texture 2048x2048 f71 flags 0x0 (type 34)", "texture 2048x2048 f71 flags 0x0 (type 34)", "texture 2048x1024 f99 flags 0x0 (type 34)"], a list stopped at command 788 of 856 (op 42), mostly draws of [mesh 51ff151f75cd5759, pixel 7fe75645c406cac6]

Time in the world before the crash varies from about 15 s to 2.5 min across my runs; with this PR it was 83 s, so no visible change. I can run another build or turn on GBV if that would help.

**@⁠J-DB0** on GitHub · 2026-11-24 21:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/609#issuecomment-7145142248) Tested this PR (head 6d8c72b) on an RX 9070 XT (RDNA 4) with an i5-14600KF, in a diag build with VICTORY_D3D12_DRED=1. It doesn't stop the world crash on this card. On main and with this PR alike, the title loads into the world, runs for a while, then the device is removed by a page fault inside freed textures while mesh shaders draw: - main: `page fault at 0x486bfc000; inside freed ["texture 1024x1024 f99 flags 0x0 (type 34)"]`, a list stopped at command 2183 of 3383 (op 42), around draws of [mesh f0c7efd2aceb2aaa, pixel 7d85c9cab3c80721] - this PR: `page fault at 0x46356f000; inside freed ["texture 2048x2048 f71 flags 0x0 (type 34)", "texture 2048x2048 f71 flags 0x0 (type 34)", "texture 2048x1024 f99 flags 0x0 (type 34)"]`, a list stopped at command 788 of 856 (op 42), mostly draws of [mesh 51ff151f75cd5759, pixel 7fe75645c406cac6] Time in the world before the crash varies from about 15 s to 2.5 min across my runs; with this PR it was 83 s, so no visible change. I can run another build or turn on GBV if that would help.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:30 UTC · original

Automated triage for the maintainers.

Needs rebase. This PR does not merge cleanly into current main (ac2525d). Conflicting files: crates/victory-gpu/src/descriptor/host.rs, crates/victory-gpu/src/host.rs, crates/victory-gpu/src/resource.rs, crates/victory-gpu/src/texture.rs.

The content has not been reviewed yet; it will be once the branch is rebased onto main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/609#issuecomment-7148581645) <!-- victory-triage v1 head=6d8c72bc04ee7d31c654e089213dbf258a662ce6 verdict=needs-rebase at=2026-11-25T00:13:20Z --> Automated triage for the maintainers. **Needs rebase.** This PR does not merge cleanly into current `main` (ac2525d). Conflicting files: `crates/victory-gpu/src/descriptor/host.rs`, `crates/victory-gpu/src/host.rs`, `crates/victory-gpu/src/resource.rs`, `crates/victory-gpu/src/texture.rs`. The content has not been reviewed yet; it will be once the branch is rebased onto `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
  • crates/victory-gpu/src/host.rs
  • crates/victory-gpu/src/resource.rs
  • crates/victory-gpu/src/texture.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/609/head:github-bot/gh-609'
git switch 'github-bot/gh-609'

Merge

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