rdna2spirv, lane_masks: extract per-lane bits for m0 and scc/src_scc in mask_src and _maskable_b32 (SHADER-MASK-SRC-M0-SCC) #1996
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1996"
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?
Imported from ubiquitarianism/leonida. Originally posted by ShotTechOp on 2026-11-25T17:52:11Z.
Claimed in #1608 as
SHADER-MASK-SRC-M0-SCC.What and why
_maskable_b32in bothtools/rdna2spirv.pyandtools/lane_masks.pypreviously accepted onlysgpr,imm,exec*,vcc*, andnull, omittingm0andscc/src_scc.exec_lo/exec_hiorvcc_lo/vcc_hiwithm0orsrc_scc(e.g.,s_and_b32 exec_lo, exec_lo, m0,s_andn2_b32 exec_lo, exec_lo, m0,s_and_b32 vcc_lo, vcc_lo, m0,s_not_b32 vcc_lo, m0),sop2_b32_srcs/s_not_b32fell back to rawsrc_u()instead of_mask_b32_src():exec_lo/exec_hidestinations,rheld raw non-zero bitmasks on active lanes whose bit inm0/src_sccwas0, soscc_logic(scc_any_half(r)) setSCC = 1even when the resultingEXEChalf was0(e.g.,exec_lo = 0x2,m0 = 0x5->exec_lo & m0 == 0still setSCC = 1).vcc_lo/vcc_hidestinations,put_mask/dststored that raw non-zero word into%vccon lanes whose bit inm0was0(corrupting subsequentv_cndmask_b32ands_cbranch_vccz), andlane_masks.stepdroppedvccfrom the mask state.Gen.mask_srcalso raisedUnsupported("mask operand")form0andscc/src_scc, breakings_*_saveexec_b32/s_*_wrexec_b32/s_*_saveexec_b64withm0orsrc_scc.m0,scc, andsrc_sccto_maskable_b32(both modules) and toGen.mask_src(zero-extending bits32..63to0whenwide and self.wave64) fixes both the silent miscompilations and thesaveexec/wrexecrejections.m0andscc/src_scclane-mask sources indocs/design.md.Testing
tests/semantic/test_mask_src_m0_scc.py— testss_and_b32,s_andn2_b32,s_or_b32,s_xor_b32,s_not_b32intoexec_lo,exec_hi,vcc_lo,vcc_hi(wave32 and wave64), ands_and_saveexec_b32/s_and_saveexec_b64withm0andsrc_scc, checking both per-lane mask values andSCC.origin/main(b9320a1):tests/semantic/test_mask_src_m0_scc.pyfails withFAILED (failures=19, errors=1)(proving wrongSCConexec_lo/exec_hi, corruptedvcc_lo/vcc_hilane bits, andUnsupported("mask operand")ons_and_saveexec_b32/b64).python -I tests/semantic/test_mask_src_m0_scc.py -v(3/3 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_mask_src_sgpr_const.py(7/7 OK)python -m unittest discover -s tests/semantic -p test_wave64_vcc_half_write.py(7/7 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_mask_src_m0_scc.pypython -I scripts/check_no_game_data.py tools/rdna2spirv.py tools/lane_masks.py docs/design.md tests/semantic/test_mask_src_m0_scc.pygit diff --checkImported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-11-28T06:00:24Z.
#1996 | head 01cd084222a375ea975da8241c79e4305f442869 | python -I -m unittest discover -s tests/semantic -p test_mask_src_m0_scc.py | red: FAILED (failures=19, errors=1; AssertionError + rdna2spirv.Unsupported) | green: 3/3 OK (2.949s) | full suite: 513/521 stdlib passed after standalone rerun of parallel-timeout test_merge_check.py (0 new failures), semantic 506 files / 6400 tests / 0 failed vs main 8994000b08 | Windows 11, Python 3.14.7, no game files | AI-assisted: yes, Antigravity (Gemini)Details:
tests/semantic/test_mask_src_m0_scc.pyonupstream/main8994000b08):Ran 3 tests in 2.892s — FAILED (failures=19, errors=1):rdna2spirv.Unsupported: mask operandintest_saveexec_b32_and_b64_with_m0_and_src_scc, plus 10AssertionErrorsubtests intest_exec_b32_bitwise_with_m0_gives_exact_lanes_and_sccand 9AssertionErrorfailures intest_vcc_b32_bitwise_and_not_with_m0_and_scc.upstream/main8994000b08):Ran 3 tests in 2.949s — OK.scripts/check_no_game_data.py->0;python -m compileall -q tools scripts tests->0;node --test tests/test_viewer_streaming.cjs->0.tests/test_*.pyinitially hit 1 parallel 90s worker timeout ontests/test_merge_check.py(which passed24/24 OKin44.549swhen re-run standalone on the merged PR tree), giving513/521 passed(33skipped pytest/helper files;0new failures vs8994000b08, same 8 pre-existing failures). Semantic suite:506 files, 6400 tests, 0 files failed in 430 s with 16 jobs.Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T12:41:49Z.
Physical gfx906, native subgroup 64, RADV Mesa 26.0.8 with synchronization validation. Same synthetic inputs on main
d48a957bband01cd08422merged with it: 65/90 GPU readbacks matched on main, 102/102 on the merge. With EXEC low = 2 and M0 = 5, their AND correctly left the low half empty on both builds, but main set SCC to 1. The merge returned SCC = 0 and preserved the upper half. Across the paired cases, 576 wrong SCC words and 180 wrong VCC predicate words went to zero. All 24 ordinary-SGPR controls matched byte for byte.The 12 additional merge dispatches were the encodable
src_scc64-bit saveexec/wrexec forms; main refused both modules before dispatch. No hardware claim for 64-bit M0 (not encodable with the tested gfx1030 assembler) or 32-bit saveexec/wrexec (both translators rejected those fixtures with wave64 metadata). All accepted dispatches preserved their guards and reported no validation errors or synchronization hazards.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T00:00:37Z.
Tested
01cd08422merged (no commit) withmainaa918e5d9. Python 3.12.4, Windows 11 10.0.26300, CPU only, withLLVM_MC(conda-forge llvm-tools) and SPIRV-Tools from the Vulkan SDK 1.4.363.1.check_no_game_data.pyis clean.tests/semantic/test_mask_src_m0_scc.py, 3 tests pass.tools/lane_masks.pyandtools/rdna2spirv.pyback tomain, it fails (m0/scclanes are not extracted per lane).Overlap check across #1973, #1977, #1990, #1943, #1994, #1996 and #1803 (same translator area):
s_wqm, #1990 forsrc64_data/is_mask_op;s_movintoexec_hi, #1996 form0/scc;docs/design.md, between #1990, #1943 and #1994.main(docs/design.mdtaken frommain), each PR's own test file passes. The full semantic suite (scripts/run_semantic_tests.py tests/semantic -j 4, 528 files, 6513 tests) fails in 2 files:test_valu_cvt_f16_int16_mods, which fails on plainmaintoo;test_wave64_emulate_opt, which comes from #1990 alone (see #1990).No blocker from my side.
AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T00:13:57Z.
Merged after TheGeogeo's red/green check (check) (Windows, Python tests, no GPU needed) and a local re-check here. Merged after local re-verification: this PR merged onto
main58a216c70without conflict, and its test file(s) (tests/semantic/test_mask_src_m0_scc.py) pass there. Earlier today the same tests failed onmainwithout the PR (red/green) and a bundle with other open PRs showed no new failures.check_no_game_data.pyis clean. Windows 11, Python 3.14; no GPU needed for these tests.AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.