RTX 3070 Ti: DXGI_ERROR_DEVICE_HUNG in the world; debug layer reports a title buffer in UAV state used as vertex buffer #548

Open
opened 2026-11-26 04:07:54 +00:00 by github-bot · 6 comments
Owner

@⁠Javicksa on GitHub · 2026-11-24 04:44 UTC · original

Environment: Windows [version], NVIDIA RTX 3070 Ti (driver [version]), 32 GB RAM, commit [git rev-parse --short HEAD], diag build. README says it was tested on AMD only; NVIDIA waves are 32 lanes.

  1. Hang on the real GPU
    Boot, menus and world loading work. In the world: 0.8-1.6 fps, ~1,400 of ~5,800 draws/frame dropped (untranslated shaders), then the device is removed (0x887A0006 / 0x887A0004, DXGI_ERROR_DEVICE_HUNG). Slow submissions of 5-6 s. VICTORY_SHADER_LOOP_LIMIT=64 did not avoid it.

  2. Debug layer (VICTORY_D3D12_DEBUG=1), repeated ERROR id=538
    DrawIndexedInstanced / IASetVertexBuffers on 'title buffer 0x159f0000+0xae00000' (182,452,224 bytes): state UNORDERED_ACCESS, expected VERTEX_AND_CONSTANT_BUFFER. Six lists in one run. Also with VICTORY_GPU_TIMING=1 (one list per ExecuteCommandLists), so it is not a batching artifact.

Code observation (hypothesis, not verified): these buffers come from Host::shared_buffer (COMMON, ALLOW_UNORDERED_ACCESS). shadow.rs tracks no resource state and I found no explicit buffer barrier in victory-gpu; draw.rs:373 binds shadow.gpu(...) as a vertex buffer without a transition. I could not confirm that fixing this avoids the hang.

  1. DRED
    Breadcrumbs stop at op 6 inside a list (command 111 of 429, commands 16..254 between barriers; an earlier run: 143 of 354). With GPU timing, a list took 6364 ms but its six slowest completed commands took <= 0.7 ms each, so some command never completes.

  2. Perf
    The 174 MiB buffer is refreshed ~90x/frame (~16 GB/frame); "preparing" is ~60% of frame time.

  3. With VICTORY_D3D12_WARP=1 + DEBUG + GBV + DRED
    It did not reach the world (3-12 draws/frame, ~1.2 fps), so item 2 did not reproduce there. Found:

  • GBV id=940: pixel stage of [vertex 089d6271be6650ef, pixel 0d1575a396dfe513] expects TEXTURE2D, descriptor (heap index 0) is TEXTURE1D.
  • id=622: compute 13dfdd3b1136e407 and 88994c3496045f51 require wave lane count 64 (WARP max 4); host pipeline refused (0x80070057). The same HRESULT refusal appeared on the RTX 3070 Ti (compute b4db8c3785b6fbc5); I did not capture the cause there.
  • Title access violation (write 0x0) at victory-image-b99f876b74d4a77f.dll+0x23cf683 on a worker thread, shortly after the second refusal (the first refusal 18 s earlier did not crash; no causal link established).
  • Pipeline library ids 970/972 ("desc does not match", "already exists") for the same names (e.g. b621eaede8c436ee056a37d8442094fd): possibly an incomplete cache key (perf only).
