mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:55:52 +01:00
[PR #1977] rdna2spirv: fix plain-data VCC source and non-mask destinations in Gen.wqm (SHADER-WQM-DATA-VCC-AND-DST) #1985
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#1985
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/1977
Author: @ShotTechOp
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/wqm-data-vcc-and-dst📝 Commits (1)
3c4b6fbrdna2spirv: fix plain-data VCC source and non-mask destinations in Gen.wqm📊 Changes
3 files changed (+240 additions, -8 deletions)
View changed files
📝
docs/design.md(+1 -1)➕
tests/semantic/test_wqm_data_vcc_and_dst.py(+198 -0)📝
tools/rdna2spirv.py(+41 -7)📄 Description
Claimed in #1608 as
SHADER-WQM-DATA-VCC-AND-DST.What and why
On the plain-data path of
Gen.wqm()(tools/rdna2spirv.py, whenself.holds_lane_mask(a[1])isFalse), four operand combinations were miscompiled:s_wqm_b64with plain 64-bit scalar data invcc: fell intowords = [self.src_u(src), self.cu(0)], dropping%vcc_hito0(sovcc = (0, 0x80000000)produced(0, 0)withSCC = 0instead of(0, 0xF0000000)withSCC = 1).s_wqm_b32 m0, sS:m0fell into theelse:mask-extract branch and stored a single lane's0/0xFFFFFFFFbit into%m0instead of the 32-bit WQM result.s_wqm_b32/s_wqm_b64into plain-datavcc/vcc_lo/vcc_hi(e.g.s_wqm_b32 vcc_lo, s4,s_wqm_b32 vcc_hi, s5,s_wqm_b64 vcc, s[4:5]):tools/lane_masks.pyclearsvcc's mask state on plain-data writes, so subsequent reads treat%vcc/%vcc_hias plain 32/64-bit scalar words, yetGen.wqm()stored a single lane's bit into%vccand left%vcc_hiuntouched.s_wqm_b32/s_wqm_b64intonull: unnecessarily fell into theelse:branch, emittingwave_lane()+OpBitFieldUExtract+put_mask(null, ...)instead of discarding the result while updatingSCC.Also replaced the inline
OpBitFieldUExtractin the remaining mask-destination branch (execand mask-valuedvcc) withself._scalar_word_lane_bit(word, lane)(consistent withmask_srcand avoiding the Intel UHD 770 16-bit constant offset bug noted indocs/design.md).Changes
tools/rdna2spirv.py:_wqm_dst_is_lane_mask()(matchingvcc_half_keeps_mask()'slane_masks.stepcheck) soGen.wqm()distinguishes mask-valued destinations (exec*,s_wqm_b64 vcc, <imm>, and mask-preserving wave64vcchalf writes) from plain-datavcc/vcc_lo/vcc_hi.%vccand%vcc_hifors_wqm_b64of plain-datavcc(and(0, 0)fornull).null,m0, and plain-datavcc/vcc_lo/vcc_hidestinations directly, and routed mask-valued destinations through_scalar_word_lane_bit().docs/design.md:vccsource and non-mask destination behaviour in theWhole-quad mode (s_wqm_b64 / s_wqm_b32)contract row.tests/semantic/test_wqm_data_vcc_and_dst.py:vccandnullsources ons_wqm_b64,m0destinations (wave32 and wave64), plain-datavcc_lo/vcc_hi/vccdestinations (b32andb64),nulldestination (verifying noSubgroupLocalInvocationId/OpGroupNonUniformemission), and lane-mask controls (s_wqm_b64 vcc, 0x10ands_wqm_b64 exec, s[4:5]).Verification
spirv_mini_interp; no GPU, LLVM, or SPIRV-Tools installed locally).python -I tests/semantic/test_wqm_data_vcc_and_dst.py -vpython -m unittest discover -s tests/semantic -p test_salu_wqm32.pypython -m unittest discover -s tests/semantic -p test_salu_wqm_b32.pypython -m unittest discover -s tests/semantic -p test_wave64_halves_wqm_uvote.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_wqm_data_vcc_and_dst.pypython -I scripts/check_no_game_data.py tools/rdna2spirv.py docs/design.md tests/semantic/test_wqm_data_vcc_and_dst.pygit diff --checkorigin/main(tools/rdna2spirv.pyatfe15534):tests/semantic/test_wqm_data_vcc_and_dst.pyfails onorigin/main(FAILED (failures=10, errors=1)):test_wqm_b32_into_m0_stores_full_worderrors (Unsupported),test_wqm_b64_reads_plain_vcc_both_wordsfails all 3 non-zero high-word cases (dropping%vcc_hito 0), andtest_wqm_into_plain_data_vcc_preserves_wordsfails all 7 non-zero cases (storing per-lane0/0xFFFFFFFFbits into%vccinstead of the WQM words); theexec/vcclane-mask control passes.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.