Translator: a threadgroup atomic at a constant offset outside the arena writes nothing and yields zero

The sibling of the out-of-arena load and store. An unchecked threadgroup atomic at a constant
offset outside the arena built an access chain past the arena's word array, which the builder's
range rule rejects, an internal error. It now writes nothing and yields zero, as a contained atomic
out of bounds does (`guarded`), decided by the same plain-constant test (`local::outside_arena`):
an atomic inside the arena, or at an offset that is not a constant, is unchanged. Metal leaves the
access undefined. docs/API.md's threadgroup bullet names the atomic too. No census row reaches it.
This commit is contained in:
Anees Iqbal committed 2026-11-22 21:53:53 -08:00
1 parent 0ace70d4fb
commit de764fc389
3 files changed
+42 -32

No files matched your search

+4 -3
View File
@@ -650,9 +650,10 @@ through buffer arguments it reads at any index.
- **Threadgroup memory.** No threadgroup memory access is
bounded: a load or store, atomic, memory intrinsic, pointer cell or imageblock access of a
threadgroup arena, and a typed threadgroup object's index, run as the program states them, and
one past the memory is undefined, as in Metal. A load or store of the arena at a constant offset
outside it, undefined in Metal too, is a zero load or no store: no access chain may index the
arena's words with a constant past them. A kernel whose every threadgroup access is a
one past the memory is undefined, as in Metal. A load, store or atomic of the arena at a constant
offset outside it, undefined in Metal too, is a zero load, no store, or an atomic that writes
nothing and returns zero: no access chain may index the arena's words with a constant past them.
A kernel whose every threadgroup access is a
whole, aligned `float` (a scalar or a vector of two to four), with no atomic, memory intrinsic,
imageblock or pointer kept in it, and whose SIMD groups are not emulated, holds its threadgroup
memory as a `Workgroup` array of `float`: each access is one typed load or store a lane, with no