Commit Graph

3 Commits

Author SHA1 Message Date
29a8ebea85 tests/semantic: run the LDS read/write, direct, alloc and atomic add/min/max/xchg tests through the translator
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.
2026-11-22 15:49:36 -05:00
ce7a34850e SHADER-309: bounds-check LDS past the RSRC2 allocation
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>
2026-11-22 17:01:45 +01:00
eda4ccd02c test(semantic): add interpreter tests for LDS atomic add (ds_add_u32, ds_add_rtn_u32) 2026-11-21 19:05:56 +01:00