Repository navigation
Conversation
R0Y00
left a comment
There was a problem hiding this comment.
This branch also carries the three slot 70 backing commits from #2395, which the slot 86 native compute fixture does not need. Please put the final compute commit on current main or name the actual dependency if one exists. #2470 and #2490 work on translated slot 67 pipelines, while this fixture uses a real slot 86 compute PSO. Please coordinate the common command-list slots and test both paths after choosing the order. Keep the 57 readback and no-bound-pipeline controls on the native path.
f90ed35 to
9ad7cb3
Compare
|
Done — the branch now carries only the single compute dispatch commit ( On coordination with #2470 and #2490: those PRs operate on a translated slot 67 (placeholder) compute pipeline through The 57 readback and no-bound-pipeline controls are both present on the native path: Command: |
Built and run here: both cases pass, and four mutations separate into the two that matter and the two the fixture never reaches
Four mutations of
|
| mutation | result |
|---|---|
zero-sized Dispatch no longer rejected (if (!x || !y || !z) return; → if (false) return;) |
caught |
if (parameter >= 16) return; → >= 17 |
survived |
heap-type test relaxed (if (heap.type != … CBV_SRV_UAV) continue; → if (false) continue;) |
survived |
dispatch whenever a pass exists (pass.pipeline_real && pass.compute_pipeline → true) |
caught |
The two caught ones are exactly the halves I would want asserted. Zero-sized dispatches are illegal in D3D12 and must
not reach ID3D12GraphicsCommandList::Dispatch; and "only dispatch through a real compute pipeline" is the entire
point of the change — making it unconditional would dispatch through a placeholder and the fixture notices.
The two survivors are invalid-input guards the fixture never feeds
parameter >= 16: the fixture builds a two-entry root signature and touches parameters 0 and 1
(root_params[0]UAV,root_params[1]32-bit constants), so index 16 is never presented. A call withparameter = 16
should be dropped without touchingcompute_root_address[16]; one case would pin it.- heap type: the fixture creates
D3D12_HEAP_TYPE_DEFAULTandREADBACKcommitted resources and registers a
CBV/SRV/UAV heap, so a SAMPLER or RTV heap never reaches the descriptor-table path. A call with a SAMPLER heap
should be ignored rather than resolved against a descriptor range it does not own.
Neither survivor is a defect I can demonstrate — both guards look correct, they simply have no case whose behaviour
would change if they were removed. Both are cheap to add and both protect against an index or heap-kind mistake from
the title side, which is precisely the sort of thing a stand-in has to get right.
One thing I checked while reading
x2w_d3d12_compute_stats reports render_dispatches and render_dispatches_skipped separately, and the counters are
bumped before the early-return branches (if (n <= 3) log(...)). That means a skipped dispatch is countable without a
log line, which is what lets a fixture assert "one recorded, one skipped" rather than parsing logs. Worth keeping.
Environment
Windows 11 build 26300.9974; WARP (Microsoft Basic Render Driver) and the installed physical GPU; two cases as
registered in the branch's CMakeLists.txt. Each mutation was built, run, reverted and rebuilt; final state 2/2 green.
AI-assisted.
tedin7
left a comment
There was a problem hiding this comment.
Comment review of head 9ad7cb3 (code read against origin/main, no Windows run by me).
Checked on Linux: git diff --check origin/main...HEAD, python3 tests/docs_links_check.py, python3 tests/bidi_controls_check.py all clean. I could not build the C++ fixture here, so I did not run the code mutations; the mutation results already posted in this thread by ChazY11 are the only mutation evidence.
What looks right:
src/startup_stubs/d3d12_xs_device.cpp: slots 14, 35, 37, 39, 45 are forwarded only when a real compute pipeline / desktop compute root is bound, and the root-parameter type is checked before forwarding. Zero-size Dispatch is ignored and counted as skipped.- The fixture
tests/startup_compute_dispatch.cppreads back the UAV value (57) and has two negative controls, registered for warp and hardware inCMakeLists.txt.
Open question for @R0Y00 (design, not a bug):
- Several open PRs edit the same compute slots in the same file: #1975 (slots 37 and 39 root constants), #2470 and #2490 (translated compute Dispatch), #1441 (draft, desktop DXIL compute). This PR adds
list_dispatch(slot 14) and the compute root constant handlers (37, 39) too, so whichever lands second will conflict and may register a second handler for the same slot. - Please pick the order or the one owner of each slot. I am not merging this while the overlap is open.
- Also: the diff moves some existing
list_typed[...]lines (13, 36, 40, 42), which is churn unrelated to compute; consider leaving those lines where they were to ease the rebase.
Merge stays with @R0Y00 / MasterDomino. Win2025 WARP receipt for this head is still missing.
AI-assisted; commands listed were executed locally.
|
Hardware run and Windows 11 MSVC build at head Environment: Windows 11 Pro build 26300.9974, Debug ( Build: Tests:
Both tests print On the PR so far: the hardware run in the author's comment names Not covered by this run: NVIDIA only (RTX 3070 Ti); no AMD or Intel GPU; no Release build; the wider |
9ad7cb3 to
8cdc558
Compare
|
Rebased onto current main ( Verified on Windows 11 x64 (AMD Radeon RX 6600M & WARP):
PR is mergeable. |
R0Y00
left a comment
There was a problem hiding this comment.
Re-reviewed 8cdc5589 after the branch was narrowed to the native slot 86 path. The exact 57 readback and the missing-pipeline case are useful. Two root-binding cases still need coverage before this can merge.
- Slot 45 finds the owning placed buffer for an interior guest address and binds the desktop resource's base GPU VA in both branches. A valid subrange therefore writes the beginning of the buffer. Reuse the validated placement and add the guest byte offset to the desktop GPU VA. Check
rejectbefore considering any desktop-address path. Please dispatch into a nonzero aligned subrange and read back both it and the sentinel before it. - Slot 39 uses the original count in
1u << countafter storing only the first eight words, and forwards the original count to the desktop root. A legal native root with 32 DWORDs can reach a shift outside the width, and a count past the bound of the active parameter gets forwarded. Keep the native and translated constant capacity explicit and check the active parameter's declared range. Exercise a native root with 32 constants and an out-of-range write.
Please also add a real slot-35 descriptor-table readback if keeping slot 35 in this PR. The current fixture uses root constants and a root UAV only. The handler resolves a view table but sends the original handle to D3D12, so a distinct guest and desktop handle is the useful comparison. This is a source review finding; I did not run those three new cases.
8cdc558 to
cc447ed
Compare
|
Rebased onto current main (
PR is mergeable. |
Implement list slots 14 (Dispatch), 33 (SetComputeRootSignature), 37 (SetComputeRoot32BitConstant), 39 (SetComputeRoot32BitConstants), and 45 (SetComputeRootUnorderedAccessView) in d3d12_xs.dll. Validate active compute parameter ranges for 32-bit root constants and bound translated constant stores. For root UAVs, validate placed buffer allocations, check rejection before raw GPU VA fallback, and translate guest interior addresses to desktop GPU virtual addresses using the validated placement offset. Add synthetic fixture tests/startup_compute_dispatch.cpp exercising WARP and hardware backends, verifying root constant bounds checking, full 32-word native root constants, placed buffer subrange UAV dispatch with sentinel preservation, and diagnostic counter tracking.
cc447ed to
d037e27
Compare
|
Updated in commit d037e27 against 1. Slot 45 (
|
|
I reran |
tedin7
left a comment
There was a problem hiding this comment.
Comment review of head d037e277, as @R0Y00 asked: what this PR still adds after #1974, #1975 and the #2470 work that landed through #2532. Code read against current main. I did not build it.
The branch conflicts with main in src/startup_stubs/d3d12_xs_device.cpp (git merge-tree --write-tree origin/main d037e277). Most of it is now on main in a different shape:
- Slot 14
Dispatch: already onmain(#1974).list_dispatchfirst tries the translated slot 67 path (dispatch_translated). Then it forwards only afterx2w_startup::decide_dispatchaccepts the bound desktop compute pipeline and root, the root/pipeline match and the bound root arguments, and it logs a reason when it refuses. The PR'slist_dispatch(pipeline_real/compute_pipelineplus a skip counter) duplicates this and should be dropped. - Slots 37 / 39 compute root constants: on
main(#1975), with one difference.list_compute_constant(s)store the words inpass.compute_constantsthroughstore_root_constants. That keeps 16 parameters of 8 words and logs anything dropped or truncated. The 32-DWORD native root that R0Y00 verified ond037e277(57 at byte 256) would be truncated to 8 words onmain. So the PR's real remaining delta here is native capacity: a native slot 86 root needs its declaredconstants_count(up to 32), not the translated store's 8. That fits best as an extension ofstore_root_constants/x2w_root_constants::Store, checked against the active parameter's declared range, not as a second handler. - Slot 45 compute root UAV: not on
main.mainrecords root UAVs only from the fixture hookx2w_d3d12_fixture_compute_root_uav, and its comment atbind_compute_root_viewsays slot 45 is not forwarded. The PR's slot 45 forwarding, with the placed-buffer subrange offset that R0Y00 checked (byte 0 kept at0x11111111, 57 at byte 256), is new. It should go throughbind_compute_root_viewsorestore_compute_rootreplays it after a shim compute pass. - Fixture
tests/startup_compute_dispatch.cpp(native slot 86 path): new and still useful. Keep the subrange and the 32-DWORD cases. They are the only device evidence for the two deltas above.
Suggested shape after updating to main: drop the PR's slot 14 / 37 / 39 handlers, raise the native constant capacity in the shared store, add slot 45 through bind_compute_root_view, and keep the fixture. R0Y00's changes-requested stays until R0Y00 clears it. No merge from our side.
Commands: git merge-tree --write-tree origin/main d037e277 (1 conflict, d3d12_xs_device.cpp), git show origin/main:src/startup_stubs/d3d12_xs_device.cpp and git show origin/main:src/startup_stubs/d3d12_draw.inl (list_dispatch, list_compute_constant(s), store_root_constants, bind_compute_root_view), git log -S decide_dispatch / -S list_compute_constants (#1974, #1975).
AI-assisted; commands listed were executed locally.
Summary
Implements forwarding of direct compute dispatch and compute root argument bindings on console command lists in
d3d12_xs.dll:Dispatch(x, y, z)SetComputeRootSignature(root_signature)SetComputeRoot32BitConstant(parameter, data, offset)SetComputeRoot32BitConstants(parameter, count, data, offset)SetComputeRootUnorderedAccessView(parameter, address)Validates active compute parameter ranges for 32-bit root constants and bounds translated constant shadow stores. For root UAVs, validates placed buffer allocations, checks rejection before raw GPU VA fallback, and translates guest interior addresses to desktop GPU virtual addresses using the validated placement offset.
When a real compute pipeline is bound, these calls are forwarded to the underlying desktop
ID3D12GraphicsCommandList. Also integrates withtrace_compute_bindingtelemetry and diagnostic statistics (x2w_d3d12_compute_stats).Verification & Evidence
Added synthetic fixture
tests/startup_compute_dispatch.cppverifying:val = scale * (10 + group.x) + bias + extra = 57) to UAV subrange0x11111111is preserved and offset 256 contains570x00000000(S_OK) and 0 debug layer errorsTested on both
devandreleasepresets:Output:
Output: