Skip to content

view.alloca

← view dialect

Allocate frame-owned typed storage and return a view of its elements. The result type supplies the shape and layout. The allocation and all derived views borrow the current invocation and cannot escape it. Reference elements occupy opaque reference cells, never byte-addressable buffer storage. Scalar contents are unspecified; reference cells start null. The allocation shares the backing-resource and lifetime contract of buffer.alloca.

Operation contract

Property Value
Semantic phase executable
Ownership effects borrow pool (by_value), borrowed result

Signature

Kind Name Type Cardinality Description
Operand pool pool optional Borrowed resource providing the allocation's backing storage.
Result result view required Borrowed view of fresh frame-owned storage. Produces a fresh allocation.
Attribute base_alignment i64 optional Minimum byte alignment of the storage base, defaulting to one.
Attribute memory_space enum MemorySpace required Allocatable scratch memory space for the root.

Examples

%values = view.alloca<private> : view<16xi64>
%objects = view.alloca<private> : view<16xptr<@Object>>
%tile = view.alloca<workgroup> pool(%memory) align(64) : view<16x32xf32>