Skip to content

d3d12: compute dispatch root-binding review follow-up - #3343

Open
romn4rch wants to merge 3 commits into
R0Y00:mainfrom
romn4rch:copilot/pr-2491-review-088f7f23
Open

romn4rch wants to merge 3 commits into
R0Y00:mainfrom
romn4rch:copilot/pr-2491-review-088f7f23

Conversation

@romn4rch

Copy link
Copy Markdown
Contributor

Replacement submission for #2491. This branch contains the existing compute root-binding and Dispatch work plus the verified review follow-up commit. The original PR remains open because its author-owned branch was not writable from this account; these PRs overlap in scope, so please keep only one submission and close/mark the other as superseded when choosing.

Validation: the WARP/hardware compute-dispatch fixtures, native Dispatch WARP fixture, and root-constant store test passed (4/4).

Holastor and others added 3 commits November 28, 2026 13:00
Extend x2w_root_constants::Store to support capacity up to 32 words per
parameter for native slot 86 roots while preserving the 8-word default for
translated compute. In list_compute_constant and list_compute_constants, forward
valid 32-bit root constants to the desktop command list when desktop_compute_root
is bound.

Implement list slot 45 (SetComputeRootUnorderedAccessView) in d3d12_xs.dll,
translating guest placed buffer subrange offsets to desktop GPU virtual addresses
and routing through bind_compute_root_view so restore_compute_root replays it.

Update restore_compute_root to replay all bound 32-bit root constants in addition
to root SRVs and UAVs after an intervening shim compute pass.

Update CreateRootSignature and list_dispatch to consider compute root parameters
forwarded and check that all declared root parameters are bound before dispatch.

Add synthetic fixture tests/startup_compute_dispatch.cpp exercising WARP and
hardware backends, verifying root constant bounds checking, full 32-word native
root constants with vector padding, restoration across shim passes, and placed
buffer subrange UAV dispatch with dedicated sentinels pinning unset/invalid states.
The restore fixture now clobbers the constants and the UAV through a
same-layout root before x2w_d3d12_fixture_restore_compute_root, so the
replay loop is required for the dispatch to read 59; without it the
fixture reads 0 at the subrange or writes at the clobbered UAV.

store_root_constants returns the words it kept and slots 37/39 forward
exactly that span, so a cut write no longer marks words bound while the
desktop list stays unset. The fixture dispatches after a 33-word write
to the 32-word parameter and must read 39 at offset 448.

Pin is_bound's full-width mask and both capacity guards in the store
test, rename the unbound-root refusal to cover UAVs and constants, and
update the slot 14 docs and the README row.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

@KelboLive KelboLive left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — solid follow-up that extends compute dispatch forwarding to root UAVs and 32-bit constants alongside root SRVs.

  • store_root_constants returns words kept so the forwarder emits exactly the words both sides store, preventing drift.
  • Slots 37/39 validate parameter type and clamp capacity to the declared constant count.
  • Slot 45 handles upload and placed-buffer UAVs with alignment checks.
  • restore_compute_root replays all constant words after a shim compute pass clobbers the desktop root.
  • decide_dispatch checks SRV/UAV/constants individually rather than a single bitmask.
  • Root constant store capacity expanded to 32 words with a 32-bit bound mask (avoids full-range mask wrap).
  • New test uses sentinel pins at offsets 0/128/384 to catch mutants that relax binding checks.

Error messages generalized consistently across the codebase.

@KelboLive KelboLive left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — solid follow-up that extends compute dispatch forwarding to root UAVs and 32-bit constants alongside root SRVs.

  • store_root_constants returns words kept so the forwarder emits exactly the words both sides store, preventing drift.
  • Slots 37/39 validate parameter type and clamp capacity to the declared constant count.
  • Slot 45 handles upload and placed-buffer UAVs with alignment checks.
  • restore_compute_root replays all constant words after a shim compute pass clobbers the desktop root.
  • decide_dispatch checks SRV/UAV/constants individually rather than a single bitmask.
  • Root constant store capacity expanded to 32 words with a 32-bit bound mask (avoids full-range mask wrap).
  • New test uses sentinel pins at offsets 0/128/384 to catch mutants that relax binding checks.

Error messages generalized consistently across the codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants