Commit Graph

2 Commits

Author SHA1 Message Date
bb1e9a72a8 Translator: a 64-bit exchange done per dword can tear
buffer_atomic_swap_x2, global_atomic_swap_x2 and ds_wrxchg*_rtn_b64 do one 32-bit exchange per dword, which the comments said leaves the same memory as a 64-bit exchange. Two lanes swapping into one element at once can leave one's low dword with the other's high dword. The claim holds for and/or/xor only, whose bits are independent.
2026-11-22 11:16:15 -04:00
739474143a rdna2spirv: buffer_atomic_{and,or,xor,swap}_x2
A bitwise op or an exchange on a 64-bit element leaves the same memory
as one 32-bit atomic per dword, so these four need no Int64 atomics.
With glc the old pair comes back in vdata; it is two reads and can be
torn by a concurrent 64-bit op on the same element. The bounds check
covers the whole 8-byte element, as for a typed 32_32 element (partly
in-range behaviour is not measured). add/sub/min/max_x2 and cmpswap_x2
stay Unsupported.

tests/semantic/test_buffer_atomics_x2.py runs them in the interpreter.
docs/design.md row added.
2026-11-22 09:50:35 -03:00