mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:40:52 +01:00
[PR #324] [CLOSED] rdna2spirv: write out a carry-out subtract of a register from itself (AMD Windows driver crash) #377
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#377
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/324
Author: @Andretuta
Created: 11/24/2026
Status: ❌ Closed
Base:
main← Head:old-pr/10058📝 Commits (1)
183d63frdna2spirv: write out a carry-out subtract of a register from itself (AMD Windows driver crash)📊 Changes
3 files changed (+216 additions, -11 deletions)
View changed files
📝
docs/design.md(+1 -0)➕
tests/semantic/test_sub_co_same_operand.py(+194 -0)📝
tools/rdna2spirv.py(+21 -11)📄 Description
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
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.