Commit Graph

1 Commits

Author SHA1 Message Date
d714ee8e09 rdna2spirv/lane_masks: keep wave64 s_*_saveexec_b32 and _wrexec_b32 on EXEC_LO
In wave64 mode, the 32-bit SOP1 forms s_<op>_saveexec_b32 (all 10
EXEC_LOGIC ops) and s_andn{1,2}_wrexec_b32 operate strictly on EXEC_LO
(lanes 0..31): EXEC_HI (lanes 32..63) stays unchanged, SCC reflects
(EXEC_LO != 0) only, and the destination holds the low-half 32-bit mask.

Previously:
- set_exec(r) overwrote lanes 32..63 of %active as well;
- scc_from_mask(r) voted over all 64 lanes instead of lanes 0..31;
- mask_dst(a[0], ...) clobbered vcc_hi when targeting vcc_lo;
- tools/lane_masks.py tagged the destination SGPR as full MASK instead
  of MASK_LO, causing subsequent s_bcnt1_i32_b32 / s_ff1_i32_b32 /
  s_cmp_eq_u32 consumers to include lanes 32..63.

Use exec_half_write(0, r), scc_any_half(r, 'lo'), put_mask(..., 'lo')
(plus wave_mask cross-half bit transfer when S0 is a MASK_HI operand or
D is exec_hi/vcc_hi), and tag _b32 saveexec/wrexec destinations as
MASK_LO in tools/lane_masks.py. Wave32 and _b64 paths are unchanged.

Verified with tests/semantic/test_wave64_saveexec_b32.py (5/5, 64-lane
interpreter + spirv-val Vulkan 1.3 native and --wave64-emulate),
test_lane_masks.py, test_wrexec_b32.py, test_saveexec_variants.py,
test_or_saveexec.py, test_mask_src_sgpr_const.py, and
test_wave64_vcc_half_write.py.
2026-11-22 21:58:16 +01:00