mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:45:53 +01:00
[PR #1973] rdna2spirv: read %vcc and %vcc_hi for plain 64-bit scalar data in s_bcnt/s_ff/s_flbit _b64/_i64 (SHADER-B64-BITOPS-VCC-DATA) #1979
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#1979
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/1973
Author: @ShotTechOp
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/b64-bitops-vcc-data📝 Commits (1)
a186754rdna2spirv: read %vcc and %vcc_hi for plain 64-bit scalar data in s_bcnt/s_ff/s_flbit📊 Changes
3 files changed (+242 additions, -1 deletions)
View changed files
📝
docs/design.md(+1 -1)➕
tests/semantic/test_b64_bitops_vcc_data.py(+222 -0)📝
tools/rdna2spirv.py(+19 -0)📄 Description
Claimed in #1608 as
SHADER-B64-BITOPS-VCC-DATA.What and why
When
vccholds plain 64-bit scalar data (not tracked as a lane mask bytools/lane_masks.py, e.g., written vias_mov_b32 vcc_lo, ...; s_mov_b32 vcc_hi, ...), the 64-bit scalar bit-count and bit-scan instructions mishandledvcc(ands_flbit_i32_{b64,i64}also rejectednull):s_bcnt1_i32_b64/s_bcnt0_i32_b64(tools/rdna2spirv.py): whenself.holds_lane_mask(a[1])wasFalse,vccfell through tolo, hi = (self.mask_src(a[1]), self.cu(0)), dropping%vcc_hicompletely (hi = 0). For example,vcc = (0x3, 0xF)returned2instead of6ons_bcnt1_i32_b64, andvcc = (0xFFFFFFFF, 0xFFFFFFFF)returned32(SCC = 1) instead of0(SCC = 0) ons_bcnt0_i32_b64.s_ff1_i32_b64/s_ff0_i32_b64(tools/rdna2spirv.py): same fallthrough (lo, hi = self.mask_src(a[1]), self.cu(0)), dropping%vcc_hisovcc = (0, 0x8)returned-1instead of35ons_ff1_i32_b64, andvcc = (0xFFFFFFFF, 0xFFFFFFFF)returned32instead of-1ons_ff0_i32_b64.s_flbit_i32_b64/s_flbit_i32_i64(tools/rdna2spirv.py): only accepted SGPR pairs and immediates on the non-mask path, raisingUnsupportedon plain-datavccandnull.Both
s_bitcmp[01]_b64(bitcmp) ands_cmp_eq/lg_u64already handle plain-datavccby loading%vccand%vcc_hi, andnullas(0, 0).Changes
tools/rdna2spirv.py:a[1]/x==vcc(whenholds_lane_mask(...)isFalse) by loading(%vcc, %vcc_hi)andnullas(0, 0)ins_bcnt[01]_i32_b64,s_flbit_i32_{b64,i64}, ands_ff[01]_i32_b64.vcc(holds_lane_mask(...) == True) continues to take the existingwave_mask()path unchanged.docs/design.md:vccandnullhandling in theWave64 mask ballotrow of the translator contract table.tests/semantic/test_b64_bitops_vcc_data.py:s_bcnt1_i32_b64+ SCC,s_bcnt0_i32_b64+ SCC,s_ff1_i32_b64,s_ff0_i32_b64,s_flbit_i32_b64,s_flbit_i32_i64) on plain-datavccacross 9 edge-case(lo, hi)pairs in native wave64,--wave64-emulate, and FSPX wave32 (s_flbit_i32_{b64,i64}), plus lane-mask-to-plain-data transitions,nullsources, and a real lane-maskvcccontrol.Verification
spirv_mini_interp; no GPU, LLVM, or SPIRV-Tools installed locally).python -I tests/semantic/test_b64_bitops_vcc_data.py -vpython -m unittest discover -s tests/semantic -p test_scalar_bitcmp.pypython -m unittest discover -s tests/semantic -p test_salu_flbit_lane_mask.pypython -m unittest discover -s tests/semantic -p test_wave64_vcc_half_write.pypython -m unittest discover -s tests/semantic -p test_scmp_u64_mask_pairs.pypython -m unittest discover -s tests -p "test_docs_*.py"python -I tests/test_text_write_line_endings.pypython -m compileall -q tools/rdna2spirv.py tests/semantic/test_b64_bitops_vcc_data.pypython -I scripts/check_no_game_data.py tools/rdna2spirv.py docs/design.md tests/semantic/test_b64_bitops_vcc_data.pygit diff --checkorigin/main(tools/rdna2spirv.pyatfe15534):tests/semantic/test_b64_bitops_vcc_data.pyfails onorigin/main—test_bcnt_and_ff_plain_vcc_data_reads_high_wordsilently miscompiles all 4(lo, hi)cases (%vcc_hidropped to 0, e.g. returning[2, 1, 62, 1, 0, 2]instead of[6, 1, 58, 1, 0, 2]for(0x3, 0xF)and[0, 0, 64, 1, 0xffffffff, 0]instead of[1, 1, 63, 1, 35, 0]for(0, 0x8)), and all 5s_flbit_i32_{b64,i64}tests raiseUnsupported: s_flbit_i32_b64 source; the lane-mask control passes.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.