spec_tree.bend checks
raw source on the hub · import 0x492532af6deb895462a134d016a53dfe/spec_tree.bend as Spec_tree
Shape specialisation: a non-tail binary recursion on a Nat depth that the leaf gives as a literal. WGSL has no recursion; the lane unrolls it, one fn per (def, literal depth). Two depths in one program (4 and 2). spec!(d, i) = sum over lanes of ptree(4, lane x, lane c) ^ ptree(2, ...)
1 import
import Base
Definitions
def pow2 source · line 6 · raw
@d:Nat -> Nat
def ptree source · line 15 · raw
@dp:Nat -> @+x:U32 -> @+c:U32 -> U32
2^dp leaves: a mixing tree, children given their own (x, c)
def lane source · line 23 · raw
@+i:U32 -> U32
def spec source · line 26 · raw
@d:Nat -> @+i:U32 -> U32
def main source · line 34 · raw
IO(Unit)