buffer.alloca
← buffer dialect
Create a fixed-frame scratch buffer root in an allocatable memory space. Each execution produces a distinct storage identity; identical allocas must not be commoned. The byte length is the requested physical byte count for the execution. Targets requiring a static frame reserve its proven finite non-negative maximum. base_alignment is the minimum byte alignment of the root storage base. Target lowering determines which allocatable spaces are legal for the containing program kind.
Operation contract
| Property |
Value |
| Semantic phase |
executable |
Signature
| Kind |
Name |
Type |
Cardinality |
Description |
| Operand |
byte_length |
offset |
required |
Requested physical byte length of the scratch root. |
| Result |
result |
buffer |
required |
Fresh opaque scratch storage root. Produces a fresh allocation. |
| Attribute |
base_alignment |
i64 |
required |
Minimum byte alignment of the root storage base. |
| Attribute |
memory_space |
enum MemorySpace |
required |
Allocatable scratch memory space for the root. |
Examples
%scratch = buffer.alloca<workgroup> align(64) %bytes : buffer