Repository navigation
rdna2spirv: mesh clip and cull distances as standalone arrayed outputs, not a per-vertex Block (AMD 24.10.24 crash in ms_clip) - #8097
Open
SpaghettiMaster545 wants to merge 1 commit into
Conversation
…s, not a per-vertex Block AMD's Windows driver 24.10.24 (Vulkan driver 2.0.302, a gfx1036 iGPU) crashes with an access violation inside vkCreateGraphicsPipelines on ms_clip. In hand-edited modules the trigger is a store to a ClipDistance member of an arrayed per-vertex output Block. Removing that store, or writing Position and ClipDistance as standalone arrayed built-ins, compiles and draws the expected 2048/4096 pixels. docs/design.md counts clip distances in 1,906 of the 9,282 corpus mesh shaders. The translator now emits %ms_out_clip and %ms_out_culld next to %ms_out_pos and drops %ms_vtx_blk. The distances are still copied one float at a time (SHADER-155), and --mesh-compute is unchanged. Tested on Windows 11 (VS 2026, Vulkan SDK 1.4.363.0, llvm-mc 23.1.6): - run_gpu_tests --filter ms_clip: the AMD iGPU fails on main and passes 2048/4096 with this change; the RTX 5070 Ti (621.24) passes; Khronos validation clean on both. - The other mesh tests are unchanged. - pytest test_translate, test_mesh_compute(_vs), test_ps_interp_modes: 713 passed. - Semantic suite: only the two files that are red on main fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested 9ea52cd on Arch Linux + RTX 4070 (NVIDIA 620.70, llvm-mc 23.1.5), CPU + native GPU: pass — pytest tests/test_translate.py 648/648 OK (incl. 20 clip/cull/mesh). Negative control: merge-base translator → the 3 ms_clip/ms_cull tests fail. GPU: ms_clip fixture runs natively (mesh shaders present) — 2048/4096 pixels covered as expected, spirv-val clean. No game files. AI-assisted. |
|
Tested
AI-assisted (Claude Code). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Finding and claim: #7913.
What and why
On AMD's Windows driver 24.10.24 (Vulkan driver 2.0.302),
ms_clipcrashes the driver's shader compiler.vk_harnessdies with an access violation (0xC0000005), andVK_LAYER_LUNARG_api_dumpshowsvkCreateGraphicsPipelinesnever returning. With clip or cull distances, the translator writes Position, ClipDistance and CullDistance as members of one arrayed per-vertex outputBlock(%ms_vtx_blk, added in 79b3542). Without them, Position is already a standalone arrayed built-in (%ms_out_pos).To narrow it down, I hand-edited the translated
ms_clipmodule. Every variant is spirv-val clean, run on the same iGPU:So the trigger is a store to a ClipDistance member of an arrayed output Block in a mesh shader.
docs/design.mdcounts clip distances in 1,906 of the 9,282 corpus mesh shaders, so on that driver every one of them would crash at pipeline creation. kormocicsaba saw the samems_clipfailure on 24.10.34 (#5581). #5744 and #5767 add the exit code to the report, and their comments show newer AMD drivers passing.The translator now emits
%ms_out_clip(BuiltIn ClipDistance) and%ms_out_culld(BuiltIn CullDistance) as standalone arrayed outputs next to%ms_out_pos, and drops%ms_vtx_blk. The distances are still copied one float at a time, so the SHADER-155 workaround for SPIRV-Cross/Metal is kept.--mesh-computedoesn't change. The mesh row indocs/design.mdsays why the outputs are standalone, andtests/test_translate.pychecks the new form (%ms_vtx_blkabsent, standalone decorations, per-float access chains into%ms_out_clip/%ms_out_culld).Tested
Windows 11 IoT Enterprise LTSC 2024 (26100), MSVC 14.50 (VS 2026), Vulkan SDK 1.4.363.0, llvm-mc 23.1.6 (conda-forge), Python 3.14. Both GPUs are in one machine. Synthetic fixtures only, no game files.
run_gpu_tests.py --filter ms_cliponmaindde82f2:LEONIDA_PC_TAIL_UBO=1: FAIL (crash) on every run.run_gpu_tests.py --filter ms_clipwith this PR:VK_LAYER_KHRONOS_validationloaded on both GPUs: exit 0, no messages.run_gpu_tests.py --filter ms_with this PR:ms_clip,ms_f16_pack,ms_tri,ms_v5_workgroupandms_w64x_ballotpass on the AMD iGPU (5/6). On the RTX 5070 Ti the same pass, exceptms_w64x_ballot, which is skipped (no 64-wide subgroup) (4/6).ms_wave_info_s3fails on both GPUs with and without this PR. On NVIDIA that is the known SHADER-766 regression (rdna2spirv: %ms_counts is stored atomically by whichever wave sends; ms_wave_info_s3 draws nothing on main on most GPUs (SHADER-766) #5741, rdna2spirv: store a mesh allocation from the first invocation of the wave that sends it (ms_wave_info_s3) #7136, rdna2spirv: use OpAtomicStore for MSG_GS_ALLOC_REQ %ms_counts #5855). On AMD 24.10.24 it is a separate compiler crash, unrelated to clip distances; I'll post it as a finding.tests/test_translate.py,test_mesh_compute.py,test_mesh_compute_vs.pyandtest_ps_interp_modes.py: 713 passed, the same count as onmainwith the old assertions.scripts/run_semantic_tests.py tests/semantic: 447 files, 5,956 tests. Two files fail,test_image_atomics_guard(47) andtest_image_store_d16(1), with exactly the same counts on cleanmain; they are red there, with fixes in test: cover supported d16 cube image stores #7194, test: exercise narrowed EXEC for image atomic guards #7212 and tests: the image atomics guard accepts the folded %true when no lane can be inactive #7292.Not tested: MoltenVK/Metal, which is what the per-float copy (SHADER-155) is for. The SPIR-V there is the same per-float store, now into a standalone arrayed output instead of a Block member.
AI-assisted (Claude Code).
🤖 Generated with Claude Code