mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:00:52 +01:00
[PR #2357] rdna2spirv, lane_masks, wave64_halves: fix 3-operand short-form v_*_co_ci_u32 operand classification (SHADER-SHORT-CO-CI-MASK-OPERANDS) #2360
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#2360
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/2357
Author: @ShotTechOp
Created: 11/26/2026
Status: 🔄 Open
Base:
main← Head:fix/short-co-ci-mask-operands📝 Commits (1)
e1ca6ccrdna2spirv, lane_masks, wave64_halves: fix 3-operand short-form v_*_co_ci_u32 operand classification (SHADER-SHORT-CO-CI-MASK-OPERANDS)📊 Changes
4 files changed (+177 additions, -4 deletions)
View changed files
➕
tests/semantic/test_short_co_ci_masks.py(+168 -0)📝
tools/lane_masks.py(+3 -1)📝
tools/rdna2spirv.py(+3 -2)📝
tools/wave64_halves.py(+3 -1)📄 Description
Item:
SHADER-SHORT-CO-CI-MASK-OPERANDSProblem
Gen._insn(tools/rdna2spirv.py) explicitly accepts the 3-operand short VOP2 assembler spellingv_add_co_ci_u32 vD, src0, src1(andv_sub_co_ci_u32/v_subrev_co_ci_u32), where carry-out and carry-in are both implicitvccand operand 1 is the 32-bit sourcesrc0. However, four analysis helpers treated operand 1 as the VOP3b carry-out destination:tools/lane_masks.py(step): Calledput(state, a[1], MASK, wave64), falsely markingsrc0(e.g. an SGPR holding plain scalar data) as a lane mask and failing to mark implicitvccasMASK. Downstream scalar ops readingsrc0(e.g.s_bcnt1_i32_b32) then read the wave ballot (32instead ofpopcnt(src0)).tools/rdna2spirv.py(widen_wave64_masks): Always usedat = (1, 4)for_co_ci_, widening a 32-bitsrc0SGPR (a[1]) ton=2in wave64 shaders, which crashed translation withUnsupported("64-bit operand").tools/rdna2spirv.py(writes_exec): Treateda[1]as a destination on allVOP3_TWO_DESTSops, sov_add_co_ci_u32 v1, exec_lo, v0was falsely flagged as writing EXEC.tools/wave64_halves.py(operands): Splitdests, srcs = [a[0], a[1]], list(a[2:])whena[1]was an SGPR/special, droppingsrc0fromsrcs, falsely claimingsrc0was overwritten, and omitting implicit"vcc"from bothdefsanduses.Fix
tools/lane_masks.py: For 3-operandv_*_co_ci_u32, putMASKon implicitvccinstead ofa[1].tools/rdna2spirv.py: Inwiden_wave64_masks, only widen(1, 4)whenlen(a) > 3; inwrites_exec, skip thea[1]destination check for 3-operand*_ci_u32.tools/wave64_halves.py: For 3-operandv_*_co_ci_u32, keepdests = [a[0]]andsrcs = [a[1], a[2]], and append"vcc"todefs(len(srcs) == 2then also adds"vcc"touses).tests/semantic/test_short_co_ci_masks.py: Unit + wave32/wave64 execution regression tests covering all four sites.Verification
AI-assisted: yes.
Environment: Windows 11, Python 3.12.10, CPU-only (no game files, no
spirv-val, not GPU-verified).python -I tests/semantic/test_short_co_ci_masks.py -v-> 6/6 OKpython -I tests/test_lane_masks.py-> OKpython -I tests/semantic/test_wave64_halves.py-> 127/127 OKpython -I tests/test_text_write_line_endings.py-> 3/3 OKpython -m compileall -q tools/rdna2spirv.py tools/lane_masks.py tools/wave64_halves.py tests/semantic/test_short_co_ci_masks.py-> 0python -I scripts/check_no_game_data.py ...-> 0git diff --check-> 0origin/mainfbf100b1):tests/semantic/test_short_co_ci_masks.pyagainstorigin/main'stools/fails all 6 tests (14 assertion failures + 1Unsupported("64-bit operand")crash on wave64).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.