Repository navigation
gpu: emit UAV barrier after a dropped compute dispatch - #1392
kunalkhude99 wants to merge 1 commit into
Conversation
When a compute shader does not translate (e.g. unsupported GFX10 lane mask ops), its dispatch is dropped before bind() runs. This means ensure_state is never called for the UAVs it would have written, leaving those resources in a stale hazard state on the host list. The next dispatch that does run and reads those UAVs triggers DXGI_ERROR_DEVICE_REMOVED (0x887A0006) because D3D12 sees a UAV hazard with no preceding barrier to resolve it. Fix: emit a global null-resource UAV barrier immediately after any dropped compute dispatch. This matches the existing pattern in indirect.rs and flushes the hazard slate so the following dispatch starts clean. Fixes Marvisak#1347
|
Hey ! What improved: The session lasted noticeably longer than before (cutscene voices were still playing as proof that execution progressed further). What still happened (1795542714, pid 11184): Still hit a host GPU device removed (0x887A0006 / DEVICE_HUNG) after submitting 19 lists. Breadcrumbs show one list stalled at 128/415 Some(2) (op 42, mesh 3, between barriers 107..333) with another list left at 0/3 Some(3) (op 46, empty pipelines {}). Pattern in the log: Around commands 108..130, the op 42 mesh calls consistently use mesh shader 38ad582f523fd7cf and pixel shader d42a2d8a9d2c954a with placed 1D SRVs (such as s0+248, s0+440, s0+712, and pixel s0+688 at 182452224x1 / 0x30940000) plus Cbv s1+32, s1+40, and s2+0. Next step on my side is running a diagnostics build with VICTORY_D3D12_DEBUG=1 (and VICTORY_D3D12_GBV=1 if needed) to get the exact command name and validation details. |
Ported from Marvisak/VIctory#1392 (head 9687a19) by kunalkhude99, for issue #1347 (Ganfieof): an RTX 4060 lost its device on a 32x1x1 dispatch of 4c0ac499ad613809 right after three dropped compute dispatches, and ryosen0's RTX 3060 Ti named the same program at its removal. XTP's Series S session runs it too (docs/upstream/watch.md, items 99 and 108). Review: the PR's reason (a dispatch dropped before its ensure_state leaves a hazard that D3D12 removes the device for) does not hold in XTP as such. XTP records the title's own barriers (list.rs barrier, barrier_groups), a dropped dispatch records nothing, and a missing barrier does not remove a device by itself (a race may, through what a later shader then reads). So the barrier is a guard, not a proven fix. Changed in the port: the PR puts a barrier after each dropped dispatch, and the Series S world drops about 1,000 direct dispatches a frame (most do not translate; 976 to 1,260 in this task's three sessions). Here a drop marks the list, and its next dispatch that runs, direct or indirect, starts with one barrier: one a run of drops. Every drop path of a direct dispatch marks it (no pipeline, a graphics pipeline, a refused bind, a diagnostics skip), not only the PR's first one. Test (WARP): drops mark the list and the title's reset clears the mark. No test runs a dispatch through a title pipeline, and none could show what the barrier orders: WARP runs commands in order.
catminou4
left a comment
There was a problem hiding this comment.
Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows_sys/Win32) — nothing compiles or runs on macOS; this is source review plus the PR's own Windows tests.
A dropped compute dispatch (no host pipeline) now emits a global UAV barrier before returning, so UAVs it would have written cannot be read stale by the next dispatch — the comment ties it to DXGI_ERROR_DEVICE_REMOVED 0x887A0006. The barrier is the standard null-resource UAV barrier; ManuallyDrop usage matches the windows crate bindings. cfg(windows)-gated at the call site. Sound mitigation; a Windows repro of the original removal would confirm.
|
Thanks for chasing #1347; TheoSan05's run getting further is a useful data point. One thing about the mechanism, from reading the diff: a dropped dispatch never executes, so it can't leave UAV writes behind, and the next dispatch that does run calls Written with an AI assistant (Claude). |
|
Automated triage for the maintainers. Closing because by our reading the change is incorrect or would break something that works today. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution. |
When a compute shader does not translate (e.g. unsupported GFX10 lane mask ops), its dispatch is dropped before bind() runs. This means ensure_state is never called for the UAVs it would have written, leaving those resources in a stale hazard state on the host list.
The next dispatch that does run and reads those UAVs triggers DXGI_ERROR_DEVICE_REMOVED (0x887A0006) because D3D12 sees a UAV hazard with no preceding barrier to resolve it.
Fix: emit a global null-resource UAV barrier immediately after any dropped compute dispatch. This matches the existing pattern in indirect.rs and flushes the hazard slate so the following dispatch starts clean.
Fixes #1347