Repository navigation
Conversation
|
This pull request is labeled |
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
…out mesh shaders A mesh-path draw (the NGG primitive shader path) needed VK_EXT_mesh_shader. On a device without it, or for a draw whose targets have more layers than the device's maxMeshOutputLayers, the mesh program is now compiled as a GLCompute shader (SpirvTarget::meshAsCompute) that writes the draw's primitives and vertex records to a device buffer behind a VkDrawIndirectCommand header. A generated readback vertex shader (BuildMeshReadbackVertexShader) reads the records back for a triangle or line list drawn with vkCmdDrawIndirect, carrying position, parameters, clip and cull distances and the provoking vertex's layer. - The compute pass has its own pipeline layout with a compute push range; the draw's independent-sets layout lost the device on RDNA1. - The pass pins the program's subgroup size where the device allows it and refuses compute subgroups narrower than the wave, except the 32-lane subgroups that run a wave-64 program in paired lanes. - MeshDrawRunsAsCompute decides per draw: always without mesh shaders, and on a device with them when MeshDrawLayers exceeds maxMeshOutputLayers. - APS5_NO_MESH_SHADER=1 leaves VK_EXT_mesh_shader off. - Serialization version 43 stores meshAsCompute; the shader disk cache format is 45 for the record layout field. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…nd it From review of the mesh compute fallback: - An indirect mesh draw run as compute sized its output buffer for four instances, and a record with more drew nothing. Its record is now read on the CPU (IndirectDrawPath::MeshCompute, which waits for the producer like the other CPU-read paths), and the buffer is sized from the groups and instances it resolves to. Mesh.cpp draws an indirect record with six instances. - The output buffer is bounded: a draw that needs more than 256 MiB (MeshComputeOutputLimitBytes) or maxStorageBufferRange throws. - docs/dev/ARCHITECTURE.md describes the compute pass and the readback vertex stage. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
main gained mesh-path point output with register and exported point sizes. The compute fallback's vertex record carries no point size and its readback draws triangle or line lists, so a mesh program with point output run as compute now throws instead of failing to emit; agc_driver_mesh runs its point cases on the native mesh stage only, and the debt file lists it. Rebased onto main: serialization version 45 after main's point and fused arithmetic fields, shader disk cache format 46. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…aders Supersedes boykopovar#9356 by billythemenace2; commits c0faaaf, fe9ac93 and ecf0a2b cherry-picked with authorship preserved, reconciled onto current main (serialization 57, disk-cache format 61) with fallback hardening and tests.
374cd56 to
91d892a
Compare
|
NVIDIA GeForce RTX 3070 (8 GB), driver 610.57.04, Debian 13, kernel 6.12.115+deb13.1-amd64 (a device with
Result: no regression on a mesh-shader device, and the compute fallback passes on NVIDIA. The head and its merge with current AI-assisted: yes (run and drafted with an AI agent, checked by me) |
The draw-time MeshDrawRunsAsCompute decision now matches the compile-time one (mesh && (forced || !meshShader)): on mesh-capable devices oversized-layer draws stay on the native layer-window replay instead of throwing in recordMeshCompute, whose pipeline has no compute stage there. Removes the now-unused MeshDrawLayers helper, scopes the BDA capability allowance to the compute/readback stages, documents the readback cache, and rewords the ARCHITECTURE section. Tests updated plus a literal 34-slice/8-layer regression.
Reviewed — changes requestedThe mesh compute fallback has a test path that can fail on unsupported subgroup sizes instead of skipping. The recorder also has a possible partial-state failure when a draw exceeds the output cap. What I ran
Results
FindingsBlocking
Non-blocking
Not verified
To get this to a good stateAdd the subgroup guard to the default mesh-as-compute test path. Make recorder failure handling leave the batch safe to reuse or explicitly invalidate it, transfer buffer ownership before recording references, and grow the command-buffer chain geometrically. Then run the relevant execution tests and checks. |
Reviewed — changes requestedThe review found a blocking compatibility issue: the default mesh-as-compute path can fail on devices with narrow compute subgroups instead of skipping the draw. It also identified test gaps, duplicated record-layout calculations, and an unbounded shader cache. What I ran
Results
FindingsBlocking
Non-blocking
Not verified
To get this to a good stateApply the subgroup compatibility check and skip behavior to the default mesh-as-compute path. Have the emitter provide the record layout used by the readback path, strengthen the inactive corner assertions, and bound the generated shader cache while retaining objects still in use. Then run the relevant tests and builds. |
Reviewed — changes requestedThe force-compute setting can select a compute draw while retaining a mesh shader stage, causing pipeline creation to reject the draw. A separate shared-pass hazard may also reorder overlapping writes. What I ran
Results
FindingsBlocking
Non-blocking
Not verified
To get this to a good stateAlign stage selection with the force-compute decision, and strengthen the shared-pass hazard check to account for overlapping writes. Then run the affected graphics and mesh tests and complete the interrupted analysis. |
Reviewed — changes requestedThe review found a pipeline-stage indexing bug that can reject valid mesh draws using stencil replay. It also identified gaps in cache-key and readback assertions, an unsupported compute-emitter combination, and a test mode that skips compute-backed targets. What I ran
Results
FindingsBlocking
Non-blocking
Not verified
To get this to a good stateMove stencil-replay validation before compute-stage extraction. Reject barycentric emulation in the compute mesh emitter, strengthen the readback and cache-key assertions, and let explicit mesh-execution mode include compute-backed targets. Then rerun the relevant checks, including the incomplete analyses. |
|
Integration/version checkpoint: this draft currently uses serialization version 65 for |
Find the stencil replay vertex stage by its stage bit, keep a prologue draw's writes out of the write-only set, keep the output buffer before recording references to it, report MeshComputeStages refusals as known rejections, and refuse forced compute draws without a record layout or with emulated barycentrics. Grow the prologue chain geometrically and submit a chainless batch without building a list. Tighten the readback and subgroup tests and clarify the docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the reviews of Fixed
Not changed
Tested (macOS, Rosetta x86_64 Release, MoltenVK,
The serialization version stays at 65 until #28376 lands; then I'll rebase and move |
Reviewed — changes requestedThe compute fallback has two correctness issues: mesh indirect draws with multiple records throw, and generated SPIR-V can fail validation for targets at version 1.4 or later. Both affect the new fallback path and should be fixed before merge. What I ran
Results
FindingsBlocking
Non-blocking
Not verified
To get this to a good stateHandle multiple mesh indirect records without throwing, and ensure mesh-as-compute modules follow SPIR-V 1.4 interface rules or stay at 1.3. Then remove the unused reference and review the pass-break behavior for the null-prologue case. Rerun the affected tests and builds. |
…t function Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the review of Fixed
Not changed
Tested (macOS, Rosetta x86_64 Release)
|
Reviewed — changes requestedThe compute mesh fallback can execute guest code for padded workgroups and can fail layered draws on devices without the required layer capability. Fix these correctness and availability issues before relying on the path. What I ran
Results
FindingsBlocking
Non-blocking
Not verified
To get this to a good stateGuard both direct and indirect compute execution against padded group indices, make the readback shader's layer capability match device support and check that support at the call site, then rerun the relevant tests and builds. |
…k as debt Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the review of
|
Reviewed — changes requestedThe mesh-compute fallback can corrupt tessellation capture counters and capacity, which can lose captured geometry or write records at the wrong index. Fix that data integrity issue before merging. What I ran
Results
FindingsBlocking
Non-blocking
Not verified
To get this to a good stateMove the mesh-compute output address out of the tessellation capture counter and capacity fields, then update all readers. Address the profiling count, layer-window test guard, indirect draw debt entry, and sixth-instance assertion, then run the relevant checks. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the review of Fixed
Not changed
Tested (macOS, Rosetta x86_64 Release)
|
Reviewed — changes requestedThe review found a correctness issue: the mesh-compute dispatch can be recorded inside an open render pass. It also found a performance issue that causes repeated render-pass breaks. What I ran
Results
FindingsBlocking
Non-blocking
Not verified
To get this to a good stateKeep mesh-compute dispatches outside the render pass while changing pass continuation so prologue-disabled draws do not repeatedly break an open render pass. Then run the relevant checks. |
|
Thanks for the review of
|
ligmaSec
left a comment
There was a problem hiding this comment.
I verified that the exact current #17611 head is an ancestor of this revision and that this branch trial-merges cleanly onto c1601e56d5. Keep the test that forces an attachment hazard between compute-backed mesh draws alongside the one that shares a render pass. It checks that an optimization for independent draws still closes the pass when a dependency requires it. This stack also inherits #17611’s request-format version collision, so the recorded traces and replay tests should identify the merged serializer revision. Paired lavapipe execution is pending.
AI-assisted: yes.
What
Stacked on #17611, which supersedes #9356. This branch is #17611's current head
70015a5ccfand this pull request's commite17b4986d1. That commit is the previous head's91d892a10bcherry-picked onto70015a5ccfwithout conflicts and without changes. It adds no request serialization or shader disk cache version of its own; it uses #17611's shader disk cache format 78. The conflicts withmainare #17611's: #17611 alone conflicts withmainin the same files, and this commit applies cleanly on top of it.Builds on #17611. A mesh-path draw run as a compute pass forces its own render pass today, because its dispatch must be recorded outside one. Consecutive mesh-path draws into the same attachments therefore cost a pass each, and on a tile-based GPU each pass loads and stores the attachments again.
With this change, the recorder splits the batch when a mesh-path draw begins a pass: the work before the pass, a prologue command buffer, and the pass. The draw records its dispatch into the prologue. A later mesh-path draw that continues the pass under the existing hazard check (
PassHazards::Check) records its dispatch into the same prologue and its draw into the open pass. The three command buffers are submitted together, in order, in the batch's onevkQueueSubmit.ALL_COMMANDSmemory writes toCOMPUTE_SHADER,DRAW_INDIRECTandTRANSFERreads and writes, so its dispatches see everything recorded before the pass. Each dispatch keeps its own trailing barrier toDRAW_INDIRECTandVERTEX_SHADER, which orders it before the draws in the pass.mainrecords the work its dispatch depends on into the pass command buffer, which runs after the prologue.DrawPassStartcarriesmain's pass break reason next to the prologue. A draw that closes an open pass to start a prologue reportsforced.Tested
macOS 27.3, Apple M5 Pro, Apple clang, x86-64 Release under Rosetta 2. #17611's head does not build on macOS without #16591, #16593, #17532, #17767 and #17425, so both trees below are
70015a5ccfwith those five applied on a separate test branch that is not part of this pull request. Seven test targets outside the mesh path still fail to compile on macOS on that tree (agc_driver_table_index_validation,guest_ces_gbsetters,guest_ces_gbsetters_module,nkwebkit_resourcerequest,guest_webrtc_key_params,guest_webrtc_rtcp_transport_feedback,guest_exception_fault), the same with and without this commit.ctest --test-dir build -R '^(request_serializer|shader_cache_file_read|agc_shader_memory|agc_mesh_output_budget|agc_driver_(graphics|layered_[a-z_]+|mesh[a-z_]*|pass_break_reasons|pass_input_hazard))$' -Von MoltenVK from Vulkan SDK 1.4.363.0, withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_LOADER_DEBUG=layerandAPS5_NO_MESH_SHADER=1:70015a5ccfe17b4986d1agc_driver_mesh_compute_shared_passVK_LAYER_KHRONOS_validationwas not found but was requested by env var VK_INSTANCE_LAYERSVUID-messagesThe eight skipped tests need
VK_EXT_mesh_shader, which MoltenVK does not expose. KosmicKrisp and Linux and Windows were not run on this head.tools/check_conventions.pypasses.Performance: the measurement below is from an earlier head (
f49a25ae9fplus3a3880e952, onmain4f41f4c375with the macOS port pull requests) and was not repeated on this one, so thetools/trace_digest.pysummaries ofmainand of this change from one machine and scene are still missing. PPSA21564 on KosmicKrisp (noVK_EXT_mesh_shader),APS5_PROFILE_GPU=1. Three rounds of 140 s runs, alternating base and this change. Only the heavy windows count: the 10 s windows with more than 3000 mesh-path draws, about 75 per present.drawclass GPU time per present, basedrawclass GPU time per present, this changeOn average, 21 % more presents and 26 % less
drawGPU time in those windows. This head adds the captured, staged clear and pixel function LDS exclusions above; how many of PPSA21564's mesh-path draws they cover was not measured. Frames dumped in the same scene showed no missing or broken geometry. That the saving comes from attachment loads and stores of the merged passes is inferred from the tile-based design, not measured on its own.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code