d3d12: order ExecuteIndirect argument reads after earlier writes #298
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/298"
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 brcly/TuxBox. Originally posted by NickStallman on 2026-11-27T04:11:45Z.
Refs #232.
ExecuteIndirectcan read its argument or count buffer before an earlier write to it in the same batch has landed, when the title separates the two with anything other than an exactINDIRECT_ARGUMENTtransition. There are two separate mechanisms.Measured with a new Lanes scenario,
gpu-indirect-order: 48 rounds in one list and one submission, each rewriting the same argument buffer (and count buffer) with a compute dispatch, then reading it withExecuteIndirect, with no CPU wait in between.INDIRECT_ARGUMENTtransition, with or without a count bufferINDIRECT_ARGUMENT | NON_PIXEL_SHADER_RESOURCE), no count bufferChange (
commands/indirect_order.rs): each native list tracks, since its last buffer write, whether it has seen a barrier whose after-state includesINDIRECT_ARGUMENT(synced), and one vkd3d-proton honours for its argument pass (named).execute_indirectrecords one global barrier (ALL/COMMON→EXECUTE_INDIRECT/INDIRECT_ARGUMENT) only when the call lacks what it needs. A counted dispatch needs both; anything else needssynced.INDIRECT_ARGUMENTgets no extra barrier.Not a fix for #232's hang: in ProjectScarlett, an
ALL/COMMONbarrier before every computeExecuteIndirectdidn't move the Xid 109. This is a correctness fix for stale indirect arguments.Tests:
gpu-indirect-orderis inalland the verify suite. It fails onmainas shown above and passes with this change on both cards. The unit tests insrc/tests/commands/indirect_order.rsare typechecked only, since the crate targets Windows.Checks (on
5444f38)python -m unittest discover -s tests -q: OK.python tuxbox.py checkpassed, 134 gates, includinglanes-selftest-gpu-indirect-order.Not covered: bundles and lists without enhanced barriers (logged once, unchanged), and vkd3d-proton's predication fallback.
🤖 Generated with Claude Code