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. |
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.
d037e27 to
61f0e76
Compare
|
Updated head to
Receiptsctest --preset dev --no-tests=error -R '^(startup_root_constant_store|startup_compute_dispatch_root|startup_list_dispatch)' -V
ctest --preset release --no-tests=error -R '^(startup_root_constant_store|startup_compute_dispatch_root)' -V
|
|
@R0Y00 — gentle ping on this PR. Main is merged cleanly and all CI / Win2025 WARP checks (dev & release) are green; it's just waiting on the matched baseline/candidate title run when one of you has a window. |
pigalot
left a comment
There was a problem hiding this comment.
Independently reviewed 61f0e76e integrated over main c1de64a5 (tree 337e949c). The merge is clean (CMakeLists.txt, d3d12_draw.inl and d3d12_xs_device.cpp auto-merged) and git diff --cached --check origin/main is clean.
Earlier findings.
- R0Y00 on
8cdc5589: the slot 45 subrange offset, therejectcheck and the 32-word native capacity are in the code. The subrange is pinned: dropping+ offsetfails the fixture withsentinel at offset 0: 0x00000039. R0Y00's last comment, ond037e277, asked to reapply the native delta on the shared root/dispatch base. This head does that in the shape tedin7 suggested: no second slot 14/37/39 handler, a widerx2w_root_constants::Store, and slot 45 throughbind_compute_root_view. - What did not carry over:
d037e277forwarded slot 37/39 only after checking the active parameter's type and declared range. In this head, that check now decides only the store's capacity. The forward to the desktop list happens whenever a desktop compute root is bound. That is the finding below.
What I ran. Full dev and release builds of the trial merge, then:
ctest --test-dir out/build/<preset> --no-tests=error -j 1 -E hardware -R '^(startup_root_constant_store|startup_compute_dispatch_root_warp|startup_list_dispatch.*|startup_compute_root|compute_root_warp|startup_indirect_root_constants_warp|startup_compute_binding_trace_warp|startup_compute_dispatch_.*_warp|startup_compute_dispatch_warp|startup_compute_root_srv_dispatch_warp)$'
python with_gpu_lock.py ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^(startup_compute_dispatch_root_hardware|startup_list_dispatch_native_hardware|startup_compute_dispatch_hardware|startup_compute_dispatch_native_hardware|startup_compute_root_srv_dispatch_hardware|startup_indirect_root_constants_hardware|compute_root_hardware)$'- WARP: 23 of 25 pass in each preset.
startup_compute_dispatch_native_warpis the existing capability skip ("the adapter has no 32-lane waves").startup_compute_dispatch_warpfails in Debug and Release, 3 of 3 runs:RuntimeError: dispatch-wrong-root: consumer exit 3221225477(0xC0000005).- On
mainc1de64a5, with the same build directory rebuilt, it passes 3 of 3.
- Hardware: 7 of 7 pass in each preset, including the PR's
startup_compute_dispatch_root_hardware.
Finding 1: slots 37, 39 and 45 forward to root parameters that the bound desktop root does not declare.
list_compute_constant(s) start from the translated default capacity = 8. They raise it only when compute_params names a 32-bit constants parameter at that index. They then call SetComputeRoot32BitConstant(s) whenever pass.desktop_compute_root is set, parameter < 16 and the range fits that capacity. A parameter past NumParameters, or one of another type, therefore still reaches D3D12. list_compute_root_uav checks the type only when parameter < compute_params->size(), so a parameter past the end is bound too.
- An existing test from
maincrashes.startup_compute_dispatch_warpdispatch-wrong-rootsetsslot67_other_root, a root with no parameters, then calls slot 37 for parameter 0. The bisect: with the two new forwarding blocks inlist_compute_constant(s)removed, and everything else the same, the test passes again. Reverting theroot_srv_onlywidening or the slot 45 registration instead leaves it failing. I didn't check which tests CI runs. The PR body's ctest filter does not include this one. - Probes on the PR's own fixture (WARP, debug layer on). One call was added after the slot 37 write, the fixture rebuilt, then restored:
| Added call | Result |
|---|---|
| none | exit 0, 57 at byte 256, sentinel kept, 0 debug errors |
| slot 39, parameter 0 (the root UAV), 1 word | exit 70. SetComputeRoot32BitConstants: The currently set root signature declares parameter [0] with type UAV, so it is invalid to set root constants here. |
| slot 37, parameter 0 | exit 70, the same error for SetComputeRoot32BitConstant |
| slot 39, parameter 2 (the root has 2) | exit 0xC0000005 |
| slot 45, parameter 2, the valid subrange | log compute root UAV 2: title … -> desktop 0x200000100, then exit 0xC0000005 |
Suggested direction (unconfirmed): forward only when compute_params is set, parameter < compute_params->size(), the parameter has the slot's type, and (for 37/39) offset/count fit its constants_count. The d037e277 version did this for 37/39. Graphics list_root_srv does the same before it forwards. A fixture call for each of the cases above would pin it, for example one with no debug error and the 57 readback unchanged.
Finding 2: slot 45 binds title memory that no placed buffer covers as a desktop GPU address. If list_upload_gpu misses and placed_buffer_range returns no owner and no reject, the branch else if (!placed.owner && …) desktop = address; passes the title CPU address to SetComputeRootUnorderedAccessView. Probe: one extra slot 45 call on parameter 0 with a fresh 64 KiB VirtualAlloc, before the fixture's valid bind.
- With the debug layer off, the log shows
compute root UAV 0: title 0x298e4850000 -> desktop 0x298e4850000. Then the valid bind replaces it and the readback is still 57. - With
X2W_D3D12_DEBUG=1, the process ends inside that slot 45 call with exit code 2173, before the shim's log line. I did not find what ends it.
A title address is not a desktop GPU virtual address. I suggest refusing (and logging) this case, as the slot 67 output path does for "an output is not an aliased placed buffer range", rather than binding it.
Mutants (each applied alone, full dev build, the WARP set above minus the failing startup_compute_dispatch_warp, sources restored from their raw bytes, git diff --quiet clean afterwards):
| Mutant | Result |
|---|---|
| slot 45 binds the base VA (offset dropped) | killed: startup_compute_dispatch_root_warp, sentinel at offset 0 is 0x39 |
| slot 39 forward range check dropped | killed: debug-layer error on SetComputeRoot32BitConstants |
| slot 37 forward range check dropped | killed: debug-layer error on SetComputeRoot32BitConstant |
| slot 39 stores at the translated 8-word capacity | killed: startup_compute_dispatch_root_warp |
| dispatch treats an unset root SRV as bound | killed: startup_list_dispatch_native_warp |
root_srv_only widening reverted |
killed: startup_compute_dispatch_root_warp |
| store: 32-word mask without the full-width case | killed: startup_root_constant_store ("all 32 words bound with capacity 32") and startup_compute_dispatch_root_warp |
slot 45 ignores placed.reject |
survives |
| slot 45 parameter type check dropped | survives |
| slot 45 alignment check dropped | survives |
| dispatch treats an unset root UAV as bound | survives |
| dispatch treats unset root constants as bound | survives |
7 of 12 are killed. The five survivors are new checks with no fixture that reaches them: a rejected placed range, a slot 45 bind to a non-UAV parameter, a misaligned slot 45 address, and a dispatch with a declared root UAV or constants parameter left unset. Each needs one fixture call plus an assertion that the dispatch is refused or the bind is dropped. The all_bound refusal is new behaviour in this PR, so its UAV and constants arms should be pinned like the SRV arm already is.
Non-blocking.
- Several comments still describe slot 45 as not forwarded:
bind_compute_root_view's header, the fixture-hook comment abovex2w_d3d12_fixture_compute_root_uav, andstartup_list_dispatch_check.cpp:61. Theroot_srv_onlyfield comment ("every parameter a root SRV") now also covers root UAVs and constants. render_dispatches/render_dispatches_skippedare declared and never used.Pass::compute_root_addressis written by slot 45 and never read.- The fixture's three out-of-range controls check only that nothing reaches D3D12 (no debug error). The store still keeps the truncated words. That is fine for dispatch, but no assertion reads them.
Verdict: changes requested on 61f0e76e, for finding 1 (it breaks startup_compute_dispatch_warp from main), finding 2 and the five surviving mutants. R0Y00's changes-requested review on 8cdc5589 also still stands.
Environment: AMD Ryzen 7 9800X3D, NVIDIA GeForce RTX 5090 driver 32.0.16.1088, WARP 10.0.26100.9818, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Python 3.12.10, D3D12 debug layer on (X2W_D3D12_DEBUG=1, as registered) except in the one probe marked off.
CI: Build and test on Windows, Assemble and translate gfx1013 fixtures and Run platform-independent Python checks on Linux pass on 61f0e76e.
This reply was AI-assisted.
61f0e76 to
9829040
Compare
|
Updated head to 1. Root Parameter Type and Range Gating (Finding 1)
2. Disallow Unplaced Host Memory as GPU VA (Finding 2)
3. Mutant Coverage in Synthetic FixtureAdded negative controls and assertions in
4. Non-blocking Cleanups
Test Receiptsctest --preset dev --no-tests=error -R '^(startup_root_constant_store|startup_compute_dispatch_root|startup_list_dispatch.*|startup_compute_root|compute_root_warp|startup_indirect_root_constants_warp|startup_compute_binding_trace_warp|startup_compute_dispatch_warp|startup_compute_root_srv_dispatch_warp)$' -V
ctest --preset dev --no-tests=error -R '^(startup_compute_dispatch_root_hardware|startup_list_dispatch_native_hardware|startup_compute_root_srv_dispatch_hardware|startup_indirect_root_constants_hardware|compute_root_hardware)$' -V
ctest --preset release --no-tests=error -R '^(startup_root_constant_store|startup_compute_dispatch_root|startup_compute_dispatch_warp)' -V
|
|
Thanks for the update to 1. Root constants are not set again after a shim compute pass. 2. The five mutants that survived the previous review still look unpinned. The
Two smaller points:
CI ran This comment was AI-assisted. |
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.
9829040 to
d0ccda2
Compare
|
Thanks @JohnConnorNPC for the detailed and thorough review! I have addressed all points and rebased the branch on current Changes Summary
Test Receiptsctest --preset dev --no-tests=error -R '^startup_compute_dispatch_root_' -Vctest --preset dev --no-tests=error -R '^(startup_root_constant_store|startup_compute_dispatch_root|startup_list_dispatch.*|startup_compute_root|compute_root_warp|startup_indirect_root_constants_warp|startup_compute_binding_trace_warp|startup_compute_dispatch_warp|startup_compute_root_srv_dispatch_warp)$' -V
ctest --preset dev --no-tests=error -R '^(startup_compute_dispatch_root_hardware|startup_list_dispatch_native_hardware|startup_compute_root_srv_dispatch_hardware|startup_indirect_root_constants_hardware|compute_root_hardware)$' -V
ctest --preset release -R '^startup_compute_dispatch_root_' -V
|
|
Thanks for the quick turnaround on One thing I think still needs a change before merge: The restore case passes even without the new replay loop. Its stand-in for a shim pass is Smaller points:
This comment was AI-assisted. |
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>
|
Thanks for the re-review of The restore case now fails without the replayThe fixture creates a second root signature from the same serialized layout (UAV at parameter 0, 32 constants at parameter 1) and writes its own arguments through it before
A cut write no longer leaves the store and the desktop list disagreeing
Store test cases
The four mutation-table rowsYou were right on all four; I corrected the table rather than adding cases that cannot observe them:
Mutations actually run at
The +128 and +384 sentinels from the previous head still kill the unset-constants, unset-UAV and misaligned-address mutants, and the 57→59 readback still kills word-31 truncation. Docs
ReceiptsHead ctest --preset dev --no-tests=error -j 1 -R '^(startup_list_dispatch.*|startup_compute_dispatch_root_(warp|hardware)|startup_root_constant_store|startup_compute_dispatch_(warp|hardware)|compute_root_hardware|startup_compute_root_srv_dispatch_hardware|startup_indirect_root_constants_hardware)$'
Both fixture backends print the same lines:
Not covered by these runs: no NVIDIA or Intel GPU; the same-layout root is a stand-in for a shim compute pass, not an actual indexed-draw validation; mutations were dev builds only. AI-assisted. |
Summary
Rebased onto current
mainand updated to match the existing shared dispatch and compute root infrastructure (#1974, #1975, #2532):x2w_root_constants::Storeto support capacity up to 32 words per parameter for native slot 86 roots while preserving the 8-word default for translated compute. Forward valid 32-bit root constants to the desktop command list whendesktop_compute_rootis bound.list_compute_root_uavwith placed buffer subrange offset translation to desktop GPU virtual addresses, routed throughbind_compute_root_viewsorestore_compute_rootreplays it after shim passes.main's canonicallist_dispatchwithdecide_dispatchvalidation, updating parameter forwarding classification inDevice::CreateRootSignatureand checking that all declared compute parameters (SRV, UAV, constants) are bound prior to forwarding.tests/startup_compute_dispatch.cpp(startup_compute_dispatch_root_<backend>) testing WARP and hardware backends, verifying 32-word native root constants with range checking, placed buffer subrange UAV dispatch, sentinel preservation at byte 0, readback of 57 at byte 256, and zero debug layer errors.Verification & Evidence
Unit tests and linters:
devpreset test results:releasepreset test results:57, sentinel0x11111111, debug errors: 0, removed: S_OK.57, sentinel0x11111111, debug errors: 0, removed: S_OK.