Repository navigation
fix(agc): create tessellation pipelines without the pipeline cache on MoltenVK - #10046
Conversation
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed exact head 8404eb5f14134d0184f810fe3ddbf36fb90421a2. Blocking gap: the new pipelineCache local is used only in Pipeline.cpp’s non-library creation calls. When libraries is true, this code calls LinkPipelineFromLibraries, whose pre-rasterization library creation and final link in Graphics/src/PipelineLibrary.cpp still pass context.pipelineCache directly (around lines 234 and 281); optimized relinking also captures that cache (around line 290). Thus any device using the graphics pipeline library path still has tessellation shader conversions in the same VkPipelineCache, despite tessellationPipelineCache == false. Please thread the per-pipeline cache choice through the library parts/link/relink paths, or disable the affected GPL path for MoltenVK, and add coverage for the path that reproduces #10045. The standalone driver-table test, diff check, and conventions pass locally; check_main_sync.py reports a clean merge but notes CMakeLists.txt also changed in #6946. Hosted product builds are skipped by path policy. This request is for a code path that bypasses the stated fix, not repository intake.
adriadam10
left a comment
There was a problem hiding this comment.
Thanks, the diagnosis in #10045 is clear. One gap, the same one MarcZX10 raised:
Pipeline.cpp:215(libraryKeys) does not exclude tessellation, so whencontext.graphicsPipelineLibraryis on,LinkPipelineFromLibrariesis used and its pre-rasterization library creation (PipelineLibrary.cpp:234), final link (:281) and optimized relink (:291) still passcontext.pipelineCache. The new toggle only reaches the non-library calls. Please make tessellation pipelines skip the library path when!context.tessellationPipelineCache(or pass the null cache through those three places), so the rule holds whatever extensions the device exposes. If MoltenVK can never expose graphics pipeline libraries, say so in the PR and keep the guard anyway.
|
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.
|
|
@MarcZX10 @adriadam10 thanks, you were right about the library path. Pushed 0e38bdc:
Written with AI assistance (Claude Code). |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed the updated head 0e38bdc3d02f0d72f0c39451fc3f74af4d8d7289. The fix now covers both pipeline creation paths: tessellation pipelines for drivers that cannot safely share the cache bypass graphics pipeline libraries, and direct creation uses VK_NULL_HANDLE for their cache. The new mock test exercises the shared-cache and no-cache library-selection cases, including the failure mode when the guard is absent. The author reports the merged-hull regression passing on MoltenVK before/after, with unrelated failures unchanged; hosted conventions, eligibility, labels and report checks pass. Product/relinker checks are skipped by path policy, so I am relying on the reported focused Apple/MoltenVK runs for the driver-specific behavior.
|
@jotitadev #9185 adds a condition to the same if (!context.graphicsPipelineLibrary || context.pipelineExecutableInfo || (state.stages.tessellation && !context.tessellationPipelineCache) || state.depthBiasPerFace || state.rectList || BarycentricPatches(state, shaders) || SplitsAlternateAlpha(state) || FragmentInterlock(shaders)) return false;Your other |
|
Rebased onto main Checked after the rebase: @janzezno thanks for the note on #9185. Agreed: whichever merges second rebases and keeps every condition on that line. Written with AI assistance (Claude Code). |
0e38bdc to
fe6805b
Compare
fe6805b to
882cd60
Compare
|
Rebased onto main
Written with AI assistance (Claude Code). |
… MoltenVK MoltenVK runs the tessellation evaluation stage as a post-tessellation vertex function that reads the control stage's per-vertex outputs from a raw buffer, and pads the evaluation input struct to every output of the control shader it is linked with. The shader library cache of a VkPipelineCache matches a cached conversion when the new pipeline has the inputs that conversion used, so an evaluation shader converted next to a hull with one 16-byte output is reused next to the merged hull, whose LDS record adds a second per-vertex output. The domain stage then reads the merged hull's control points at a 16-byte stride over a 48-byte buffer and the patch lands elsewhere. Created without the pipeline cache, each tessellation pipeline converts its stages for its own interface.
…the pipeline cache
882cd60 to
2fd07f1
Compare
|
Rebased onto current main: the only conflict was the |
What
On MoltenVK,
agc_driver_tessellation's merged hull cases draw nothing (#10045). MoltenVK pads the domain stage's input struct to the per-vertex outputs of the hull it is linked with. The shader cache inside aVkPipelineCachematches a cached conversion when the new configuration has the inputs that conversion used, so the domain shader converted next to a 16-byte hull is reused next to the merged hull. The merged hull'sControlSharedrecord adds a second per-vertex output, so the domain stage reads its control points at 16 bytes over a 48-byte buffer.This PR creates tessellation pipelines without the pipeline cache when the driver is MoltenVK. Each tessellation pipeline then gets a conversion for its own interface. Tessellation pipelines also skip the graphics pipeline library path while the cache is off (
libraryKeysinPipeline.cpp), so the parts, the link and the optimized relink inPipelineLibrary.cppnever seecontext.pipelineCachefor them. MoltenVK does not exposeVK_EXT_graphics_pipeline_library(not listed byvulkaninfowith MoltenVK 1.4.2 or MoltenVK main), so the guard does not change what runs on Apple today; it keeps the rule if that changes.TessellationPipelineCacheUsable(VkDriverId)followsFragmentShaderBarycentricUsableandSubgroupControlBarrierUsable, with a unit test for its driver table.agc_driver_graphicschecks with the mock device that a tessellation pipeline is prebuilt from graphics pipeline libraries when the cache is shared and is not when it is off. Other drivers and other pipelines keep the cache.Tested
Apple M2 Max (32 GB), macOS 27.2, x86_64 build under Rosetta, Release.
maindoes not build on macOS yet, so I applied this diff to #8658 (feat/macos-port) @46673ede9e, which hasmain0db47b2 merged.ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1,ctest -j1 --timeout 30.agc_driver_tessellation, with every case run: both merged hull cases fail before and pass after. The only case left failing isRequireInstancedRelativePatches, which fails before and after (see AGC: merged hull programs draw nothing on MoltenVK, because the pipeline cache reuses a domain shader converted for another hull #10045).4e0468722f). That confirms the order dependence.ctest -R "^agc" -E "agc_display_buffer_dcc|agc_driver_flip|agc_driver_lds_atomics64", 898 tests before and 899 after: the same 22 failures with MoltenVK 1.4.2 and the same 21 with MoltenVK main + SPIRV-Cross Ratchet & Clank: Rift Apart: SIGSEGV since #861, an address-less 64 GiB reservation now takes the addresses the title hints next #2704, before and after.agc_driver_tessellationis in both lists: before it stops at the merged hull, after atRequireInstancedRelativePatches. The other failures are unrelated to tessellation and fail the same way on the base.agc_tessellation_pipeline_cacheandagc_driver_graphicspass.agc_driver_graphics(mock device,tessellationPipelineLibraryCacheTests): fails without thelibraryKeyschange with "tessellation pipelines without the pipeline cache were built from graphics pipeline libraries" and passes with it. The shared-cache case passes in both, so the test reaches the library path.tools/check_conventions.py --base origin/mainpasses.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)maindoes not build on macOS)🤖 Generated with Claude Code