Translator: a threadgroup load or store at a constant offset outside the arena is a zero load or no store
An unchecked threadgroup arena access whose offset is a plain constant outside the arena built an OpAccessChain into the arena's word array with a constant index past its length, which the SPIR-V builder rejects (OperandRule::Range), so the function failed with an internal error instead of translating or refusing. Such an access lies outside every threadgroup object, which Metal leaves undefined, so it is now decided at translation time as a contained arena's constant access is: a zero load, or no store. The decision reads the offset and the arena's size as plain constants and interns nothing, so every access inside the arena, and every module that built before, is unchanged; an arena whose size is a specialization constant is never decided this way (its word array has no constant length to break). The shape: Apple's compiler, knowing t == 0 in a branch, writes tg[t - 1u] of a static threadgroup array at arena offset 0 as element 0xFFFFFFFF, a wrapped arena offset of 0xFFFFFFFC. It is the whole of the translation census's internal errors atda020e5d7b(18 functions in 4 libraries on all five profiles, kindcount's m3-max-69549): each a load of an i32 word from a static [N x i32] or [N x float] threadgroup global through an inbounds GEP [0, 4294967295], in a branch, on the arena's u32 words. SEMANTICS_VERSION 2277: those functions' outcome moves from an internal error to a module. Verified: probe m3-max-69624 (baseda020e5d7bplus a report at the builder's range rule) found that one site and shape for all 18 rows; probe m3-max-69654 reproduced the same internal error from owned MSL. The new test drives a load and a store at element 4294967295 of a 64-word threadgroup array through from_queries on four profiles, in an arena of u32 words and one of float words, and checks L3 and the interpreter's answers (the load reads 0, no word takes the store).
This commit is contained in:
1 parent
75c3e49bd6
commit
0b1053f0cc
4 files changed
+115
-4
No files matched your search
+3
-1
@@ -650,7 +650,9 @@ 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 kernel whose every threadgroup access is a
|
||||
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
|
||||
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
|
||||
|
||||
Reference in new issue
Block a user