rdna2spirv: extract per-lane bits for non-mask special sources in s_mov_b32 exec_hi (SHADER-EXEC-HI-SPECIAL-SRC) #1994
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1994"
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:43:14Z.
Claimed in #1608 as
SHADER-EXEC-HI-SPECIAL-SRC.What and why
tools/rdna2spirv.py,s_mov_b32 exec_lo, <special>falls through toGen.dst->Gen.exec_bit, which extracts bit(lane & 31)for every non-mask source (m0,scc/src_scc, plain-datavcc_lo/vcc_hi, etc.).s_mov_b32 exec_hi, <src>branch only extracted per-lane bits whensrc["k"] == "sgpr"and otherwise passed rawself.src_u(src)straight intoGen.exec_half_write(1, val, None). Becauseexec_half_writetestsval != 0, any non-zero bit inm0,src_scc, or plain-datavcc_lo/vcc_hisilently activated all 32 upper lanes (32..63) instead of only the lanes whose bits were set.self.exec_bit(self.src_u(src))while keeping lane-mask sources (self.holds_lane_mask(src)) onself.src_u(src)bringsexec_hiinto parity withexec_loand hardware (both native wave64 and--wave64-emulate).Constant lane masks/SHADER-1264contract row indocs/design.md.Testing
tests/semantic/test_exec_hi_special_src.py— testss_mov_b32 exec_hifromm0, plain-datavcc_lo, plain-datavcc_hi(native wave64 and--wave64-emulate),src_scc(0and1), and a lane-maskvcc_hicontrol while confirmingexec_lois preserved.origin/main(fd33a31):tests/semantic/test_exec_hi_special_src.pyfails onorigin/main(provingm0, plain-datavcc_lo/vcc_hi, andsrc_scc = 1turn on all 32 upper lanes instead of the set bits).python -I tests/semantic/test_exec_hi_special_src.py -vpython -m unittest discover -s tests/semantic -p test_exec_computed.pypython -m unittest discover -s tests/semantic -p test_wave64_mov_b32_cross_half.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_exec_hi_special_src.pypython -I scripts/check_no_game_data.py tools/rdna2spirv.py docs/design.md tests/semantic/test_exec_hi_special_src.pyImported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-25T17:45:43Z.
I confirmed the EXEC high-half fix on an RTX 4090, Windows 11, NVIDIA 616.64. I ran the same seven synthetic compute shaders on parent
fd33a31a2and head37d433c79, using--wave64-emulatewith 32-wide hardware subgroups. Each dispatch writes one word for each of the 64 logical lanes.m0, plain-datavcc_loand plain-datavcc_hi, six masks per sourcesrc_scc, false and truevcc_loands8For example, writing
m0 = 0x80000002toexec_hienabled all 32 upper lanes on the parent. On the head it enabled exactly lanes 33 and 63. Across the 23 dispatches, incorrect output words fell from 364 to zero out of 1,472. The low-half mask stayed at0x00000003and all 16 trailing guard words were intact on every readback. All seven shaders passed Vulkan 1.2 SPIR-V validation on both revisions.Separately, the head passed all three CPU interpreter tests in
test_exec_hi_special_src.py. Hardware coverage here is emulated wave64 on NVIDIA. AI-assisted verification with OpenAI Codex.Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T12:19:14Z.
Native wave64 confirmation on physical gfx906 (RADV Mesa 26.0.8), complementing the earlier emulated-wave64 check. Same 11 shaders and six runtime inputs against main
d48a957bband37d433c79merged with it. All translated, passedspirv-valand dispatched on both builds.Main matched 49/66 readbacks; the merge matched 66/66 (488 wrong output words to zero). With only bits 1 and 31 set in M0, main enabled every upper lane; the merge enabled only lanes 33 and 63, leaving the lower half unchanged. With
src_scc = 1, only lane 32 was enabled in the upper half on the merge. The 42 control dispatches, including same-half and opposite-half tagged mask copies, were byte-identical between builds. All guards matched; no Khronos validation errors or synchronization hazards in the shader runs.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T00:00:35Z.
Tested
37d433c79merged (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_exec_hi_special_src.py, 3 tests pass.tools/rdna2spirv.pyback tomain, it fails (the upper lanes read0instead of their own bit).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 OreoFR on 2026-11-29T08:33:54Z.
@ShotTechOp this PR now conflicts with
main(docs/design.md). Could you mergemaininto your branch (no force-push needed)? It was verified before the conflict: https://github.com/ProjectLeonida/mandy/pull/1994#issuecomment-7247808994. If there's no update within 24 h, OreoFR may carry it in a new PR that keeps you as co-author (per the maintainers' plan). — OreoFR's agent (AI-assisted)Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-30T13:24:58Z.
Carried as #2723 because of the conflict with main after #2566; @ShotTechOp, if you come back, say so and the carry is dropped.