Repository navigation
Runtime: milestone M4 synthetic gate — copy/compute queues with cross-queue fences, compute PSO, UAV buffers and image, ExecuteIndirect dispatch (error 0) - #1791
Conversation
…copy queues; buffer UAV views and indirect dispatch state d3d12_m4_compute_test, through the proxy with D3D12 API only and two translator-output compute shaders (cs_m4_fill.asm, cs_m4_indirect.asm): a COPY queue streams an input buffer in, a COMPUTE queue waits on it and runs a compute PSO over a UAV table (structured buffer, raw buffers, an R32_UINT RWTexture2D), then ExecuteIndirect of a second PSO from arguments the first wrote (with a transition to INDIRECT_ARGUMENT and UAV barriers), and a COPY queue behind a cross-queue fence reads the results back. 1,924 words match the CPU reference with error 0. Layer gaps the test found, fixed: - CreateUnorderedAccessView of a buffer was a stub: structured and raw views are now a V# in the slot. - ExecuteIndirect of a dispatch ran whatever pipeline and root arguments the command buffer had bound; the command now carries the list's, as Dispatch does. - An image created in UNORDERED_ACCESS and first used by a shader was zero-filled by the first barrier or copy that named it, losing the shader's writes; images with a UAV view are now moved to GENERAL (zeroed) at the next submission. - COMPUTE and COPY command lists no longer log "unimplemented". Test infrastructure: vk_test_device.h can create more than one VkQueue; build.py gives a compute shader's FSSM program extra words (fssm-at/fssm-data from 0x148) so two compute shaders with the same group size get distinct hashes, and honours LEONIDA_SPIRV_TOOLS (as ItsNotRexed#1679) so the target builds under the Visual Studio generator. docs/d3d12_vulkan.md section 6: M4 synthetic part met; M3 row credits @whattheflop's ItsNotRexed#1584 measurement of fences in flight. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independently verified commit
AI Assisted. |
|
Independently tested the stock synthetic M4 gate (D3D-235) at
On each adapter the stock comparator matched 256 input words, 1,024 structured-buffer words, 4 dispatch-argument words, 256 image words, and 384 indirect-output words. Both validation-only runs exited 0 with zero Vulkan validation warnings or errors and no skip. The shim logged three unknown-IID queries on each adapter and continued. I reviewed the shader accesses, resource states, and submission path before running. The stock path runs COPY upload and signals copy fence 1, then COMPUTE waits on copy fence 1, fills the UAVs, executes the indirect dispatch and signals compute fence 1. COPY then waits on compute fence 1, reads the buffers and image, and signals copy fence 2. Each producer signal is submitted before its dependent wait. The test uses a 20-second host fence wait and I set a 45-second CTest timeout. This exercises the synthetic portion of M4 in that submission order. Original M4 claim The runs were serial with one native ICD per process and an empty implicit-layer manifest directory. Loader logs confirmed the SDK Khronos validation layer loaded. Separate LunarG API-dump runs with validation enabled confirmed the synchronization-validation create flag and showed two distinct queried Build was native Windows 11 25H2 (26200.9974), MSVC 19.38 x64, Windows SDK 10.0.26100.0, Ninja 1.13.2, uv Python 3.12.13, and Vulkan SDK/validation 1.4.363.0. WSL LLVM 21.1.8 was used for AMDGPU assembly only. The D3D12 COM library built at both revisions. CTest registers Both synthetic shader modules passed
Test scope was the stock synthetic M4 case. AI-assisted (Codex). |
…ions, ordered for other queues - The zero-fill/GENERAL init of images with a UAV view no longer drains on a copy queue or in a submission that runs no dispatch or draw; every other queue's next submission waits on the initializing one's progress semaphore. - storage_pending_ is a set (UAV descriptors are rewritten every frame). - write_buffer_uav: FirstElement and element count are checked against Width / unit, so the byte range cannot overflow. - docs: M4 row names the remaining limitation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Retested the stock synthetic M4 gate at
One source-review concern outside this stock path: Built native x64 with MSVC 19.38, Windows SDK 10.0.26100.0, Ninja 1.13.2, uv Python 3.12.13, and WSL LLVM 21.1.8 for AMDGPU assembly only. The D3D12 COM library built at both revisions. M4 builds through the merged shader-tool path integration, and CTest has one M4 entry with
AI-assisted (Codex). |
|
Tested
This adds a third NVIDIA data point (RTX 3070, driver 621.01) alongside the RTX 5070/5080/3080 runs; the M4 gate is clean here too. No game data used. AI-assisted. |
…# in the slot), d3d12_buffer_uav_test CreateUnorderedAccessView on a buffer with a typed Format writes a typed V# (GFX10_FORMAT code, element size as stride, element count, OOB_SELECT structured, the format's own DST_SEL), and a structured view with pCounterResource + CounterOffsetInBytes writes a second raw 4-byte V# in the upper 16 bytes of the slot (a hypothesis for the console contract, documented in section 3.4). The combinations D3D12 documents as invalid leave a null slot. d3d12_buffer_uav_test runs two hand-written RDNA2 compute shaders through the translator (typed store/load/atomic on five formats with NUM_RECORDS as the bound; append by 256 lanes and consume by 128 on a counter at offset 4096, read back with CopyBufferRegion) against a CPU reference, then compares typed-buffer and counter clears with the host D3D12 runtime on the same adapter (LUID). Depends on: #1791 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What and why
This is the synthetic part of milestone M4 in
docs/d3d12_vulkan.md§6, claimed in #1548.d3d12_m4_compute_testuses only the D3D12 API and two hand-written RDNA2 compute shaders, translated at build time. It runs three stages behind cross-queue fences:RWTexture2D(a storage image).cs_m4_fillfills the buffer and the image from the input, and writes the arguments for the next dispatch.ExecuteIndirectwith a dispatch signature runscs_m4_indirectfor the group count the first dispatch wrote. It reads the buffer and image back.CopyTextureRegion.The copy and compute queues get their own
VkQueues where the device has them; both test GPUs do. All 1,924 result words match the CPU reference (error 0).Layer gaps the test found and closed:
CreateUnorderedAccessViewon structured and raw buffers was a stub. It now writes a V#. Typed buffer UAVs and counters remain stubbed.ExecuteIndirectof a dispatch ran whatever pipeline and root arguments happened to be bound. It now carries the list's pipeline and root arguments, likeDispatch.Docs:
Known gaps, not fixed here:
unsupported.The new target uses the
LEONIDA_SPIRV_TOOLSform from #1679, with the samebuild.pyhunk, so it also builds under the Visual Studio generator.Tested
Head
967564a2, on AMD Radeon 880M (26.11.2) and NVIDIA RTX 5070 Laptop (617.42), Windows 11:d3d12_m4_compute: 1,924 words exact, twoVkQueues, 0 validation errors withLEONIDA_VK_VALIDATION=1(synchronization validation included).d3d12_drawfails identically on a cleanmainbuild (bundle blend pixel (0, 0): got 255,0,0,255, expected red 64); reported in Coordinating who works on what (7) (moved to #1745) #1548.-G "Visual Studio 17 2022" -A x64as well.tests/test_ctest_registration.pyandtests/test_shader_checks.py: 62 passed.Checklist
SKIP_RETURN_CODE 77) and as a D3D12-harness fixture inrun_gpu_tests.pyAI-assisted (Claude Code).
🤖 Generated with Claude Code