~/bend-docscommunity

traversal_partition.bend checks

raw source on the hub · import stelliferous@0.0.2.0/traversal_partition.bend as Traversal_partition

A work partition is independent of its element representation and ownership. Storage remains in the leaf payload; offset/span describe its logical range.

2 imports
import Base
import ./storage_buffer.bend as Storage

Types

type Tree source · line 6 · raw

@-ownership:Quant -> @-Block:Kind(ownership) -> @-Details:Data -> Kind(ownership)

Templates

template run source · line 18 · raw

@-Input:Type -> @-Weights:Type -> @-Bias:Type -> @-Output:Type -> @-Context:Data -> @-split_input:(@_:Context -> @_:U32 -> @_:U32 -> @_:Input -> Pair(Input, Input)) -> @-clone_weights:(@_:Weights -> Pair(Weights, Weights)) -> @-clone_bias:(@_:Bias -> Pair(Bias, Bias)) -> @-leaf:(@_:Context -> @_:U32 -> @_:U32 -> @_:Input -> @_:Weights -> @_:Bias -> Tree<&1, Output, U32>) -> @depth:Nat -> @+context:Context -> @+offset:U32 -> @+span:U32 -> @input:Input -> @weights:Weights -> @bias:Bias -> Tree<&1, Output, U32>

Each binary fork gives both children independent owners; its leaf callback finishes all local stages before returning. The input split sees the left child's range, so it can copy only what that child reads. Representation adapters supply direct templates, so Array and certified Buffer share it. The last split calls its two leaves directly: a leaf that neither forks nor calls a closure is then its own task, which the runtime keeps for the work turn; a leaf reached through the forking recursion would run in the grow turn on one worker per row.

template gather source · line 39 · raw

@-Output:Type -> @-copy:(@_:U32 -> @_:U32 -> @_:U32 -> @_:U32 -> @_:Output -> @_:Output -> Output) -> @partitions:Tree<&1, Output, U32> -> @output:Output -> @+positions:U32 -> Output