Repository navigation
Conversation
…(AMD Windows driver crash) v_sub_co_u32 / v_subrev_co_u32 and their _ci_ forms with the same operand twice were translated to OpISubBorrow %x %x. AMD's Windows driver dies with an access violation (0xC0000005 in amdvlk64.dll, 32.0.21037.1004 and 32.0.21045.29003, gfx1036) creating a native wave64 compute pipeline in which that borrow predicates the value operand of an OpGroupNonUniformShuffle. x - x is 0 with no borrow, so these forms now emit D = 0 - carry in and borrow out = carry in, with no OpISubBorrow. Values are unchanged; other operand pairs are translated as before. Found with crosslane_fuzz.py --seed 880317 --wave 64 --w64-native --no-maskdata --dpp --ext --programs 400 on a Ryzen 9 9950X3D iGPU: programs 1 and 181 were harness errors (exit 3221225477) and now match (399 of 400 match; the other differs only in a hypothesis op, as before). - docs/design.md: contract row "Carry-out subtract of a register from itself" - tests/semantic/test_sub_co_same_operand.py: values and borrow mask in wave32 and native wave64, the emitted form with --wave64-emulate Not counted over the corpus, and two different registers holding equal values still reach OpISubBorrow. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This was referenced Nov 24, 2026
2 tasks done
4 tasks done
Collaborator
YaBulochka
added a commit
to YaBulochka/leonida-1
that referenced
this pull request
Nov 25, 2026
…ax, wrxchg b64) Six wave32 fixtures for the docs/design.md rows 321, 322 and 324, each an eight-word dump and lane 0 alone running the atomics: - cs_w32_lds_mskor (ProjectLeonida#321): ds_mskor_b32 and ds_mskor_rtn_b32, including DATA2 bits outside DATA being ORed in (0x11223344, mask 0x0000FFFF, DATA2 8 -> 0x11220008) and the rtn old word. - cs_w32_lds_atomics_incdec / _atomics_rtn (ProjectLeonida#322): ds_inc/dec/rsub_u32 at the DATA-1, DATA, above-DATA, 0 and 1 boundaries, the rsub wrap, and the pre-op word each _rtn_ form returns. - cs_w32_lds_minmax_f32 (ProjectLeonida#322): ds_min/max_f32 and the returning forms with a qNaN in either operand, -0/+0 and +inf/-inf. - cs_w32_lds_wrxchg_b64 (ProjectLeonida#324): ds_wrxchg_rtn_b64 and ds_wrxchg2_rtn_b64, the old pair, vdst order at *8 offsets 1 and 2, and the words written. - cs_w32_lds_wrxchg2st64_b64 (ProjectLeonida#324): ds_wrxchg2st64_rtn_b64 at *64 offsets 1 and 2 (0x200/0x400) over a 2 KiB LDS, with *8 markers so a wrong unit fails. Registered in check.py (CS_DUMPS and both wave32 lists), run_gpu_tests.py (every table and the wave64 exclusion), and regen_fixtures.py. Pinned by tests/semantic/test_batch5_gpu_fixtures.py, which runs the same eight words through spirv_mini_interp. Both runners pass on the RDNA2 iGPU (gfx1036, RADV Mesa 27.0.0-devel), 8/8 words per fixture. No translator mismatch appeared.
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.
Original description (mentions and
#Nreferences are disabled; the numbers refer to the old repository):Claimed in the coordination issue as: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7117121094 (new SHADER item, no ID assigned yet)
What and why
v_sub_co_u32/v_subrev_co_u32(and the_ci_forms) whose two sources are the same operand were translated toOpISubBorrow %x %x. AMD's Windows driver dies with an access violation (0xC0000005inamdvlk64.dll) creating a native wave64 compute pipeline in which that borrow predicates the value operand of anOpGroupNonUniformShuffle.Found with
crosslane_fuzz.py --seed 880317 --wave 64 --w64-native --no-maskdata --dpp --ext --programs 400: programs 1 and 181 (cs_xl64_88034340952,cs_xl64_88034341132) were harness errors, exit 3221225477, on every run. Fault offsets0xafeb87in 32.0.21037.1004 (25.12.1) and0xaff2d7in 32.0.21045.29003 (26.11.2).vk_pipeline_checkcrashes on the same SPIR-V, so it is pipeline creation, before any dispatch. The--wave64-emulateform never crashed.Reduced to:
v_subrev_co_u32_e64 v6, s[18:19], v1, v1+ds_permute_b32+ds_swizzle_b32+s_bcnt0_i32_b64v_sub_co_u32_e64 v4, s[18:19], v1, v1+s_and_saveexec_b64 s[22:23], s[18:19]+ds_bpermute_b32Edits of the translated module of (b), 3 runs each:
OpISubBorrowwith literally the same id twiceOpGroupNonUniformAnyx < xorx != xOpISubBorrow %x %c0,OpISubBorrow %c0 %x,OpIAddCarry %x %xfalsemaskThe change: x - x is 0 with no borrow, so the translator now writes D = 0 - carry in and borrow out = carry in for these forms (D = 0 and no borrow without a carry in), with no
OpISubBorrow. Values are unchanged; other operand pairs are translated as before. New contract row indocs/design.md: "Carry-out subtract of a register from itself". New test:tests/semantic/test_sub_co_same_operand.py.Same driver as
#4613(wrong values from two native wave64 shuffles) and#857(crash on emulatedlds_fuzzprograms), different trigger.Tested
On main
c1f6b5bb5(this branch's base), iGPU on 26.11.2 unless noted:--programs 2, same flags): harness error with the upstream translator, 2/2 match with this change.cs_xl64_88034341203); emulate 400/400. On5d74c2723before the change: 397 match, 2 harness errors, the same 1 hypothesis-only.tests/semantic/test_sub_co_same_operand.py(new): 6 tests pass (wave32 and native wave64 run inspirv_mini_interp, the emulated form checked by its text); 24 failures against the unchanged translator.scripts/run_semantic_tests.py tests/semantic: 460 files, 6052 tests, 4 files fail:test_exec_computed,test_image_atomics_guard,test_sopc_validation,test_unary_f16_validation. Each fails with the same count (2, 47, 1, 15) with the upstream translator, so none comes from this change.scripts/run_gpu_tests.py, 248 shaders translated and valid: iGPU 227/248 passed, 17 skipped, 4 failed (cs_imgload_tfe,cs_imgload_d16_tfe,cs_w32_exec_computed,cs_w64_exec_computed); RTX 5080 195/248 passed, 49 skipped, 4 failed (the first three plusms_wave_info_s3,#8306). Thetfeandexec_computedtests fail the same way with the upstream translator on both GPUs.crosslane_fuzz.py --programs 300 --seed 880317 --wave both --no-maskdata --dpp --exton the RTX 5080 (run on5d74c2723with this change): 150/150 wave32 native, 150/150 wave64 emulate.Not run:
runtime/does not build with MSVC onc1f6b5bb5(d3d12_xs_device.cpp:1606,d3d12_vulkan_device.cpp:10001,acphal.cpp:146/167;#9812), so the D3D12ctesttargets were not run. The standalone Vulkan tools build and were rebuilt from this base. The only carry-out subtract inruntime/test/shadersisps_ops2.asm:13, with two different operands, so no test shader contains the form this changes.Limits:
OpISubBorrow; only the same-operand form is covered.AI-assisted: yes (Claude Code)
Checklist
docs/design.md, with how it was confirmed.🤖 Generated with Claude Code