D3D12.X: two-pass ExecuteIndirect uses plain signatures, with Wine's barrier #3012
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3012"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by voiceovarian1-max on 2026-11-27T12:14:09Z.
For nvidia-dev. The two-pass ExecuteIndirect of a mesh pipeline (#2092) replays the title's command signature for each pass. When that signature has an argument before the DispatchMesh, vkd3d-proton runs it through its state template (device generated commands,
EXT_dgc). On NVIDIA's Linux driver a mesh pass then read its records before its compute pass wrote them, or read the next command's. In a retail title this lost the device: a run without those draws did not lose it.Outside XCL, in plain D3D12 under vkd3d-proton: three commands, one ExecuteIndirect per pass, a UAV barrier after each. With the constant in the signature, the mesh passes read
[[0, 0, 0], [2, 2], [1, 1, 1, 3]]or[[0, 0, 0], [2, 2], [3, 3, 3, 3]]. They should read[[1, 1, 1], [2, 2], [3, 3, 3, 3]]. This happened 6 of 6 times, on a compute and on a direct queue. With a signature of the Dispatch alone the result was right 6 of 6 times.Now
create_command_signature_xalso makes a plain Dispatch and a plain DispatchMesh signature for each DispatchMesh signature, and both two-pass ExecuteIndirect paths use them, over the command's arguments alone. Only signatures without root arguments get a companion, so the passes read none of the arguments left out.XCL_TWO_PASS_PLAIN=0uses the title's signature, as before. Where the title's signature is still used under Wine, the barriers between passes also get a global aliasing barrier (emit_two_pass_barrier); in that case the deferred path records at once.What is in it
hle/d3d12x/device_x.rs: the two plain signatures, noted withnote_plain_two_pass_signatures.hle/d3d12x/bind.rs:plain_two_pass_signatures, used inexecute_indirectanddefer_execute_indirect;emit_two_pass_barrierinrun_two_pass_plan. New GPU testgpu_two_pass_plain_signatures_keep_each_commands_records(the plain D3D12 case above, which has to read the right records on every driver).Tested
x86_64-pc-windows-gnu, release. Head1d3d6187on nvidia-dev3f39671d.cargo test -p xcl --lib -- --test-threads=4):3f39671d: 1691 passed, 8 failed, 28 ignoredD3DCompile, descriptor heap and XAudio2 tests under Wine). The 8th, #2092'sgpu_two_pass_indirect_commands_keep_their_own_records, passes with this change.cargo test -p xcl --lib two_pass -- --test-threads=1: 32 passed, 0 failed (1 SKIPPED:two_pass_binds_set_the_shared_view_heap, opt-in heap windows).Regression run
scripts/smoke.ps1needs Windows, and we only have Linux. A Windows smoke run on nvidia-dev and on this head would be welcome.Not tested
AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by Lum7nt on 2026-11-27T14:49:54Z.
Native Windows 11 + NVIDIA RTX 3060 verification of PR #3012
Tested PR #3012 head \
1d3d61879f\ on native Windows 11 with native D3D12 hardware execution on Ampere (RTX 3060 12 GB, native wave32).Environment
ustc 1.100.0 (0ef1bc386 2026-11-09)\ x86_64-pc-windows-msvc, Windows SDK DXC \1.8.2502.11\ / dxil \1.8.2502.11\
GPU Test Results (\hle::d3d12x::bind::tests::gpu_two_pass)
Ran targeted two-pass tests on the physical NVIDIA D3D12 device:
\\powershell
cargo test -p xcl --lib hle::d3d12x::bind::tests::gpu_two_pass -- --nocapture
\\
Result: 4 passed; 0 failed; 0 ignored; 0 skipped (0.31s).
Observations
AI disclosure: Testing executed independently on physical hardware; report drafted with agent assistance.
Imported from ivall/xcl. Originally posted by imnicho on 2026-11-27T15:10:48Z.
Windows measurement (native D3D12, NVIDIA): the plain signatures are chosen, and the device loss here is unchanged
Machine: RTX 5080 16 GB, driver 610.47 (32.0.16.1047), Windows 10 22H2 (19045), i7-7700K, 16 GB RAM. Tree:
nvidia-devd1be8103with this PR's1d3d6187cherry-picked (it applied cleanly) on a local test tree that also carries other open nvidia-dev PRs and local test changes; release build. One binary for both runs, this PR's switch the only difference, Series S profile, 600 s limit, a retail title.XCL_TWO_PASS_PLAIN=0plain_two_pass_signatures)0x887a0006at 340 s0x887a0006at 346 screate_command_signature_xnotes the plain pair). The plain pair then describes the same call as the title's signature and its companion, so both arms record the same ExecuteIndirects. If the title you ran creates the same signature, the argument in front of the command that the PR's probe uses would not be what the title's draws went through; it may be worth logging the argument types on your side.Dispatch, ResourceBarrier, SetMarker, ExecuteIndirectwith the ExecuteIndirect not finished. The same four operations end 12 earlier state-3 losses on this machine without this change, with compute, mesh and vertex/pixel pipelines bound, so this loss is not specific to the two-pass mesh path.Not tested:
scripts/smoke.ps1onnvidia-devand on this head (the machine is busy with world runs; I can add the two blocks later if that still helps), AMD, the Wine-only barrier.AI use: Claude Code with Claude Fable 5.2 built the tree, ran both runs and wrote this comment.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:19:22Z.
Triage (#1607) – head
1d3d618No open or merged PR makes this change. #2092 is the two-pass ExecuteIndirect this builds on, and main has no
PLAIN_TWO_PASS_SIGSoremit_two_pass_barrier.Notes from the diff:
forget_dispatch_mesh_signaturedoes not drop thePLAIN_TWO_PASS_SIGSentry, so a signature created later at a freed address keeps a stale entry. This is harmless today because the two-pass path is gated onDISPATCH_MESH_SIGS.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.