Repository navigation
test: trace GPU-written indirect Dispatch to offscreen pixels - #3222
Conversation
R0Y00
left a comment
There was a problem hiding this comment.
Independently reviewed 3228f8c9 over main fad97f47 (clean trial tree 106b6cf6). The test records the actual placed resource and byte range before and after the GPU writer and before ExecuteIndirect, checks both fenced snapshots and guard words, and reads the GPU-written compute output directly in the offscreen observer. The stale-SRV draw is a discriminating pixel control. The patch is confined to the source fixture and its reproduction note.
I built startup_stream_consumer d3d12_xs_shim compile_dxil startup_indirect_dispatch and ran ctest --test-dir <build> --no-tests=error -j1 -V -R '^(startup_slot67_indirect_dispatch_(warp|hardware)|startup_indirect_(dispatch|root_constants|count|count_split)_(warp|hardware))$'. Debug and Release /O2 each passed 10/10, no skips. Both WARP 10.0.26100.9818 and RTX 4060 Laptop driver 32.0.16.1656 exercised the writer, zero, omitted-writer and stale-SRV cases. Windows 11 26200.9974; the slot-67 fixture reported debug layer enabled. python -B tests/startup_slot67_indirect_dispatch_check.py mutation, docs links and required hosted Windows all passed. This is source-built evidence for #3209.
pigalot
left a comment
There was a problem hiding this comment.
I reviewed 3228f8c9 merged over main fad97f47. The merge is clean (tree 106b6cf6) and git diff --cached --check is clean.
What I traced.
- Writer stage: it is submitted on its own and fenced at value 1. The seven-DWORD record is read back there.
- Second snapshot:
capture_before_consumercopies the same placed resource on the guest list just before slot 61. It checks the native resource pointer and GPU VA against the writer's. - Observer:
- it runs on the same native DIRECT queue after fence 2;
- it binds the translated output itself as a root SRV;
- it discards the
0xc5c5c5c5sentinel and writes the low three bytes as UNORM8, which is exact for 0..255; - its clear and draw captures are separate copies, so an undrawn target can't pass as all-sentinel.
- Stale-SRV control: it binds
placed[0](the input). It must fail the positive oracle and match its own predicted colours, so the observer really reads the buffer it names. - Python check: it asserts the stage order on stdout, both identity pairs and both argument snapshots. Debug-layer messages of severity error or above fail the run.
- Scope: only tests and docs change, and the docs extend the existing slot-67 section.
What I ran. I built d3d12_xs_shim startup_stream_consumer startup_indirect_dispatch in dev and release, then ran:
ctest --test-dir out/build/<preset> --no-tests=error -j 4 -R '^(startup_slot67_indirect_dispatch_warp|startup_compute_dispatch[a-z0-9_]*_warp|startup_compute_root_srv_dispatch_warp|startup_indirect_dispatch_warp|stream_root_srv_warp)$'
python .agentic\scripts\with_gpu_lock.py ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^(startup_slot67_indirect_dispatch_hardware|startup_compute_dispatch_hardware|startup_indirect_dispatch_hardware)$'- Results: in both Debug and Release
/O2, 13 of 14 WARP tests pass and 3 of 3 hardware tests pass, with no skips. - The one failure is not from this PR.
startup_compute_dispatch_native_warpfails with "the native route left ['revision.txt'] in the cache", and it fails the same way onmainfad97f47. - Hardware coverage:
startup_slot67_indirect_dispatch_hardwarematched all five pixel cases on the RTX 5090:- 8/32 and 20/32 pixels changed for X=2 and X=5;
- 0/32 for the zero record and for the omitted writer;
- the stale-SRV case was rejected by the positive oracle;
- the debug-layer queue reported no errors.
- Negative control: on
mainfad97f47, the PR'sstartup_slot67_indirect_dispatch_check.pyagainstmain'sstartup_stream_consumerfails at the first pixel case (('2', 'compute output mismatch')). Thedispatch-indirect-pixel-*modes don't exist there.
Mutants in src/startup_stubs/d3d12_compute_dispatch.inl. For each, I rebuilt in dev and ran startup_slot67_indirect_dispatch_warp:
| Mutant | Result |
|---|---|
ExecuteIndirect argument offset one DWORD late |
killed |
CPU Dispatch(x, y, z) instead of the GPU-read arguments |
killed |
Restored and rebuilt afterwards; git diff --quiet is clean.
Non-blocking.
- The new stage on its own: both runtime mutants would also be caught by the existing 320-word output check. What the new stage adds on its own is the fence split, the two argument snapshots and the pixel observer, whose distinguishing control is the stale SRV.
- Pixel coverage: the observer reads only the first 8 output words (
position.x, repeated over 4 rows). A word whose low 24 bits are zero would look like the clear colour. No word in the fixture has that pattern, and the 320-word compare covers the rest.
Verdict: approve on 3228f8c9.
Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088 and WARP, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Windows SDK 10.0.28000.0 DXC, Python 3.12.10; the observer's info queue was available on hardware.
CI: Build and test on Windows passes on 3228f8c9.
This reply was AI-assisted.
Closes #3209. Reuses #2492 / #2771 and the existing compute and graphics test helpers; related: #3211, #3213, #1759, #3074.
Scope
Extend the existing synthetic slot-67 indirect fixture rather than adding a new runtime path, executable or dependency. The GPU writer stores a 12-byte Dispatch record at byte interval [4,16) in the actual placed argument resource, with a leading DWORD guard and a three-DWORD neighboring guard at [16,28).
Actual local evidence
Final commit 3228f8c, rebased onto main 9345c21 (including merged #3217). Debug and Release, RX 7900 XT (32.0.32029.2010) and WARP (1.0.22.0), app-local Agility SDK 1.620.2.
All 20 cases across the four adapter/configuration combinations passed. 6,400 output DWORDs, 280 argument/guard DWORDs and 1,280 captured RGBA8 pixels checked.
Example: final Release RX 7900 XT, X=5 (addresses are process-specific):
The existing indirect controls remain intact. Device-free mutation oracle and documentation link check pass (122 Markdown files, 621 links).
Expanded regression: 23/25 passed in each configuration (Debug 14.05s, Release 12.36s), no skips. Two unrelated native-compute tests fail identically on a clean, unmodified main 2e12dd8 baseline:
Separate evidence: #3213 (comment). Neither unrelated failure was hidden or changed in this PR.
Reproduction
Repeat with the release preset. Expanded regression filter:
The compute consumer uses the existing offline translator/DXC path. The graphics observer is desktop HLSL, not a translated title graphics shader. This is an offscreen synthetic end-to-end proof, not retail scene rendering or a performance claim. The D3D12 debug layer was unavailable locally. No production change was needed for this fixture.