storage_allocation.bend checks
raw source on the hub · import stelliferous@0.0.2.0/storage_allocation.bend as Storage_allocation
Keep the native allocation extent constant at each call site. With a dynamic depth, Clang 19 retains a scalar initialization loop with a shift per element; constant depths allow memset or vectorized fills. Dispatch once per buffer, covering every power of two below the native depth limit, independently of model shapes. The fallback preserves Storage.allocate for larger depths.
2 imports
import Base import ./storage_buffer.bend as Storage
Templates
template dispatch source · line 9 · raw
@-Element:Data -> @-allocator:(@_:Nat -> @_:Element -> @_:Nat -> 0x9be3b13bf249759bc81e1958bcd1a4c0/storage_buffer.Buffer<Element>) -> @depth:Nat -> @+value:Element -> @length:Nat -> 0x9be3b13bf249759bc81e1958bcd1a4c0/storage_buffer.Buffer<Element>
template allocated source · line 44 · raw
@-Element:Data -> @depth:Nat -> @value:Element -> @length:Nat -> 0x9be3b13bf249759bc81e1958bcd1a4c0/storage_buffer.Buffer<Element>
template allocate source · line 47 · raw
@-Element:Data -> @depth:Nat -> @value:Element -> @length:Nat -> 0x9be3b13bf249759bc81e1958bcd1a4c0/storage_buffer.Buffer<Element>
template storage source · line 52 · raw
@-Element:Data -> @buffer:0x9be3b13bf249759bc81e1958bcd1a4c0/storage_buffer.Buffer<Element> -> Array<Element>
Internal Array callers can discard the construction certificate after the same constant-depth dispatch; no traversal or clone is introduced.
template array source · line 56 · raw
@-Element:Data -> @depth:Nat -> @value:Element -> Array<Element>