Files
mandy/tests/semantic/fixtures/disasm/cs_exec_copy.s
whoalin1 b3cc377020 translator: s_mov copies of EXEC keep the narrowing's tag through SGPR round-trips
Review follow-up on the mask-word gather gate (#1397): `s_mov_b32 s4,
exec_lo` under an unknown EXEC narrowing recorded nothing for s4, so the
later `s_mov_b32 exec_lo, s4` restore minted a fresh ("n", id) tag in
_exec_src_ex. mask_exec_sigs coverage then failed and the read kept this
lane's 0 / ~0 bit, while the equivalent literal `s_mov_b32 exec_lo, -1`
resolved to a constant half-state and gathered — register and literal
restores of the same runtime value disagreed.

_mov_sgpr_vals now returns an ("al", halves) alias for an EXEC source
whose half-state is an unknown narrowing, the same scheme saveexec uses:
exec_lo gives (state, None), exec_hi (None, state), exec gives each half
in its own register for b64 moves. _exec_src_ex already resolves those
aliases, so the restore reproduces the original tag and the gather stays
exact; untracked SGPR sources still mint a fresh narrowing and stay
conservative.

Tests: two semantic cases (wave32 and wave64) assert the register
round-trip gathers OpGroupNonUniformBitwiseOr identically to the literal
-1 restore; cs_exec_copy.asm (+ fixture, check.py/run_gpu_tests.py dump
entries) stores the mask word, exec_lo's own word and the literal-restore
word side by side on real hardware — PASS on RTX 4070 and Radeon
(64-wide), wave64 exec filters 9/9 on AMD.

Co-Authored-By: Devin <noreply@cognition.ai>
2026-11-30 22:22:44 +00:00

27 lines
806 B
ArmAsm

; cs_exec_copy test fixture generated by tests/semantic/regen_fixtures.py from runtime/test/shaders/cs_exec_copy.asm
v_mov_b32_e32 v7, -1
v_readfirstlane_b32 s7, v7
s_mov_b32 exec_lo, s7
v_and_b32 v1, 1, v0
v_cmp_ne_u32_e64 s8, v1, 0
s_mov_b32 s4, exec_lo
s_mov_b32 exec_lo, s4
v_mov_b32_e32 v2, s8
v_mov_b32_e32 v4, exec_lo
s_mov_b32 exec_lo, -1
v_mov_b32_e32 v5, s8
v_lshlrev_b32_e32 v3, 4, v0
v_mov_b32_e32 v20, v2
v_mov_b32_e32 v21, v3
buffer_store_dword v20, v21, s[0:3], 0 offen
v_mov_b32_e32 v20, v4
v_add_nc_u32_e32 v21, 4, v3
buffer_store_dword v20, v21, s[0:3], 0 offen
v_mov_b32_e32 v20, v5
v_add_nc_u32_e32 v21, 8, v3
buffer_store_dword v20, v21, s[0:3], 0 offen
v_mov_b32_e32 v20, v0
v_add_nc_u32_e32 v21, 12, v3
buffer_store_dword v20, v21, s[0:3], 0 offen
s_endpgm