mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:50:52 +01:00
[PR #2011] rdna2spirv, lane_masks: handle special/mask destinations in s_cmov_b32, s_cmovk_i32, and s_movk_i32 (SHADER-CMOV32-MASK-AND-DST) #2016
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#2016
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/2011
Author: @ShotTechOp
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/cmov32-mask-and-dst📝 Commits (1)
8fbcc22rdna2spirv, lane_masks: handle special and lane-mask destinations in s_cmov_b32, s_cmovk_i32, and s_movk_i32📊 Changes
4 files changed (+360 additions, -8 deletions)
View changed files
📝
docs/design.md(+1 -1)➕
tests/semantic/test_cmov32_mask_and_dst.py(+321 -0)📝
tools/lane_masks.py(+23 -0)📝
tools/rdna2spirv.py(+15 -7)📄 Description
Claimed in #1608 as
SHADER-CMOV32-MASK-AND-DST.What and why
s_cmov_b32ands_cmovk_i32(D = SCC ? S0 : D, SCC read and not written) intools/rdna2spirv.pypreviously restricted the destination to plain SGPRs (if a[0]["k"] != "sgpr": raise Unsupported(...)), rejectingexec_lo,exec_hi,vcc_lo,vcc_hi,m0, andnulleven though all are valid 32-bitSDSTencodings in RDNA2 SOP1/SOPK.tools/lane_masks.pyalso had no rules fors_cmov_b32,s_cmovk_i32, ors_movk_i32:s_cmov_b32/s_cmovk_i32targeting a lane-mask SGPR (from another mask or0/-1) cleared its lane-mask tag, causing later whole-wave readers likes_bcnt1_i32_b32to read a per-lane bool (0xFFFFFFFF/0) as scalar data (32or0) instead of the wave's popcount.s_movk_i32writing0or-1(0xffff) did not recordEITHER, so:s_movk_i32 vcc_lo, 0/-1failedvcc_half_keeps_mask()and overwrote the whole%vcc(wipingvcc_hi), whiles_movk_i32 vcc_hi, 0/-1only stored%vcc_hiwithout updating lanes32..63of%vcc.s_movk_i32 sN, 0/-1on one path and a lane mask on the other droppedsNfrom the lane-mask state.s_cmov_b32ands_cmovk_i32through the existing 32-bit mask helpers (_mask_b32_dst_half/_mask_b32_src/_store_b32_mask_dst) and modelings_movk_i32/s_cmov_b32/s_cmovk_i32inlane_masks.stepfixes all four cases cleanly.Scalar select and packcontract row indocs/design.md.Testing
tests/semantic/test_cmov32_mask_and_dst.py— testss_cmov_b32/s_cmovk_i32intoexec_lo/exec_hi(wave32 and wave64, cross-halfexec_lo <- vcc_hi, untouched-half preservation),vcc_lo/vcc_hi,m0,null, lane-mask SGPRs (withs_bcnt1_i32_b32), ands_movk_i32wave64vcc_lo/vcc_hihalf-writes + CFG merge.origin/main:tests/semantic/test_cmov32_mask_and_dst.pyfails withFAILED (failures=8, errors=2)(provingUnsupportedonexec/vcc/m0/null, brokens_bcnt1returning32/0afters_cmov_b32/s_cmovk_i32on mask SGPRs, and broken wave64s_movk_i32 vcc_lo/vcc_hihalf-writes + CFG merge).python -I tests/semantic/test_cmov32_mask_and_dst.py -v(4/4 OK)python -m unittest discover -s tests/semantic -p test_salu_cmov.py(5/5 OK)python -m unittest discover -s tests/semantic -p test_salu_b32_lane_masks.py(9 ran, OK, 1 skipped)python -m unittest discover -s tests/semantic -p test_wave64_vcc_half_write.py(7/7 OK)python -m unittest discover -s tests/semantic -p test_scalar_alu_imm_bitset.py(17/17 OK)python -m unittest discover -s tests -p "test_docs_*.py"(50/50 OK)python -I tests/test_text_write_line_endings.py(3/3 OK)python -m compileall -q tools/rdna2spirv.py tools/lane_masks.py tests/semantic/test_cmov32_mask_and_dst.pypython -I scripts/check_no_game_data.py tools/rdna2spirv.py tools/lane_masks.py docs/design.md tests/semantic/test_cmov32_mask_and_dst.pygit diff --check🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.