Repository navigation
Runtime tests: run the M5 mesh gate on 32-wide GPUs through --wave64-emulate (depends on #3777) - #4236
Runtime tests: run the M5 mesh gate on 32-wide GPUs through --wave64-emulate (depends on #3777)#4236tedin7 wants to merge 23 commits into
Conversation
…ad recording, 5120-SRV table, pipeline cache) Test d3d12_m5_world_test (D3D12 API only, translator-output shaders, every pixel against a CPU reference): (a) five ExecuteIndirect calls (DRAW and DRAW_INDEXED signatures, CPU- and GPU-written records at offsets in placed buffers, count buffer, count 0, count above MaxCommandCount), (b) four threads recording four lists run in one ExecuteCommandLists, eight rounds, (c) a descriptor table of 5120 SRVs of distinct textures read at a byte offset from a root constant, (d) a PSO created twice through the device's VkPipelineCache. Layer gaps fixed on the way: - ExecuteIndirect draws carry the list's graphics state and replay as whole draws; they used to replay as a bare vkCmdDraw*Indirect outside any render pass with no pipeline bound. - multiDrawIndirect, drawIndirectCount and drawIndirectFirstInstance are enabled on the layer's device where present (VulkanDeviceInfo::multi_draw_indirect / draw_indirect_count); without multiDrawIndirect each record is its own call. - One VkPipelineCache per device for every graphics and compute pipeline (was VK_NULL_HANDLE), with VkPipelineCreationFeedback hit counting (rt::d3d12::pipeline_cache_stats). Section 6 M5 row: synthetic part met except mesh shaders (D3D-29). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ature flags, test leniency - A draw-kind ExecuteIndirect with no graphics state is unsupported at prepare unless it is marked raw (ExecuteIndirect::raw, set by the unit tests that wrap the call in rendering themselves). - Calls take at most VkPhysicalDeviceLimits::maxDrawIndirectCount records (ReplayFunctions, VulkanDeviceInfo). - VulkanDeviceInfo::draw_indirect_first_instance is recorded; the layer logs once when it is absent. - VulkanDeviceInfo::draw_indirect_count defaults to false. - d3d12_m5_world_test: without drawIndirectCount the count-buffer calls are left out; pipeline-cache checks only run when the driver returns valid creation feedback, and size equality only when both sizes are known. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # runtime/src/vulkan_replay.h
The fixed-count loops added a full chunk to a 32-bit cursor, so a short final chunk could wrap it and restart at argument offset 0 (MaxCommandCount UINT32_MAX with maxDrawIndirectCount 0x80000000). Found by @Vonsek in review of ItsNotRexed#1865. d3d12_state_map now checks the calls (counts and offsets, not records) for both draw kinds with a huge count and for a limit that does not divide the count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…wing without bound A cursor that wraps again now ends the loop with a failed check rather than appending until memory runs out. Checked by lowering the cap to 1: the check fails at the call. Suggested by @Vonsek in ItsNotRexed#1865. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # docs/d3d12_vulkan.md # runtime/CMakeLists.txt # runtime/src/command_list.h # runtime/src/vulkan_replay.h # scripts/run_gpu_tests.py
# Conflicts: # runtime/CMakeLists.txt # runtime/src/vulkan_backend.h # scripts/run_gpu_tests.py
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # docs/d3d12_vulkan.md # runtime/shims/d3d12_com.h # runtime/shims/d3d12_vulkan_device.cpp
# Conflicts: # runtime/shims/d3d12_com.cpp # runtime/src/vulkan_backend.h
…h (D3D-29) The device enables VK_EXT_mesh_shader (meshShader) where the GPU has it and reports MeshShaderTier 1 only then. ID3D12Device2::CreatePipelineState parses pipeline state streams in the d3dx12.h layout into the descriptions the existing PSO creators take, with the runtime's defaults for missing subobjects. Streams the PC runtime refuses are E_INVALIDARG; AS, depth bounds, split stencil masks and view instancing are E_NOTIMPL with a log. A mesh PSO is MS + PS with no vertex input or input assembly, and no dynamic topology or strides. Its output sizes and workgroup are checked against VkPhysicalDeviceMeshShaderPropertiesEXT. DispatchMesh records a Draw with mesh set and replays as vkCmdDrawMeshTasksEXT; a draw of the wrong kind for its pipeline fails with ReplayResult::invalid_draw. d3d12_mesh_test covers the refusals and checks a 2x2x1 and a 1x1x2 mesh grid plus a VS PSO from a stream, pixel by pixel. AI-assisted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ates; mesh test skips without Vulkan The stream parser keyed its duplicate check on the raw subobject type, so DEPTH_STENCIL with DEPTH_STENCIL1 (either order) or RASTERIZER with RASTERIZER2 was accepted; D3D12_PIPELINE_STATE_STREAM_DESC counts versions of one subobject as the same one. The check now uses the base type, while the payload still follows the original type. d3d12_mesh_test covers both mixed orders, RASTERIZER + RASTERIZER2, and each description alone. Reported by Vonsek in review. d3d12_mesh_test failed on a machine without a Vulkan device (the Windows CI runner) instead of exiting 77; it now skips there like d3d12_draw_test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…main's translator subtracts BaseVertex/BaseInstance) After the round-41 merge the non-indexed records (P1) all drew cell 0: they chose their cell by StartVertexLocation, which the hardware-style zero-based v0 no longer carries. P1 now picks cells through the instance id (InstanceCount), indexed records still through the index values. The layer and the merge were fine; the test relied on an id semantic main changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # runtime/CMakeLists.txt # runtime/src/vulkan_replay.h # runtime/test/vk_test_device.h
# Conflicts: # docs/d3d12_vulkan.md # runtime/src/vulkan_backend.h # runtime/src/vulkan_replay.h
…sh gate with a translated mesh shader CreateCommandSignature takes DISPATCH_MESH where VK_EXT_mesh_shader is enabled (E_NOTIMPL without it). ExecuteIndirect records it with the state DispatchMesh takes, and replay issues vkCmdDrawMeshTasksIndirectEXT, or vkCmdDrawMeshTasksIndirectCountEXT with a count buffer, split by multiDrawIndirect and maxDrawIndirectCount as the draw kinds are. build.py makes the PSV0 container of a mesh shader whose header has a psv0: line, so translated mesh shaders can be layer-test fixtures. d3d12_m5_mesh_test draws ms_m5.asm (NGG wave64, 128 threads, the corpus's v5/s3 idioms) by DispatchMesh and by ExecuteIndirect, error 0. AI-assisted (Claude Code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mesh container test AI-assisted (Claude Code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… fallback-path ctest; run_gpu_tests reads the psv0 header - Pass the device's subgroup caps to the layer, so the wave64 mesh stage asks for 64; exit 77 where the device cannot run it 64-wide, or has fewer than 144 push-constant bytes. - --single-calls / --no-count-buffers turn multiDrawIndirect / drawIndirectCount off on the layer's device; registered as d3d12_m5_mesh_fallbacks. Without drawIndirectCount a count-buffer call must be ReplayResult::unsupported. - scripts/run_gpu_tests.py translates every .asm itself: give a mesh shader with a psv0: header its PSV0 there too (ms_m5 failed translation in the GPU suite without it). AI-assisted (Claude Code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…p size Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From two review passes (one adversarial): - CreateCommandSignature refuses DISPATCH_MESH after root arguments (E_NOTIMPL, as before this branch) instead of accepting it and reading the group counts from the record's first bytes. - CommandList::execute_indirect refuses a mesh dispatch without DispatchMesh's state, and a draw kind with it. - The test fails on validation errors, as its siblings do; asserts the mesh stage's subgroup request was found (and fails on an undecided one). - I5 runs at stride 24 without a count buffer, zero-padded, 1 to 4 groups per record; new d3d12_m5_mesh_chunks lowers the layer's maxDrawIndirectCount to 3 so the calls are split. Mutations caught: chunks that don't advance (chunks run), a stride hard-coded to 12 (both). - Docs and comments: one-argument signatures only; maxDrawIndirectCount applies without a count buffer; invalid_draw for a draw signature with a mesh PSO needs a topology; only a record's group total is visible; ms_m5 sends GS_ALLOC_REQ from every thread; whitespace restored. AI-assisted (Claude Code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ot every GPU Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…128/255 so the background has no rounding tie On a GPU that cannot give the mesh stage 64 lanes the three d3d12_m5_mesh tests skipped. They now load a --wave64-emulate build of the same shaders where decide_subgroup_size says the native one is unavailable. The only mismatch that build had (2816 background pixels, 127 vs 128) was the 0.5 clear, a rounding tie.
Kam471
left a comment
There was a problem hiding this comment.
Built and ran this at 8b6be57f on Windows 11, RTX 5070 Ti (32-wide subgroup only, Vulkan 1.4.357), with LLVM 21 llvm-mc and the SDK spirv-as/spirv-val:
ctest -R '^d3d12_m5_'-> 4/4 passed:d3d12_m5_world1.55 s,d3d12_m5_mesh0.53 s,d3d12_m5_mesh_fallbacks0.36 s,d3d12_m5_mesh_chunks0.33 s.d3d12_m5_mesh_test-> exit 0: "mesh tier 1, translated wave64 mesh shader (128 threads, wave64 emulation): DispatchMesh 4x2x2, 3x1x1, 1x1x1 and an empty grid, 0 mismatched pixels; ExecuteIndirect DISPATCH_MESH, 30 records drawn (count buffers included), 0 mismatched pixels; wrong-kind indirect draws fail at execution".ctest -R '^d3d12_mesh$'-> 1/1 passed (0.45 s).
This is the exact 32-wide case the PR targets, and the wave64 mesh gate now runs through emulation instead of skipping. No blocking issue.
|
Added native Windows positive-draw parity at 8b6be57. Radeon iGPU selected native wave64 and RTX 3080 selected emulation. Base and chunked modes matched all direct and indirect pixels on both, with 30 indirect records and zero validation errors per run. AI-assisted. |
|
Tested 8b6be57 on AMD Radeon(TM) Graphics (gfx1036, driver 26.10.1) and NVIDIA GeForce RTX 5080 (driver 616.92), Windows 11, MSVC RelWithDebInfo: |
|
Tested
AI-assisted (Claude Code). |
|
Tested 8b6be57 on Windows 11 (MSVC BuildTools 2022, Ninja, RelWithDebInfo, -j 4; no Vulkan validation layer installed), one GPU at a time, device line confirmed: AMD Radeon RDNA2 iGPU (driver 26.10.1, subgroup 32..64, native wave64 mesh) and NVIDIA RTX 5080 (driver 616.92, subgroup 32..32). Ran AI-assisted. |
Claimed in the coordination issue as: new D3D item (claim). Item ID: TBD.
Depends on: #3777 (D3D-394, the mesh half of M5)
This branch is #3777 at
536cb939plus one commit. Only that commit is for review:git diff 536cb939..HEAD.What and why
On a GPU that cannot give the mesh stage 64 lanes (NVIDIA, Intel, Apple: 32 only),
d3d12_m5_mesh,d3d12_m5_mesh_fallbacksandd3d12_m5_mesh_chunksexited 77 and skipped, so the M5 mesh gate never ran on most PC GPUs. This makes them run there.CMakeLists.txtnow also translatesms_m5,ps_m5_mesh,vs_m3andps_m5_flatwith--wave64-emulateintogenerated/m5_mesh_shaders_w64e. The test asksdecide_subgroup_sizeabout the nativems_m5with the device's real limits. Where the answer isunavailable, it loads the emulated build, which is exact on any subgroup size and asks the driver for nothing. Where 64 lanes exist, nothing changes.LEONIDA_W64_EMULATE=1for the build) made all three tests fail withDispatchMesh ... 2816 mismatched pixels,got 127,127,127,255 want 128,128,128,255, whileExecuteIndirect DISPATCH_MESHhad 0. 2816 is 4096 minus the 20 drawn cells of 64 pixels: every background pixel, no pixel inside a mesh cell. The background is a clear to 0.5, and 0.5 * 255 = 127.5 is a rounding tie.vkCmdClearColorImagerounds it down to 127 on the RTX 5080, WARP up to 128. TheExecuteIndirectpart clears to 0, which has no tie. Clears are D3D-45's (Runtime: clears match WARP on every format class: tie rounding, and the SNORM/SINT/R8/R16 formats (D3D-45) #521), so this test now clears to 128/255, which has no tie, and the oracle (exact, error 0) stays as it was. After the change the same emulated build gives 0 mismatches.docs/testing.md, in the 32-wide GPUs section, says how the tests choose the build and records the RTX 5080 result.How it was tested
RTX 5080 16 GB, driver 580.65.06, Ubuntu 22.04 (RunPod), no display: runtime cross-built with clang-cl 21 and lld-link against an xwin SDK 10.0.26100, run under Wine 11.0 on Xvfb (
docs/testing.md, "The Windows runtime on Linux").-DVulkan_INCLUDE_DIRpointed at Vulkan-Headers (the host's are older) andLEONIDA_SPIRV_AS/LEONIDA_SPIRV_VALat the SDK 1.4.363.1 tools.The 5 failures are the host-comparison tests, which compare with Wine's vkd3d instead of Microsoft's runtime and fail the same way without this change:
d3d12_fence_timing,d3d12_private_data,d3d12_descriptor,d3d12_subresource_copy,d3d12_compute(itshost == layercheck on cached PSOs; its reference-count check passes). #3023 and #3679 cover them. The other 13 skips are tests that skip under Wine's host.Not run: Windows with MSVC, any AMD GPU (so the native 64-wide choice is unchanged by construction, not measured here), Vulkan validation layers (Wine does not expose them), and the mesh tests against WARP.
Findings, not fixed here
ms_m5is exact against the CPU oracle on the 5080, but the game's mesh shaders are 9,282 and only this one was run.vkCmdClearColorImageties round down on NVIDIA (0.5 gives 127). Runtime: clears match WARP on every format class: tie rounding, and the SNORM/SINT/R8/R16 formats (D3D-45) #521 (D3D-45) is where that belongs.No game files were used. AI-assisted.