**@⁠Javicksa** on GitHub · 2026-11-24 04:44 UTC · [original](https://github.com/Marvisak/VIctory/issues/548) Environment: Windows [version], NVIDIA RTX 3070 Ti (driver [version]), 32 GB RAM, commit [git rev-parse --short HEAD], diag build. README says it was tested on AMD only; NVIDIA waves are 32 lanes. 1) Hang on the real GPU Boot, menus and world loading work. In the world: 0.8-1.6 fps, ~1,400 of ~5,800 draws/frame dropped (untranslated shaders), then the device is removed (0x887A0006 / 0x887A0004, DXGI_ERROR_DEVICE_HUNG). Slow submissions of 5-6 s. VICTORY_SHADER_LOOP_LIMIT=64 did not avoid it. 2) Debug layer (VICTORY_D3D12_DEBUG=1), repeated ERROR id=538 DrawIndexedInstanced / IASetVertexBuffers on 'title buffer 0x159f0000+0xae00000' (182,452,224 bytes): state UNORDERED_ACCESS, expected VERTEX_AND_CONSTANT_BUFFER. Six lists in one run. Also with VICTORY_GPU_TIMING=1 (one list per ExecuteCommandLists), so it is not a batching artifact. Code observation (hypothesis, not verified): these buffers come from Host::shared_buffer (COMMON, ALLOW_UNORDERED_ACCESS). shadow.rs tracks no resource state and I found no explicit buffer barrier in victory-gpu; draw.rs:373 binds shadow.gpu(...) as a vertex buffer without a transition. I could not confirm that fixing this avoids the hang. 3) DRED Breadcrumbs stop at op 6 inside a list (command 111 of 429, commands 16..254 between barriers; an earlier run: 143 of 354). With GPU timing, a list took 6364 ms but its six slowest completed commands took <= 0.7 ms each, so some command never completes. 4) Perf The 174 MiB buffer is refreshed ~90x/frame (~16 GB/frame); "preparing" is ~60% of frame time. 5) With VICTORY_D3D12_WARP=1 + DEBUG + GBV + DRED It did not reach the world (3-12 draws/frame, ~1.2 fps), so item 2 did not reproduce there. Found: - GBV id=940: pixel stage of [vertex 089d6271be6650ef, pixel 0d1575a396dfe513] expects TEXTURE2D, descriptor (heap index 0) is TEXTURE1D. - id=622: compute 13dfdd3b1136e407 and 88994c3496045f51 require wave lane count 64 (WARP max 4); host pipeline refused (0x80070057). The same HRESULT refusal appeared on the RTX 3070 Ti (compute b4db8c3785b6fbc5); I did not capture the cause there. - Title access violation (write 0x0) at victory-image-b99f876b74d4a77f.dll+0x23cf683 on a worker thread, shortly after the second refusal (the first refusal 18 s earlier did not crash; no causal link established). - Pipeline library ids 970/972 ("desc does not match", "already exists") for the same names (e.g. b621eaede8c436ee056a37d8442094fd): possibly an incomplete cache key (perf only).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:07:55 +00:00
Author
Owner

@⁠Len1k on GitHub · 2026-11-24 04:52 UTC · original

The code observation holds, and the gap is narrower than it looks: ensure_state cannot cover buffers at all today.

  • draw::readable (crates/victory-gpu/src/draw.rs:1074) handles a buffer view through descriptor::host::buffer_range: it calls shadow.refresh and, for a UAV, shadow.gpu_writes. The two ensure_state calls below (View::Shader and View::Unordered, around lines 1097 and 1114) only match texture views.
  • list::ensure_state (list.rs:391) goes through HostList::transition (host.rs:905), which resolves host_copy — a HostTexture. A shadow buffer has none, so transition returns None and no barrier is ever recorded for it.
  • Vertex and index binding (draw.rs:335 prepare_for, IASetVertexBuffers at line 373 and IASetIndexBuffer after it; the mesh path binds at line 888) use shadow.gpu(address) directly.
  • Shadow buffers come from host::shared_buffer (host.rs:1759): D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, created in D3D12_RESOURCE_STATE_COMMON (line 1789). D3D12 promotes COMMON to UNORDERED_ACCESS implicitly on the first UAV use, and that promoted state holds for the rest of the command list. So a compute pass that skins into the 174 MiB heap leaves the buffer in UAV; the mesh draw that reads the same heap as vertex data in that list is exactly the debug-layer 538 you see. The promoted state is not a per-list artifact either — the same mismatch on a driver that does not report it is a candidate for the hang, though that part is unproven.
  • Even if the states matched, the write→read pair needs a UAV barrier; readable writes no barrier between gpu_writes and the vertex bind. (indirect.rs has a uav_barrier() helper already.)

Shape of a fix, for what it is worth:

  1. Give HostList a buffer-state record keyed by the ID3D12Resource pointer of Shadow::buffer, mirroring the texture record that keys on the copy pointer (host.rs:905).
  2. Record UNORDERED_ACCESS in readable's UAV arm for shadow buffers, and record (at least) VERTEX_AND_CONSTANT_BUFFER / INDEX_BUFFER / GENERIC_READ at the bind sites.
  3. When leaving UAV for a read in the same list, emit a UAV barrier and the transition (host::transition at host.rs:1874 already builds the barrier struct).
  4. If the driver does not decay promoted state at list end, carry the real state across lists in prelude() (host.rs:929) the way textures do; otherwise the per-list record is enough.

I can write that as a PR with cargo test -p victory-gpu (no title here — RDNA1, no mesh shaders), but I did not want to touch the state path without a word from you first. Whether it also stops the DEVICE_HUNG is a separate question from whether the debug-layer error is real; this report is the only place I have seen the mismatch named.

AI-assisted.

**@⁠Len1k** on GitHub · 2026-11-24 04:52 UTC · [original](https://github.com/Marvisak/VIctory/issues/548#issuecomment-7122417053) The code observation holds, and the gap is narrower than it looks: `ensure_state` cannot cover buffers at all today. - `draw::readable` (`crates/victory-gpu/src/draw.rs:1074`) handles a buffer view through `descriptor::host::buffer_range`: it calls `shadow.refresh` and, for a UAV, `shadow.gpu_writes`. The two `ensure_state` calls below (`View::Shader` and `View::Unordered`, around lines 1097 and 1114) only match texture views. - `list::ensure_state` (`list.rs:391`) goes through `HostList::transition` (`host.rs:905`), which resolves `host_copy` — a `HostTexture`. A shadow buffer has none, so `transition` returns `None` and no barrier is ever recorded for it. - Vertex and index binding (`draw.rs:335` `prepare_for`, `IASetVertexBuffers` at line 373 and `IASetIndexBuffer` after it; the mesh path binds at line 888) use `shadow.gpu(address)` directly. - Shadow buffers come from `host::shared_buffer` (`host.rs:1759`): `D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS`, created in `D3D12_RESOURCE_STATE_COMMON` (line 1789). D3D12 promotes COMMON to UNORDERED_ACCESS implicitly on the first UAV use, and that promoted state holds for the rest of the command list. So a compute pass that skins into the 174 MiB heap leaves the buffer in UAV; the mesh draw that reads the same heap as vertex data in that list is exactly the debug-layer 538 you see. The promoted state is not a per-list artifact either — the same mismatch on a driver that does not report it is a candidate for the hang, though that part is unproven. - Even if the states matched, the write→read pair needs a UAV barrier; `readable` writes no barrier between `gpu_writes` and the vertex bind. (`indirect.rs` has a `uav_barrier()` helper already.) Shape of a fix, for what it is worth: 1. Give `HostList` a buffer-state record keyed by the `ID3D12Resource` pointer of `Shadow::buffer`, mirroring the texture record that keys on the copy pointer (`host.rs:905`). 2. Record UNORDERED_ACCESS in `readable`'s UAV arm for shadow buffers, and record (at least) VERTEX_AND_CONSTANT_BUFFER / INDEX_BUFFER / GENERIC_READ at the bind sites. 3. When leaving UAV for a read in the same list, emit a UAV barrier and the transition (`host::transition` at `host.rs:1874` already builds the barrier struct). 4. If the driver does not decay promoted state at list end, carry the real state across lists in `prelude()` (`host.rs:929`) the way textures do; otherwise the per-list record is enough. I can write that as a PR with `cargo test -p victory-gpu` (no title here — RDNA1, no mesh shaders), but I did not want to touch the state path without a word from you first. Whether it also stops the `DEVICE_HUNG` is a separate question from whether the debug-layer error is real; this report is the only place I have seen the mismatch named. AI-assisted.
Author
Owner

@⁠wwwwwwww3333333 on GitHub · 2026-11-24 05:07 UTC · original

@⁠Len1k before you start on that: #334 (realhenners, open, clean against d2a4bae) already implements the shape you describe. It adds a per-list BufferStates record for host copies (GENERIC_READ for vertex/index/constant/SRV/indirect reads, UNORDERED_ACCESS for shader writes) with transitions where the use changes. The prelude moves each buffer from COMMON to its first state and close moves it back. It also replaces indirect.rs's fixed UAV ↔ INDIRECT_ARGUMENT barriers, which on main leave the shared heap explicitly in UNORDERED_ACCESS after every indirect draw.

I ran #334 (af2aecf) on Windows 11 / Rust 1.98.1 MSVC / RX 6750 XT (RDNA2). cargo test -p victory-gpu passes (45 passed, 1 ignored). That includes debug_layer_accepts_buffers_written_then_read_as_vertices, which ran with the D3D12 debug layer (not skipped) and reported no errors. Clippy -D warnings is clean apart from the pre-existing host.rs:267 lint that #355 fixes.

So this report looks like #199/#264 on another NVIDIA card. Testing #334 on the RTX 3070 Ti would show whether id 538 and the hang go away. Not runtime-tested with game files.

AI-assisted (Claude did the source analysis; I ran the tests above on my machine).

**@⁠wwwwwwww3333333** on GitHub · 2026-11-24 05:07 UTC · [original](https://github.com/Marvisak/VIctory/issues/548#issuecomment-7122642089) @⁠Len1k before you start on that: #334 (realhenners, open, clean against `d2a4bae`) already implements the shape you describe. It adds a per-list `BufferStates` record for host copies (`GENERIC_READ` for vertex/index/constant/SRV/indirect reads, `UNORDERED_ACCESS` for shader writes) with transitions where the use changes. The prelude moves each buffer from `COMMON` to its first state and `close` moves it back. It also replaces `indirect.rs`'s fixed `UAV ↔ INDIRECT_ARGUMENT` barriers, which on `main` leave the shared heap explicitly in `UNORDERED_ACCESS` after every indirect draw. I ran #334 (`af2aecf`) on Windows 11 / Rust 1.98.1 MSVC / RX 6750 XT (RDNA2). `cargo test -p victory-gpu` passes (45 passed, 1 ignored). That includes `debug_layer_accepts_buffers_written_then_read_as_vertices`, which ran with the D3D12 debug layer (not skipped) and reported no errors. Clippy `-D warnings` is clean apart from the pre-existing `host.rs:267` lint that #355 fixes. So this report looks like #199/#264 on another NVIDIA card. Testing #334 on the RTX 3070 Ti would show whether id 538 and the hang go away. Not runtime-tested with game files. *AI-assisted (Claude did the source analysis; I ran the tests above on my machine).*
Author
Owner

@⁠LAKSHYA-cmd-tech on GitHub · 2026-11-24 05:14 UTC · original

PR #588 addresses this exact issue:

  1. \Shadow\ now tracks the D3D12 resource state of each host buffer copy via an \AtomicU32.
  2. \Shadow::ensure_state\ emits an explicit \ResourceBarrier\ transition whenever a buffer moves between states (such as from \UNORDERED_ACCESS\ to \VERTEX_AND_CONSTANT_BUFFER).
  3. In \prepare_for, vertex buffers and index buffer are transitioned to \VERTEX_AND_CONSTANT_BUFFER\ and \INDEX_BUFFER\ respectively before calling \IASetVertexBuffers\ and \IASetIndexBuffer, clearing debug layer ERROR id=538.
  4. In
    eadable, buffers accessed via UAV transition to \UNORDERED_ACCESS.
**@⁠LAKSHYA-cmd-tech** on GitHub · 2026-11-24 05:14 UTC · [original](https://github.com/Marvisak/VIctory/issues/548#issuecomment-7122757526) PR #588 addresses this exact issue: 1. \Shadow\ now tracks the D3D12 resource state of each host buffer copy via an \AtomicU32\. 2. \Shadow::ensure_state\ emits an explicit \ResourceBarrier\ transition whenever a buffer moves between states (such as from \UNORDERED_ACCESS\ to \VERTEX_AND_CONSTANT_BUFFER\). 3. In \prepare_for\, vertex buffers and index buffer are transitioned to \VERTEX_AND_CONSTANT_BUFFER\ and \INDEX_BUFFER\ respectively before calling \IASetVertexBuffers\ and \IASetIndexBuffer\, clearing debug layer ERROR id=538. 4. In \ eadable\, buffers accessed via UAV transition to \UNORDERED_ACCESS\.
Author
Owner

@⁠Len1k on GitHub · 2026-11-24 05:18 UTC · original

Good catch, and it settles it: #334 already implements the shape I sketched, so my four-step plan is redundant — I would rather not duplicate realhenners' work.

For the record on the two differences, in case they matter for the RTX 3070 Ti test: my sketch wanted the state record keyed by the ID3D12Resource pointer of Shadow::buffer, and the UAV barrier between shadow.gpu_writes and the vertex bind. If #334's BufferStates moves every buffer from COMMON to its first state in the prelude and returns it in close, the promotion question I raised in the original comment is answered, since nothing is left promoted across a list boundary.

One thing worth keeping from it: indirect.rs's fixed UAV ↔ INDIRECT_ARGUMENT barriers leaving the shared heap in UNORDERED_ACCESS after every indirect draw is the same class of defect, and #334 replacing those is the more important half on this card — a buffer left in UAV is exactly what a following vertex bind in that list trips over.

#588 proposes a second implementation of the same thing (Shadow::ensure_state with an AtomicU32). Whichever lands, the debug_layer_accepts_buffers_written_then_read_as_vertices test #334 adds is the part worth keeping — the shape is otherwise unverifiable without the title.

AI-assisted.

**@⁠Len1k** on GitHub · 2026-11-24 05:18 UTC · [original](https://github.com/Marvisak/VIctory/issues/548#issuecomment-7122821023) Good catch, and it settles it: #334 already implements the shape I sketched, so my four-step plan is redundant — I would rather not duplicate realhenners' work. For the record on the two differences, in case they matter for the RTX 3070 Ti test: my sketch wanted the state record keyed by the `ID3D12Resource` pointer of `Shadow::buffer`, and the UAV barrier between `shadow.gpu_writes` and the vertex bind. If #334's `BufferStates` moves every buffer from `COMMON` to its first state in the prelude and returns it in `close`, the promotion question I raised in the original comment is answered, since nothing is left promoted across a list boundary. One thing worth keeping from it: `indirect.rs`'s fixed `UAV ↔ INDIRECT_ARGUMENT` barriers leaving the shared heap in `UNORDERED_ACCESS` after every indirect draw is the same class of defect, and #334 replacing those is the more important half on this card — a buffer left in UAV is exactly what a following vertex bind in that list trips over. #588 proposes a second implementation of the same thing (`Shadow::ensure_state` with an `AtomicU32`). Whichever lands, the `debug_layer_accepts_buffers_written_then_read_as_vertices` test #334 adds is the part worth keeping — the shape is otherwise unverifiable without the title. *AI-assisted.*
Author
Owner

@⁠colehammond65 on GitHub · 2026-11-24 06:58 UTC · original

PR #334 tested on RTX 4080. The new buffer-state unit test passed. The debug-layer child test skipped because this Windows build has no usable debug layer, so error 538 could not be checked directly. Both baseline and #334 runs still ended in device removal, with DRED stopping in indirect execution or mesh dispatch and no page fault. Full report: #334

AI-assisted test report.

**@⁠colehammond65** on GitHub · 2026-11-24 06:58 UTC · [original](https://github.com/Marvisak/VIctory/issues/548#issuecomment-7124488311) **PR #334 tested on RTX 4080.** The new buffer-state unit test passed. The debug-layer child test skipped because this Windows build has no usable debug layer, so error 538 could not be checked directly. Both baseline and #334 runs still ended in device removal, with DRED stopping in indirect execution or mesh dispatch and no page fault. Full report: https://git.gtahub.st/github/Marvisak--VIctory/pulls/334 AI-assisted test report.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:48 UTC · original

Automated triage for the maintainers.

The debug-layer error (id 538: title buffer ...+0xae00000 in UNORDERED_ACCESS at IASetVertexBuffers) is the failure first reported in #199, which is where its cause is tracked. Your code observation still holds on current main (940d32f):

  • host copies of title buffers are made in COMMON by Host::shared_buffer (crates/victory-gpu/src/host.rs) and get no transitions;
  • State::prepare_for (crates/victory-gpu/src/draw.rs) binds shadow.gpu(...) as a vertex buffer without a barrier;
  • indirect::done (crates/victory-gpu/src/indirect.rs) explicitly moves the argument buffer back to UNORDERED_ACCESS after each indirect execution.

The open PR for this is #334 (needs a rebase). #588 was closed. An RTX 4080 run of #334 still lost the device, so whether this mismatch causes the hang is not settled.

The environment line in the report still has its placeholders. To compare it with the other NVIDIA runs, please fill in:

  • the Windows version/build,
  • the NVIDIA driver version,
  • the VIctory commit (git rev-parse --short HEAD).

If you can, also do a run of current main (or of #334) with VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_DRED=1, and post the complete host GPU device removed ... line.

The WARP-only access violation at +0x23cf683 (write 0x0) is discussed in #1118.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:48 UTC · [original](https://github.com/Marvisak/VIctory/issues/548#issuecomment-7149973278) <!-- victory-issue-triage v1 verdict=needs-info seen=2026-11-24T06:58:51Z at=2026-11-25T01:48:40Z --> Automated triage for the maintainers. The debug-layer error (id 538: `title buffer ...+0xae00000` in `UNORDERED_ACCESS` at `IASetVertexBuffers`) is the failure first reported in #199, which is where its cause is tracked. Your code observation still holds on current `main` (`940d32f`): - host copies of title buffers are made in `COMMON` by `Host::shared_buffer` (`crates/victory-gpu/src/host.rs`) and get no transitions; - `State::prepare_for` (`crates/victory-gpu/src/draw.rs`) binds `shadow.gpu(...)` as a vertex buffer without a barrier; - `indirect::done` (`crates/victory-gpu/src/indirect.rs`) explicitly moves the argument buffer back to `UNORDERED_ACCESS` after each indirect execution. The open PR for this is #334 (needs a rebase). #588 was closed. An RTX 4080 run of #334 still lost the device, so whether this mismatch causes the hang is not settled. The environment line in the report still has its placeholders. To compare it with the other NVIDIA runs, please fill in: - the Windows version/build, - the NVIDIA driver version, - the VIctory commit (`git rev-parse --short HEAD`). If you can, also do a run of current `main` (or of #334) with `VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_DRED=1`, and post the complete `host GPU device removed ...` line. The WARP-only access violation at `+0x23cf683` (write 0x0) is discussed in #1118. --- _Generated by [Claude Code](https://claude.ai/code)_
This discussion has been locked. Commenting is limited to contributors.
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#548
No description provided.