gpu: hand off leased XMem DispatchMesh arguments across queues #2324
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2332"
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 sydney-0o on 2026-11-25T12:41:16Z.
Refs #870, #1759 and #1914. Builds on #1916 (desktop single-record
DispatchMesh), #2280 (physical XMem page leases), and #2303 (queue waits and fence-based lease retirement for a mesh root SRV).DispatchMesh arguments
X2W_MESH_INDIRECT_XMEM=1enables a single rootless 12-byteDISPATCH_MESHrecord for the desktop mesh pipeline and a mirrored slot-133 placement. A source-built compute shader from #1916 writes{2,1,1}into a default-heap UAV. Slot 15 copies the record into the leased XMem view on the COMPUTE queue and submission publishes the copied range and its completion fence. Slot 61 verifies the live physical page and the full byte range at recording and submission. The DIRECT queue waits on the writer's fence, executes against that leased buffer inINDIRECT_ARGUMENTstate, and retains the lease until its own completion.The fixture identifies the compute producer. The runtime establishes provenance at the submitted slot-15 copy. The producer behind the observed application calls remains open in #1412.
Source-built controls
The mirrored CPU view held
{2,1,1}and both guard words survived after the writer fence.Validation
Release at local commit
0814a66awith the same tree as this PR head. Windows 10 19045.6456, Microsoft Basic Render Driver app-local WARP 1.0.22.0, Agility SDK 1.620.2, and the D3D12 debug layer enabled. Both WARP controls reported zero D3D12 warnings or errors. The GTX 1080 Ti (32.0.15.8278) returned capability skips for mesh shader cases.$warpand$agilitypoint to the local x64 runtime directories.$pythonand$dxcpoint to the test interpreter and the Windows SDK 10.0.26100.0 DXC.24 passed, 0 failed, and 9 capability skips. Both new WARP cases passed 10 consecutive runs each and are selected by the Windows pull request smoke preset.
git diff --check, the mesh86 Python proof, documentation link check, and bidi check also passed.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T12:45:57Z.
Review: COMMENTED
Review of head
4f7ea51e046988c3cc879e2cf6a49434f4d3820c(comment only).Summary: No P1 or P2 findings. The change generalizes the single-word SRV lease to a sized lease (4-byte SRV word or 12-byte
DISPATCH_MESHrecord) and adds a read path forExecuteIndirect. The logic reads consistently.Checked by reading the diff
src/startup_stubs/mesh_xmem_handoff.inl: the lease now carriesbytes.pin,matches, the overlap tests,placed_buffer_rangeat submit, and the log lines all use it. I found no leftoversizeof(UINT)that should have beenbytes.record_mesh_xmem_readkeeps the old SRV checks. These are the writer-in-same-recording refusal, the overlap refusal, the reserve-before-barrier ordering, and the size and alignment checks (4 bytes for a raw SRV, 4 for a record).bind_mesh_xmem_srvis now a thin wrapper, so the old caller behaves the same.src/startup_stubs/d3d12_xs_device.cpp:2694: the new branch is gated onmesh_xmem_indirect(), a non-cached mesh pass, and acopied_bufferplacement. A refusal returns beforeExecuteIndirect. With the flag off, the oldrequire_statepath runs unchanged.src/startup_stubs/list_copy.inl:199: the record is only tracked from a COMPUTE list, from a default-heap UAV-capable source, and with an exact 12-byte size.srv_wordstill needsmesh_xmem_handoff()plus an upload source. The two modes do not capture each other's copies.queue_executeand the drop/discard hooks now usemesh_xmem_tracking(), so the lease bookkeeping runs under either flag.Commands run locally on the PR head (Linux)
python3 tests/docs_links_check.py->Checked 18 Markdown files and 451 links.python3 tests/bidi_controls_check.py->Checked 1615 tracked source, script and build/CI files: no bidirectional controls.git diff --check origin/main...HEAD-> clean.gh pr checks 2332: Windows build and test, gfx1013 fixtures, and the Linux Python checks all pass. The CI log showsstartup_indirect_mesh_xmem_arguments_warpand..._skip_wait_warpas Passed. The PR is mergeable.Nits (non-blocking)
X2W_MESH_HANDOFFandX2W_MESH_INDIRECT_XMEMon, a write whose size differs from the active lease (lease->bytes != bytes,mesh_xmem_handoff.inlnear line 207) returns silently. It is safe, since no publication happens, but a one-line log would help diagnose a mixed configuration. A small test for that case would help too.startup_indirect_mesh_xmem_arguments*tests are C++ and D3D12 only. I did not run a source mutation of the new lease logic locally, because this Linux worktree cannot build or run them. The PR's own skip-wait control already shows the 4/8 vs 8/8 difference for the queue wait. I did not run Windows WARP for this review. The CI Windows job already ran both new tests.AI-assisted; commands listed were executed locally.