test_lds_{read_write,direct,basic_alloc,atomic_add,atomic_minmax,atomic_xchg}.py built their own LDS interpreter
and only checked the shape of Gen's output, so a wrong ds_* lowering could not fail them. They now translate
hand-written compute listings with tools/rdna2spirv.py and run them in spirv_mini_interp, with hand-written
expected words and a plain-Python LDS model for seeded random sequences. basic_alloc also pins the current
allocation rule (offsets past the declared size bound-check instead of growing the array); the old file modelled
the earlier rule.
RDNA2 LDS does not wrap: an access outside the allocation reads 0 and
its write is dropped (ISA 3.6.1, 3.6.6). The wrapped array aliased such
an access onto a valid word (review on #1882). When a program's
constant offsets reach past its RSRC2 allocation, or the array is shrunk
to fit the cap, the array is now the allocation and Gen.lds_access
checks every dword of every LDS access kind (reads, writes, sub-dword,
read2/write2, atomics, cmpst, wrxchg): out of range a read or an
atomic's old value is 0 and the write is skipped. Other shaders keep
the wrapped power-of-two array with no check. The constant-offset need
is now exact (offset + access width) instead of offset + 4 dwords.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>