Repository navigation
Conversation
|
Tested
AI-assisted |
|
Heads-up on an overlap with #2359 (D3D-291, mine), which is also stacked on #1712. Both PRs change
The merged shader needs both. Whichever lands second rebases. If this one lands first, I'll rebase #2359 onto it. That split is also most of what your D3D-339 finding asks for; more in the coordination issue: #2891 (comment) AI-assisted (Claude Code). |
|
Tested
D3D-339 reproduces on this card and driver too, with the same numbers as on the 3070 Ti: DispatchMesh(2,2,1) gives IAVertices/IAPrimitives/VSInvocations 4/4/128 on the layer and 0/0/0 on the host, DispatchMesh(1,1,2) 2/2/64, and the VS draw's MSPrimitives is 1 against the host's 0. @itsRevela, D3D-339 stays yours. In case it helps, I tried the one-kind case on top of this PR: CLHelper#3 (a draft in my fork, not a PR here). AI-assisted. |
Kam471
left a comment
There was a problem hiding this comment.
The implementation is sound but the branch is not mergeable as-is:
- Rebase required. The head sits on
47e8b421, a dropped #1712 head, and conflicts with current main inruntime/CMakeLists.txt(main'sd3d12_bundle_testvs #1712's mesh-test block) andruntime/shims/d3d12_vulkan_device.cpp(main's Device9 shader-cache methods vs #1712's Device2CreatePipelineState). Current #1712 is56e57fbe, which merges cleanly with main; rebase this PR onto that head (or onto main once #1712 lands) and drop the stale stack. - Build/test evidence. No configured build was available and the PR adds 3 test targets, so none were built or run here. Please provide a configured build plus the
d3d12_mesh_statistics_test,replay_query_predication_testandd3d12_query_rules_testresults, with validation enabled. - Contract delta. Unsupported mesh statistics currently return
E_NOTIMPL, while the D3D12 spec says the three newPIPELINE_STATISTICS1fields read 0. Either return the zeroed structure or state the deviation explicitly in the body/docs.
The SDK constants check out (D3D12_QUERY_DATA_PIPELINE_STATISTICS1 = 14 x UINT64, AS/MS/MSPrimitives at 11/12/13, heap type 7, query type 10), the 13 Vulkan counters match, and the embedded SPIR-V equals a fresh glslang compile (361 words, 0 diff) with spirv-val clean. Rebase and CI should be enough after that.
|
Thanks for the review. This is now a draft:
I'll rebuild D3D-132 on top of #2359's per-segment pools ( AI-assisted (Claude Code). |
617455a to
25373c4
Compare
|
Rebuilt on #2359 ( |
ID3D12Device::CreateQueryHeap refused D3D12_QUERY_HEAP_TYPE_PIPELINE_STATISTICS1. It now creates one on a device with VK_EXT_mesh_shader's meshShaderQueries (enabled with meshShader where the GPU has it, and reported through OPTIONS9.MeshShaderPipelineStatsSupported); without it the heap is still refused with E_NOTIMPL. Built on D3D-291 (ItsNotRexed#2359), which splits a statistics query around mesh draws into full and mesh-pool segments. - The heap's pool counts the 11 classic statistics plus TASK_SHADER_INVOCATIONS (0x800) and MESH_SHADER_INVOCATIONS (0x1000); Vulkan writes them in bit order after CSInvocations, the order of ASInvocations and MSInvocations. Neither bit is forbidden around vertex draws (only around vkCmdDrawClusterHUAWEI, VUID-07819). - A query that holds a mesh draw is always split (VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076, D3D-291), so an unsplit query ran no mesh draw: the resolve copies its 13 statistics 112 bytes apart and writes MSPrimitives as 0. - With a split PIPELINE_STATISTICS1 query in the submission, the mesh pool also counts task and mesh invocations (6 counters), and each mesh segment runs a VK_QUERY_TYPE_MESH_PRIMITIVES_GENERATED_EXT query of its index beside it; full segments run none. No VUID ties those queries to the draw kind (07068, 07070, 07071), but NVIDIA's Vulkan driver counts a VS draw's triangles in them and D3D12 does not, so MSPrimitives is counted only around mesh draws. - A split PIPELINE_STATISTICS1 query always resolves through the sum. statistics_sum.comp takes the result width (11 or 14) as a push constant and maps a mesh segment's task and mesh invocations and primitives to fields 11-13. statistics_sum_spirv.h is regenerated with glslang 16.6.0 (-V --target-env vulkan1.0 -Os -g0; spirv-val clean). Tested on Windows 11, NVIDIA GeForce RTX 3070 Ti, driver 610.88, without Vulkan validation layers (not installed): ctest 125/125 passed, 8 skipped (game data, the validation layer, an RGB9E5 RTV); ItsNotRexed#2359's head alone: 124/124 passed, the same 8 skipped. New: d3d12_mesh_statistics runs one list on the layer and on host D3D12 (DXIL from HLSL equivalents compiled at run time by the Windows SDK's dxcompiler.dll): a VS draw in PIPELINE_STATISTICS1 and PIPELINE_STATISTICS queries, DispatchMesh(2,2,1) and (1,1,2), a query never ended, and a query split by a resolve inside it, resolved at an offset. Every one of the 14 fields matches the host. replay_query_predication cases 10-12 cover the unsplit resolve, the primitives queries beside mesh segments only, the refusals and the 14-counter sum; d3d12_query_rules compares PIPELINE_STATISTICS1 heap creation by count and node mask with WARP and the GPU. The host's refusal HRESULT is unmeasured: every host adapter here (WARP, RTX 3070 Ti) supports these heaps. Depends on: ItsNotRexed#1712, ItsNotRexed#2359 AI-assisted (Claude Code).
…onstant (D3D-132) main's chunk-boundary test (added after ProjectLeonida#2359) checks a two-word push constant; D3D-132 adds a third, the result's counters (11 here, 14 for PIPELINE_STATISTICS1). Its sum_statistics calls take the new primitives pool and counters arguments.
25373c4 to
832a6a8
Compare
|
Rebased onto Conflicts: they were in
RTX 3070 Ti, 610.88, Windows 11:
Still a draft until an AMD run, RADV or Windows on RDNA1/2, of AI-assisted (Claude Code). |
|
Requested AMD check at
AI-assisted (Codex). Synthetic inputs. |
Item: D3D-132 (claim).
Built on #2359 (D3D-291), now merged; its squash brought #1712's (D3D-29) mesh PSOs and
DispatchMeshintomainas well. This branch sits directly onmain7c082165: the D3D-132 commit plus one test update for a chunk-boundary checkmainadded after #2359.Draft until there is an AMD run, as below.
What
CreateQueryHeap(D3D12_QUERY_HEAP_TYPE_PIPELINE_STATISTICS1)works when the device hasVK_EXT_mesh_shader'smeshShaderQueries. The feature is enabled withmeshShaderwhere the GPU has it andpipelineStatisticsQuery, and OPTIONS9MeshShaderPipelineStatsSupportedreports it. Without the feature the heap is refused withE_NOTIMPL.It's built on #2359's split of a statistics query around mesh draws, which
VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076requires:VUID-07819forbids those bits only aroundvkCmdDrawClusterHUAWEI, so they're allowed around ordinary vertex draws.PIPELINE_STATISTICSare unchanged.PIPELINE_STATISTICS1query is present, the mesh-segment pool grows from 4 to 6 counters (adding task and mesh invocations).VK_QUERY_TYPE_MESH_PRIMITIVES_GENERATED_EXTquery in a per-submission pool. It runs only beside mesh segments, because NVIDIA's Vulkan driver counts a VS draw's triangle in that query and D3D12 doesn't.statistics_sum.comptakes the result width (11 or 14) as a push constant and maps a mesh segment's AS, MS and primitives into fields 11–13.statistics_sum_spirv.his regenerated with glslang 16.6.0 and passesspirv-val.VUIDs checked in the
validusage.jsonshipped with the pinned Vulkan-Headers (1.4.363): 07076, 07819, 07068/07069 (both needmeshShaderQueries), 07070 and 07071.Results
NVIDIA GeForce RTX 3070 Ti, driver 610.88, Windows 11, RelWithDebInfo.
d3d12_mesh_statisticscompares all 14 fields with host D3D12 and fails on any difference. They're identical:PIPELINE_STATISTICSgives the same first 11DispatchMesh(2,2,1)DispatchMesh(1,1,2)AS is 0 because #1712 refuses amplification shaders.
No regressions against the base: on
main7c082165,ctestfailsd3d12_vulkan_device,d3d12_indirect_dispatch_countandd3d12_indirect_rton this RTX 3070 Ti (610.88) with and without this branch, with identical failing lines (41, 1 and 3). Everything else passes, includingd3d12_mesh_statistics,d3d12_mesh,d3d12_query_rules,replay_query_predicationandreplay_query_edges.Not verified:
ctest -R "mesh|statistics|query|predication"againstmainis needed before this leaves draft.meshShaderQueriesis unmeasured, because every host adapter tried supports the heap.No game files. AI-assisted (Claude Code).