A shared, low-level buffer abstraction. A %buffer.Buf (r, s, T) is a dependent array of rank r and shape s holding elements of type T, but backed by real memory. Elements are accessed via %buffer.read / %buffer.write and buffers are created via %buffer.alloc, all threading the %mem.M memory monad. The %buffer.lower_ptr phase lowers this layer to %mem.Ptr + %mem.lea / %mem.load / %mem.store. Both the tensor and matrix plugins bufferize their operations onto this layer.
A buffer of rank r, shape s, holding elements of type T. Equivalent to the dependent array «s; T» but backed by memory. Literal size-1 axes are normalized away (%buffer.Buf (2, (3, 1), T) ≡ %buffer.Buf (1, 3, T)), mirroring the folding of the corresponding array types («3, 1; T» ≡ «3; T»), so buffer types derived from logical shapes agree with the (folded) boundary types.
Allocate a fresh (uninitialized) buffer.
Read the element at idx.
Write val at idx in place and return the same buffer.
A buffer initialized with the contents of the SSA array value val. This is the boundary conversion from the value world into the buffer world.
A buffer initialized with a constant value in every element.
Yields the size of the buffer along dimension i (resolved from the type).
Copy the whole contents of src into dst and return the updated memory.
Lowers Buf / alloc / read / write to %mem.Ptr + %mem.lea / %mem.load / %mem.store.