runtime: forward a GPU-written indirect dispatch #1860
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1867"
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 R0Y00/Xbox2Windows. Originally posted by avt0m4t48 on 2026-11-24T19:48:40Z.
Refs #1759 and #1412. Builds on the desktop-only fixture in #1805.
Forward the newer guest command-list slot 61 for one rootless desktop Dispatch signature, one record and no count buffer. Resolve the guest resource and byte offset against the device's placed-buffer index and transition the resolved desktop resource to INDIRECT_ARGUMENT. Refuse unknown or ambiguous ranges, placeholder signatures, and calls without a desktop compute pipeline and root. The command-list slot and resource/offset shape are independently documented in VIctory and Scarlett Commons.
The source-built fixture records the GPU producer and guest indirect consumer on the same desktop list, through a guest-placed buffer. It checks two group counts, omitted producer, unmapped argument, short range and placeholder signature with a fenced readback. The producer and the consumer result UAV use desktop bindings in this fixture. The patch covers the focused Dispatch slice of #1759.
Verification:
cmake --build --preset release --target startup_indirect_dispatch startup_command_list_slot_names.ctest --preset release --no-tests=error -R '^startup_(indirect_dispatch_warp|command_list_slot_names)$' -Vpassed 2/2. WARP returned0x31415f02for (4,3,2) and0x31415c08for (2,3,2). All controls preserved0x31415926.A physical adapter result would complete the requested platform coverage. To collect it, run
ctest --preset release --no-tests=error -R '^startup_indirect_dispatch_hardware$' -Vafter the build above. Title execution remains unverified.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T19:56:31Z.
Review: COMMENTED
Review of
749009ff(merge base0631667d;origin/mainis nowdd753176,git merge-treemerges cleanly). Comment only, not an approval.Verdict
No P1. One P2 about the resource-state assumption, and several P3 notes. The refusal paths are thorough and each is logged. The C++ is Windows-only and does not build on Linux, so apart from the slot-name test everything below is from reading the diff.
P2: the transition assumes the buffer is in COMMON
require_stateemitstransition(COMMON -> INDIRECT_ARGUMENT)for a resource that is not yet inpass.states. The only guard isinfo->initial_state == COMMON, which says how the resource was created, not what state it is in when slot 61 runs. The fixture shows why this matters: it records the producer natively and then explicitly moves the argument buffer back toCOMMON(startup_indirect_dispatch.cppline 162) just before the guestExecuteIndirect. If anything earlier on the same list leaves the buffer in another state that is not inpass.states(a native or earlier-forwarded UAV write, a copy), the barrier'sStateBeforeis wrong and the debug layer rejects it. Please state this precondition in the docs, or track the state for resources this path touches. The WARP debug-layer run in the description passes only because the fixture satisfies it.Checked and looks right
list_execute_indirect(self, signature, count, argument, offset, count_buffer, count_offset)matches the seven-argumentListTypeddispatch (4 registers + 3 stack words) and the desktopExecuteIndirectshape.countis aUINT, so the upper register bits are ignored.offset & 3,offset > ~0 - base(no wrap), andplaced_buffer_range(device, base + offset, 12)withfound.owner == bufferand noreject. Short range and unmapped argument are covered by the fixture.dispatch_signature_device), and the list's device must match. A placeholder signature (real == nullptr) is refused.pass.states, sorelease_targetsat Close moves it back to COMMON and resets thePass(including the newcompute_pipeline/compute_rootflags).P3
SetComputeRootSignature(slot 33) are forwarded. A guestDispatch, UAV bindings and barriers are not, so the producer in the fixture is recorded straight on the native list. The description says so ("the producer ... use desktop bindings"); the title and docs line "forwards the single-record indirect compute dispatch" can read as more than that.compute_pipelineis set in the stream path only, so a compute pipeline from the older create call is refused with "requires a desktop compute pipeline and root" (logged for the first 16).ExecuteIndirect; a mismatch would be left to the debug layer.command_list_slot_names.hloses "a name there would be a guess" for slots from 60 up and keeps only "no confirmed meaning". Slot 61 is named; slot 60 and 62 stay unnamed in the test, which is consistent.CMakePresets.jsonaddsstartup_indirect_dispatchto the build targets andstartup_indirect_dispatch_warpto the PR smoke filter. The JSON parses. The hardware variant is not in the filter, and the description says no physical adapter was run.Commands run (Linux)
g++ -std=c++17 -Isrc tests/startup_command_list_slot_names.cppthen run:command list slot name checks passed.command_list_slot_names.h, each caught: name for slot 61 removed (FAIL: slot 61 is ExecuteIndirect), slot constant changed to 60 (FAIL: slot 61 is ExecuteIndirect; FAIL: slot 60 has no name), wrong name (FAIL: the name Dispatch is used once). All reverted withgit checkout -- ..python -B tests/docs_links_check.py: Self-test passed. Checked 18 Markdown files and 371 links.python -B tests/bidi_controls_check.py: Self-test passed. Checked 1324 tracked source, script and build/CI files: no bidirectional controls.git diff --check origin/main...HEAD: clean.Not run
startup_indirect_dispatchand every D3D12 run (no Windows, MSVC or physical adapter here), so I could not mutate thed3d12_xs_device.cppchanges. The WARP results (0x31415f02,0x31415c08) and the slot-61-removal control are the author's, from their CI job; I did not reproduce them.AI-assisted; commands listed were executed locally.