rdna2spirv: list %ms_cull before %ms_out_vtx in OpEntryPoint MeshEXT (AMD LLPC crash, SHADER-MS-CLIP-IFACE) #802
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!802
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/802/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@whoalin1 on GitHub · 2026-11-24 14:00 UTC · original
whoalin1:shader-ms-clip-iface→main· +17 −2 · 3 files · 2 commits · merged 2026-11-25 02:46 UTCClaim: #14 (
SHADER-MS-CLIP-IFACE)Problem
On AMD's proprietary Windows Vulkan driver (
24.10.24, LLPC, AMD Ryzen 5 7600 RDNA2 iGPU),ms_clipsegfaults (0xC0000005) duringvkCreateGraphicsPipelinesinsideamdvlk64.dll.Bisecting the SPIR-V (including compiling an equivalent GLSL mesh shader with
glslangValidator) narrowed the trigger to a single condition: AMD Windows LLPC crashes whenever aMeshEXTshader lists aBlock-decorated vertex output struct containingBuiltIn ClipDistance/CullDistance(%ms_out_vtx) before theBlock-decoratedPerPrimitiveEXTBuiltIn CullPrimitiveEXToutput (%ms_cull) inOpEntryPoint's interface list. EvenglslangValidator's own output (gl_MeshVerticesEXTbeforegl_MeshPrimitivesEXT) triggers the exact same0xC0000005crash.Fix
tools/rdna2spirv.py(assemble): list%ms_cullbefore%ms_out_vtx/%ms_out_posinOpEntryPoint MeshEXT's interface list. Keeps%ms_cull_blkasBlock+boolso SPIRV-Tools ≤2025.1 (SHADER-30),test_mesh_cull_primitive_is_block_bool,test_mesh_cull_store, and SPIRV-Cross/Metal remain completely unchanged.tests/test_translate.py: addstest_mesh_cull_precedes_clip_vertex_block_in_entrypoint.docs/design.md: documents the rule in the Mesh shaders contract row.Verification (before/after on
main47c651174,LEONIDA_VK_VALIDATION=1)LEONIDA_PC_TAIL_UBO=1):main):ms_clipFAIL (vk_harnesscrash0xC0000005)ms_clipPASS (2048/4096 pixels covered, 0 validation errors),ms_triPASS (4096/4096 pixels exact); also verifiedClipDistance + CullDistancecombined (2048/2048clipped,2048/2048drawn) andCullPrimitiveEXT = true(4096/4096culled).--filter ms_withLEONIDA_VK_VALIDATION=1: 5/6 passed, 1 skipped (ms_clip2048/4096,ms_f16_pack,ms_tri,ms_v5_workgroup,ms_wave_info_s3;ms_w64x_ballotskipped on 32-wide), 0 validation errors;CullPrimitiveEXT = trueverified4096/4096culled.pytest tests/test_translate.py -k "mesh or clip"— 21 passedunittest discover -s tests/semantic -p "test_ms_*.py"— 6 passedunittest discover -s tests/semantic -p "test_mesh_*.py"— 2 passedpython -I tests/test_text_write_line_endings.py— 3 passedAI-assisted (Gemini 4 Neon).
@towade on GitHub · 2026-11-24 18:22 UTC · original
checked:
07837d80c(the same patch as the current heada5c8f43d0, pergit range-diff; only the base moved) on RDNA4, as a regression check: AMD Radeon RX 9070 XT (gfx1201, AMD Windows driver 32.0.32029.2010, LLPC), Windows 11 26300,main3aa975421with this PR merged,scripts/run_gpu_tests.pywithllvm-mc21.1.8.ms_clip: passes onmainand with this PR, native and withLEONIDA_W64_EMULATE=1(2048/2048 pixels covered). This driver does not crash onmain's interface order, so I can't confirm the fix itself here, only that the new order is fine on RDNA4 too.mainand with this PR; no test fails for another reason. 29 pixel-shader tests did not run because I had not builtvk_texture_test,vk_bindless_testandvk_sampler_test. They don't involve mesh shaders.AI-assisted (Claude Code).
@towade on GitHub · 2026-11-24 18:42 UTC · original
Follow-up to my check above: I built
vk_texture_test,vk_bindless_testandvk_sampler_testand ran the full GPU suite again, natively on the same RX 9070 XT (AMD 32.0.32029.2010), onmain3aa975421and with this PR merged. Result: 236 of 252 pass, 16 skipped, 0 fail on both, identical test by test, so the 29 pixel-shader tests that had not run pass too.AI-assisted (Claude Code).
@adrianmjim on GitHub · 2026-11-24 21:42 UTC · original
Tested a5c8f43d0 applied onto main
66d4f5aa3on an AMD Radeon RX 7900 XT (RDNA3, gfx1100), AMD proprietary driver 32.0.32029.2010 (26.11.2), Windows 11 build 26300, Vulkan SDK 1.4.363.0, llvm-mc 23.1.5. I used the test programs from amain66d4f5aa3build. No game files.python -I scripts/run_gpu_tests.py --filter ms_, native mesh path:ms_clipms_f16_packms_trims_v5_workgroupms_w64x_ballotms_wave_info_s3The LLPC crash in
ms_clipdoes not reproduce on this card and driver:mainalready creates the pipeline and draws the expected coverage. The reorder changes nothing visible here and breaks none of the six mesh fixtures. That adds an RDNA3 data point next to the gfx1036 crash and the RX 9070 XT regression check.@aslan2142 on GitHub · 2026-11-25 02:47 UTC · original
Merged. Thanks: the reorder is free on every driver and fixes the one where it crashed.
SHADER-MS-CLIP-IFACE, valid, four minutes before this PR.vkCreateGraphicsPipelinescrash was reported on driver24.10.24on one Ryzen 5 7600 iGPU, while driver32.0.32029.2010on an RX 9070 XT and an RX 7900 XT accepts either order, instead of stating it for every AMD driver. The interface order has no meaning in SPIR-V, so listing%ms_cullfirst costs nothing elsewhere.mainand passes with the change.main2213d5cb8+052883fba: the semantic suite passes (486 files, 6,275 tests, 0 files failed);test_translate (pytest; 2 failing as on main)pass; the 14 docs and writer tests pass;check_no_game_data.pyis clean on the 3 changed files.AI-assisted (Claude Code, Claude Opus 5.5).