Commit Graph

1 Commits

Author SHA1 Message Date
a47953b1de scalar_load: a constant SGPR offset is added as the run-time path adds it (no 32-bit wrap)
#1686 folded a known SGPR offset into the immediate before the 32-bit
truncation (s_buffer_load) or the 21-bit sign extension (s_load), so
s12 = -4 with offset:20 read byte 16 instead of being out of range, and an
s_load sOFF of 2^20 or more turned negative. Hardware does not wrap
(@Pierre-Kookis, gfx1036); the run-time path adds zext(sOFF & ~3) to the
normalised immediate in 64 bits. The fold now does the same. Found and
GPU-reproduced by @Impre-visible.

tests/semantic/test_smem_const_offset.py runs each case with the offset
as a constant and through v_readfirstlane, against the measured rule.
docs/design.md: the row says it (and a duplicated copy of the row goes).
2026-11-22 12:11:16 -03:00