mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:00:52 +01:00
[PR #1735] wave64_emulate_opt: guard 32-bit opposite-half and live-SCC mask barriers (SHADER-W64-FOLD-B32-MASK-BARRIERS) #1750
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#1750
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/1735
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/w64-fold-b32-mask-barriers📝 Commits (2)
499b6bcwave64_emulate_opt: guard 32-bit opposite-half and live-SCC mask barriers (SHADER-W64-FOLD-B32-MASK-BARRIERS)85ab223tests: check all 64 lanes in B32MaskBarrierTests EXECZ cases📊 Changes
3 files changed (+312 additions, -68 deletions)
View changed files
📝
docs/design.md(+1 -0)📝
tests/semantic/test_wave64_emulate_barriers.py(+195 -0)📝
tools/wave64_emulate_opt.py(+116 -68)📄 Description
Item ID: SHADER-W64-FOLD-B32-MASK-BARRIERS
Claim: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7159451450
Depends on: none
Summary
Follow-up to @whoalin1's finding (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7159165301): aligns
tools/wave64_emulate_opt.py(_classify_block_body,find_local_exec_folds,_insn_may_barrier_with_meta, and_is_uniform_scc_safe) with all 32-bit wave64 lane-mask barrier/vote paths lowered bytools/rdna2spirv.pyunder--wave64-emulate.Root cause
Three 32-bit mask paths in
tools/rdna2spirv.pyemitwave_mask/g_vote(x_round/x_split/OpControlBarrier) under--wave64-emulate, but were missed bytools/wave64_emulate_opt.py:_mask_b32_src(rdna2spirv.py:6095-6110) ons_mov_b32,s_cselect_b32,s_not_b32, andMASK_SOP2_B32(independent of SCC liveness).scc_logicvotes (rdna2spirv.py:6134-6156) on_SOP2_B32_LOGIC(s_and/or/xor/andn2/orn2/nand/nor/xnor/not_b32) when writing a mask destination (exec_lo/hi, orvcc_lo/hiwith mask) or reading same-half / single-half lane-mask sources.wave_maskons_*_saveexec_b32/s_*_wrexec_b32(rdna2spirv.py:11163-11215) when reading a high-half mask source or saving intoexec_hi/vcc_hi(independent of SCC liveness).Before this change, folding an
s_cbranch_execzregion containing any of these instructions trippedAssertionError: wave64 emulation: x_split inside a folded lane-local region, and multi-waveplan_structured_emulationmisclassified wave-divergent guards containing them asinline_sync_free.Changes
tools/wave64_emulate_opt.py:_mask_half,_mask_b32_dst_half, and a single shared_mask_chk_may_barrierhelper used by_classify_block_body,find_local_exec_folds, and_insn_may_barrier_with_meta._MASK_CHK_B32_MOV,_MASK_CHK_B32_LOGIC,_MASK_CHK_B32_CSELECT, and opposite-half checks on_ALL_SAVEEXEC_WREXEC_b32ops._is_uniform_scc_safeto also detectvcc_lo/vcc_himask writes via_mask_b32_dst_half.s_and_b32 vcc_lo, vcc_lo, -1with dead SCC) continue to fold with 0 barriers.tests/semantic/test_wave64_emulate_barriers.py: addedB32MaskBarrierTestscovering unit barrier prediction, all 9 foldeds_cbranch_execzcases (64-thread workgroup interpreter +spirv_asm.assemble), a same-half dead-SCC positive fold control, and a 128-thread multi-wave divergent guard test (reverse_order=False/True).docs/design.md: added contract-table row for--wave64-emulate32-bit opposite-half and live-SCC barrier guards.Verification
spirv-val, or retail game files)python3 -I tests/semantic/test_wave64_emulate_barriers.py: 17/17 OKpython3 -I tests/semantic/test_wave64_emulate_opt.py: 33/33 OKpython3 -I tests/test_wave64_emulate_opt_cfg.py: 26/26 OKpython3 -I scripts/run_semantic_tests.py tests/semantic: 487 files, 6,283 tests, 0 files failed (76 s)python3 -m compileall -q make_game.py tools tests: OKpython3 -I tests/test_text_write_line_endings.py: 3/3 OKpython3 -I scripts/check_no_game_data.py tools/wave64_emulate_opt.py tests/semantic/test_wave64_emulate_barriers.py docs/design.md: OKB32MaskBarrierTestsagainst unpatchedmain:tools/wave64_emulate_opt.py): 11 failures (all 9 foldeds_cbranch_execzcases crash withAssertionError: wave64 emulation: x_split inside a folded lane-local region, plus the unit check and 128-thread multi-wave guard check).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.