runtime: forward a GPU-written indirect dispatch #1860

Merged
avt0m4t48 merged 3 commits from upstream-pr/1867 into main 2026-11-24 19:55:37 +00:00
avt0m4t48 commented 2026-11-24 19:48:40 +00:00 (Migrated from github.com)

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:

  • Windows Release build: cmake --build --preset release --target startup_indirect_dispatch startup_command_list_slot_names.
  • Windows WARP with the debug layer enabled: ctest --preset release --no-tests=error -R '^startup_(indirect_dispatch_warp|command_list_slot_names)$' -V passed 2/2. WARP returned 0x31415f02 for (4,3,2) and 0x31415c08 for (2,3,2). All controls preserved 0x31415926.
  • Removing the slot-61 forwarding registration made the first GPU readback fail at word 4 as expected. The control job verified the mismatch and the fixture exit code. Windows job logs.
  • The slot-name test and Windows-target Clang syntax checks also passed from Linux. The executable sources and presets are identical to the verified candidate after rebasing.

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$' -V after the build above. Title execution remains unverified.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6590068767 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1867). Originally posted by [avt0m4t48](https://github.com/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](https://github.com/Marvisak/VIctory/blob/ffe310e/crates/victory-gpu/src/list.rs#L1143-L1166) and [Scarlett Commons](https://github.com/scarlett-commons/scarlett-commons/blob/d56fe25/engine/runtime/test/fsr_dispatch_test.cpp#L274-L305). 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: - Windows Release build: `cmake --build --preset release --target startup_indirect_dispatch startup_command_list_slot_names`. - Windows WARP with the debug layer enabled: `ctest --preset release --no-tests=error -R '^startup_(indirect_dispatch_warp|command_list_slot_names)$' -V` passed 2/2. WARP returned `0x31415f02` for (4,3,2) and `0x31415c08` for (2,3,2). All controls preserved `0x31415926`. - Removing the slot-61 forwarding registration made the first GPU readback fail at word 4 as expected. The control job verified the mismatch and the fixture exit code. [Windows job logs](https://github.com/avt0m4t48/Xbox2Windows/actions/runs/45474174391). - The slot-name test and Windows-target Clang syntax checks also passed from Linux. The executable sources and presets are identical to the verified candidate after rebasing. 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$' -V` after the build above. Title execution remains unverified.
upstream-sync closed this pull request 2026-11-24 20:01:10 +00:00
tedin7 commented 2026-11-24 20:01:10 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T19:56:31Z.

Review: COMMENTED


Review of 749009ff (merge base 0631667d; origin/main is now dd753176, git merge-tree merges 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_state emits transition(COMMON -> INDIRECT_ARGUMENT) for a resource that is not yet in pass.states. The only guard is info->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 to COMMON (startup_indirect_dispatch.cpp line 162) just before the guest ExecuteIndirect. If anything earlier on the same list leaves the buffer in another state that is not in pass.states (a native or earlier-forwarded UAV write, a copy), the barrier's StateBefore is 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

  • ABI. list_execute_indirect(self, signature, count, argument, offset, count_buffer, count_offset) matches the seven-argument ListTyped dispatch (4 registers + 3 stack words) and the desktop ExecuteIndirect shape. count is a UINT, so the upper register bits are ignored.
  • Bounds and offsets. offset & 3, offset > ~0 - base (no wrap), and placed_buffer_range(device, base + offset, 12) with found.owner == buffer and no reject. Short range and unmapped argument are covered by the fixture.
  • Command signature. Only a rootless signature with stride 12, one argument of type Dispatch is tagged (dispatch_signature_device), and the list's device must match. A placeholder signature (real == nullptr) is refused.
  • State at the end. The new state is recorded in pass.states, so release_targets at Close moves it back to COMMON and resets the Pass (including the new compute_pipeline/compute_root flags).

P3

  • Scope of "GPU-written". Only slot 61 and SetComputeRootSignature (slot 33) are forwarded. A guest Dispatch, 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 pipelines only from streams. compute_pipeline is 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).
  • Slot 33 is now forwarded for every render-mode list, not only for indirect dispatch. It is skipped for root signatures that use heap flags, but it is a wider effect than the title suggests.
  • Pipeline and root are not checked against each other before ExecuteIndirect; a mismatch would be left to the debug layer.
  • Provenance. The slot and argument shape are justified with links to two other projects' source files. I did not open them; the maintainers should decide whether that is the evidence they want under their clean-room rule.
  • Header comment. command_list_slot_names.h loses "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.
  • Presets. CMakePresets.json adds startup_indirect_dispatch to the build targets and startup_indirect_dispatch_warp to 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.cpp then run: command list slot name checks passed.
  • Three mutations of 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 with git 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_dispatch and every D3D12 run (no Windows, MSVC or physical adapter here), so I could not mutate the d3d12_xs_device.cpp changes. 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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6046362130 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1867#pullrequestreview-6046362130). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T19:56:31Z. **Review:** COMMENTED --- Review of `749009ff` (merge base `0631667d`; `origin/main` is now `dd753176`, `git merge-tree` merges 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_state` emits `transition(COMMON -> INDIRECT_ARGUMENT)` for a resource that is not yet in `pass.states`. The only guard is `info->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 to `COMMON` (`startup_indirect_dispatch.cpp` line 162) just before the guest `ExecuteIndirect`. If anything earlier on the same list leaves the buffer in another state that is not in `pass.states` (a native or earlier-forwarded UAV write, a copy), the barrier's `StateBefore` is 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 - **ABI.** `list_execute_indirect(self, signature, count, argument, offset, count_buffer, count_offset)` matches the seven-argument `ListTyped` dispatch (4 registers + 3 stack words) and the desktop `ExecuteIndirect` shape. `count` is a `UINT`, so the upper register bits are ignored. - **Bounds and offsets.** `offset & 3`, `offset > ~0 - base` (no wrap), and `placed_buffer_range(device, base + offset, 12)` with `found.owner == buffer` and no `reject`. Short range and unmapped argument are covered by the fixture. - **Command signature.** Only a rootless signature with stride 12, one argument of type Dispatch is tagged (`dispatch_signature_device`), and the list's device must match. A placeholder signature (`real == nullptr`) is refused. - **State at the end.** The new state is recorded in `pass.states`, so `release_targets` at Close moves it back to COMMON and resets the `Pass` (including the new `compute_pipeline`/`compute_root` flags). ## P3 - **Scope of "GPU-written".** Only slot 61 and `SetComputeRootSignature` (slot 33) are forwarded. A guest `Dispatch`, 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 pipelines only from streams.** `compute_pipeline` is 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). - **Slot 33 is now forwarded for every render-mode list**, not only for indirect dispatch. It is skipped for root signatures that use heap flags, but it is a wider effect than the title suggests. - **Pipeline and root are not checked against each other** before `ExecuteIndirect`; a mismatch would be left to the debug layer. - **Provenance.** The slot and argument shape are justified with links to two other projects' source files. I did not open them; the maintainers should decide whether that is the evidence they want under their clean-room rule. - **Header comment.** `command_list_slot_names.h` loses "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. - **Presets.** `CMakePresets.json` adds `startup_indirect_dispatch` to the build targets and `startup_indirect_dispatch_warp` to 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.cpp` then run: `command list slot name checks passed`. - Three mutations of `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 with `git 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_dispatch` and every D3D12 run (no Windows, MSVC or physical adapter here), so I could not mutate the `d3d12_xs_device.cpp` changes. 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.
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
R0Y00/Xbox2Windows!1860
No description provided.