~/bend-docscommunity

main.bend relies on unsafe/foreign

raw source on the hub · import bend-ml-tensor-gpu@0.1.2.0/main.bend as Main

bend-ml-tensor-gpu: tensor-array's products on the GPU, with tensor-array's bits.

import ../tensor-array/main.bend as TA import bend-ml-tensor-gpu@0.1.2.0/main.bend as TG TG.matmul(n, k, m, par, a, b) # the same arguments, result type and bits as TA.Mat.matmul

The six products (matmul, matmul_nt, matmul_tn and their accumulating forms) take tensor-array's Mat values and return its result types; par is ignored (the GPU decides the split). Each product is one ! call (a bang): a balanced fork tree whose leaves each compute a 4 x 4 tile of C, every node sharing A, B and C through Base's Array.fork (two handles to one block, no copy), as upstream's one-block pattern does (bendlang/bend tests/run/stencil3d.bend). On a machine without a GPU, or with --gpu off, the same bang runs on the CPU threads.

The bits: a cell of C is computed in tensor-array's order. Product p of a dot goes to partial sum p mod 4, in increasing p, each sum starting at +0.0, and the four sums are combined by TA.t8_comb with rot = k mod 4, as tensor-array's dotr and t8_dot do; an accumulating product adds the cell to C once with TA.cwr. The loop takes four steps of k a turn; the steps past k in the last turn add +0.0, which leaves a sum unchanged (a sum that starts at +0.0 is never -0.0). Bend builds the device code with --fmad=false, so no multiply-add is fused. tests/bits.bend checks the bits against tensor-array on many shapes, on the GPU and the CPU.

Not proved, and marked so: Array.fork and Array.join are @unsafe in Base, so the defs below that call them, or take a shared array, are @unsafe, and bend main.bend names every def that relies on them. Nothing checks that a leaf writes only its own tile of C, or never writes A or B; the tiles are disjoint by construction (leaf t writes tile t). All of it is Bend: no foreign code. Written by bend-ml's scripts/gen_tensor_gpu.py (4 x 4 tiles).

2 imports
import Base
import bend-ml-tensor-array@0.1.14.0/main.bend as TA

Types

type E source · line 28 · raw

Data

the sizes and strides of one product: C[i][j] = sum_p A[i*arow + p*sa] * B[p*sb + j*bcol], n x m, k steps

type GR source · line 38 · raw

Type

the values of one turn: A's 4 rows and B's 4 columns at four consecutive steps, read through the arrays in order

type T source · line 174 · raw

Type

the tile's cells after the four sums are combined, row by row

type ABC source · line 243 · raw

Type

type O2 source · line 359 · raw

Type

type O3 source · line 362 · raw

Type

type O4 source · line 365 · raw

Type

type R1 source · line 368 · raw

Type

type R2 source · line 371 · raw

Type

type R3 source · line 374 · raw

Type

type R4 source · line 377 · raw

Type

Definitions

def pk source · line 32 · raw

@ok:Bool -> @+x:F32 -> F32

a product that counts only when its step is inside k (the last turn's steps past k add +0.0)

def gr_31 source · line 41 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @+x1_1:F32 -> @+x1_2:F32 -> @+x1_3:F32 -> @+x2_0:F32 -> @+x2_1:F32 -> @+x2_2:F32 -> @+x2_3:F32 -> @+x3_0:F32 -> @+x3_1:F32 -> @+x3_2:F32 -> @+x3_3:F32 -> @+y0_0:F32 -> @+y0_1:F32 -> @+y0_2:F32 -> @+y0_3:F32 -> @+y1_0:F32 -> @+y1_1:F32 -> @+y1_2:F32 -> @+y1_3:F32 -> @+y2_0:F32 -> @+y2_1:F32 -> @+y2_2:F32 -> @+y2_3:F32 -> @+y3_0:F32 -> @+y3_1:F32 -> @+y3_2:F32 -> @a:Array<F32> -> @rv:Pair(Array<F32>, F32) -> GR

def gr_30 source · line 45 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @+x1_1:F32 -> @+x1_2:F32 -> @+x1_3:F32 -> @+x2_0:F32 -> @+x2_1:F32 -> @+x2_2:F32 -> @+x2_3:F32 -> @+x3_0:F32 -> @+x3_1:F32 -> @+x3_2:F32 -> @+x3_3:F32 -> @+y0_0:F32 -> @+y0_1:F32 -> @+y0_2:F32 -> @+y0_3:F32 -> @+y1_0:F32 -> @+y1_1:F32 -> @+y1_2:F32 -> @+y1_3:F32 -> @+y2_0:F32 -> @+y2_1:F32 -> @+y2_2:F32 -> @+y2_3:F32 -> @+y3_0:F32 -> @+y3_1:F32 -> @a:Array<F32> -> @rv:Pair(Array<F32>, F32) -> GR

def gr_29 source · line 49 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @+x1_1:F32 -> @+x1_2:F32 -> @+x1_3:F32 -> @+x2_0:F32 -> @+x2_1:F32 -> @+x2_2:F32 -> @+x2_3:F32 -> @+x3_0:F32 -> @+x3_1:F32 -> @+x3_2:F32 -> @+x3_3:F32 -> @+y0_0:F32 -> @+y0_1:F32 -> @+y0_2:F32 -> @+y0_3:F32 -> @+y1_0:F32 -> @+y1_1:F32 -> @+y1_2:F32 -> @+y1_3:F32 -> @+y2_0:F32 -> @+y2_1:F32 -> @+y2_2:F32 -> @+y2_3:F32 -> @+y3_0:F32 -> @a:Array<F32> -> @rv:Pair(Array<F32>, F32) -> GR

def gr_28 source · line 53 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @+x1_1:F32 -> @+x1_2:F32 -> @+x1_3:F32 -> @+x2_0:F32 -> @+x2_1:F32 -> @+x2_2:F32 -> @+x2_3:F32 -> @+x3_0:F32 -> @+x3_1:F32 -> @+x3_2:F32 -> @+x3_3:F32 -> @+y0_0:F32 -> @+y0_1:F32 -> @+y0_2:F32 -> @+y0_3:F32 -> @+y1_0:F32 -> @+y1_1:F32 -> @+y1_2:F32 -> @+y1_3:F32 -> @+y2_0:F32 -> @+y2_1:F32 -> @+y2_2:F32 -> @+y2_3:F32 -> @a:Array<F32> -> @rv:Pair(Array<F32>, F32) -> GR

def gr_27 source · line 57 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @+x1_1:F32 -> @+x1_2:F32 -> @+x1_3:F32 -> @+x2_0:F32 -> @+x2_1:F32 -> @+x2_2:F32 -> @+x2_3:F32 -> @+x3_0:F32 -> @+x3_1:F32 -> @+x3_2:F32 -> @+x3_3:F32 -> @+y0_0:F32 -> @+y0_1:F32 -> @+y0_2:F32 -> @+y0_3:F32 -> @+y1_0:F32 -> @+y1_1:F32 -> @+y1_2:F32 -> @+y1_3:F32 -> @+y2_0:F32 -> @+y2_1:F32 -> @+y2_2:F32 -> @a:Array<F32> -> @rv:Pair(Array<F32>, F32) -> GR

def gr_26 source · line 61 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @+x1_1:F32 -> @+x1_2:F32 -> @+x1_3:F32 -> @+x2_0:F32 -> @+x2_1:F32 -> @+x2_2:F32 -> @+x2_3:F32 -> @+x3_0:F32 -> @+x3_1:F32 -> @+x3_2:F32 -> @+x3_3:F32 -> @+y0_0:F32 -> @+y0_1:F32 -> @+y0_2:F32 -> @+y0_3:F32 -> @+y1_0:F32 -> @+y1_1:F32 -> @+y1_2:F32 -> @+y1_3:F32 -> @+y2_0:F32 -> @+y2_1:F32 -> @a:Array<F32> -> @rv:Pair(Array<F32>, F32) -> GR

def gr_25 source · line 65 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @+x1_1:F32 -> @+x1_2:F32 -> @+x1_3:F32 -> @+x2_0:F32 -> @+x2_1:F32 -> @+x2_2:F32 -> @+x2_3:F32 -> @+x3_0:F32 -> @+x3_1:F32 -> @+x3_2:F32 -> @+x3_3:F32 -> @+y0_0:F32 -> @+y0_1:F32 -> @+y0_2:F32 -> @+y0_3:F32 -> @+y1_0:F32 -> @+y1_1:F32 -> @+y1_2:F32 -> @+y1_3:F32 -> @+y2_0:F32 -> @a:Array<F32> -> @rv:Pair(Array<F32>, F32) -> GR

def gr_24 source · line 69 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @+x1_1:F32 -> @+x1_2:F32 -> @+x1_3:F32 -> @+x2_0:F32 -> @+x2_1:F32 -> @+x2_2:F32 -> @+x2_3:F32 -> @+x3_0:F32 -> @+x3_1:F32 -> @+x3_2:F32 -> @+x3_3:F32 -> @+y0_0:F32 -> @+y0_1:F32 -> @+y0_2:F32 -> @+y0_3:F32 -> @+y1_0:F32 -> @+y1_1:F32 -> @+y1_2:F32 -> @+y1_3:F32 -> @a:Array<F32> -> @rv:Pair(Array<F32>, F32) -> GR

def gr_23 source · line 73 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @+x1_1:F32 -> @+x1_2:F32 -> @+x1_3:F32 -> @+x2_0:F32 -> @+x2_1:F32 -> @+x2_2:F32 -> @+x2_3:F32 -> @+x3_0:F32 -> @+x3_1:F32 -> @+x3_2:F32 -> @+x3_3:F32 -> @+y0_0:F32 -> @+y0_1:F32 -> @+y0_2:F32 -> @+y0_3:F32 -> @+y1_0:F32 -> @+y1_1:F32 -> @+y1_2:F32 -> @a:Array<F32> -> @rv:Pair(Array<F32>, F32) -> GR

def gr_22 source · line 77 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @+x1_1:F32 -> @+x1_2:F32 -> @+x1_3:F32 -> @+x2_0:F32 -> @+x2_1:F32 -> @+x2_2:F32 -> @+x2_3:F32 -> @+x3_0:F32 -> @+x3_1:F32 -> @+x3_2:F32 -> @+x3_3:F32 -> @+y0_0:F32 -> @+y0_1:F32 -> @+y0_2:F32 -> @+y0_3:F32 -> @+y1_0:F32 -> @+y1_1:F32 -> @a:Array<F32> -> @rv:Pair(Array<F32>, F32) -> GR

def gr_21 source · line 81 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @+x1_1:F32 -> @+x1_2:F32 -> @+x1_3:F32 -> @+x2_0:F32 -> @+x2_1:F32 -> @+x2_2:F32 -> @+x2_3:F32 -> @+x3_0:F32 -> @+x3_1:F32 -> @+x3_2:F32 -> @+x3_3:F32 -> @+y0_0:F32 -> @+y0_1:F32 -> @+y0_2:F32 -> @+y0_3:F32 -> @+y1_0:F32 -> @a:Array<F32> -> @rv:Pair(Array<F32>, F32) -> GR

def gr_20 source · line 85 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @+x1_1:F32 -> @+x1_2:F32 -> @+x1_3:F32 -> @+x2_0:F32 -> @+x2_1:F32 -> @+x2_2:F32 -> @+x2_3:F32 -> @+x3_0:F32 -> @+x3_1:F32 -> @+x3_2:F32 -> @+x3_3:F32 -> @+y0_0:F32 -> @+y0_1:F32 -> @+y0_2:F32 -> @+y0_3:F32 -> @a:Array<F32> -> @rv:Pair(Array<F32>, F32) -> GR

def gr_19 source · line 89 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @+x1_1:F32 -> @+x1_2:F32 -> @+x1_3:F32 -> @+x2_0:F32 -> @+x2_1:F32 -> @+x2_2:F32 -> @+x2_3:F32 -> @+x3_0:F32 -> @+x3_1:F32 -> @+x3_2:F32 -> @+x3_3:F32 -> @+y0_0:F32 -> @+y0_1:F32 -> @+y0_2:F32 -> @a:Array<F32> -> @rv:Pair(Array<F32>, F32) -> GR

def gr_18 source · line 93 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @+x1_1:F32 -> @+x1_2:F32 -> @+x1_3:F32 -> @+x2_0:F32 -> @+x2_1:F32 -> @+x2_2:F32 -> @+x2_3:F32 -> @+x3_0:F32 -> @+x3_1:F32 -> @+x3_2:F32 -> @+x3_3:F32 -> @+y0_0:F32 -> @+y0_1:F32 -> @a:Array<F32> -> @rv:Pair(Array<F32>, F32) -> GR

def gr_17 source · line 97 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @+x1_1:F32 -> @+x1_2:F32 -> @+x1_3:F32 -> @+x2_0:F32 -> @+x2_1:F32 -> @+x2_2:F32 -> @+x2_3:F32 -> @+x3_0:F32 -> @+x3_1:F32 -> @+x3_2:F32 -> @+x3_3:F32 -> @+y0_0:F32 -> @a:Array<F32> -> @rv:Pair(Array<F32>, F32) -> GR

def gr_16 source · line 101 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @+x1_1:F32 -> @+x1_2:F32 -> @+x1_3:F32 -> @+x2_0:F32 -> @+x2_1:F32 -> @+x2_2:F32 -> @+x2_3:F32 -> @+x3_0:F32 -> @+x3_1:F32 -> @+x3_2:F32 -> @+x3_3:F32 -> @a:Array<F32> -> @rv:Pair(Array<F32>, F32) -> GR

def gr_15 source · line 105 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @+x1_1:F32 -> @+x1_2:F32 -> @+x1_3:F32 -> @+x2_0:F32 -> @+x2_1:F32 -> @+x2_2:F32 -> @+x2_3:F32 -> @+x3_0:F32 -> @+x3_1:F32 -> @+x3_2:F32 -> @rv:Pair(Array<F32>, F32) -> @b:Array<F32> -> GR

def gr_14 source · line 109 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @+x1_1:F32 -> @+x1_2:F32 -> @+x1_3:F32 -> @+x2_0:F32 -> @+x2_1:F32 -> @+x2_2:F32 -> @+x2_3:F32 -> @+x3_0:F32 -> @+x3_1:F32 -> @rv:Pair(Array<F32>, F32) -> @b:Array<F32> -> GR

def gr_13 source · line 113 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @+x1_1:F32 -> @+x1_2:F32 -> @+x1_3:F32 -> @+x2_0:F32 -> @+x2_1:F32 -> @+x2_2:F32 -> @+x2_3:F32 -> @+x3_0:F32 -> @rv:Pair(Array<F32>, F32) -> @b:Array<F32> -> GR

def gr_12 source · line 117 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @+x1_1:F32 -> @+x1_2:F32 -> @+x1_3:F32 -> @+x2_0:F32 -> @+x2_1:F32 -> @+x2_2:F32 -> @+x2_3:F32 -> @rv:Pair(Array<F32>, F32) -> @b:Array<F32> -> GR

def gr_11 source · line 121 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @+x1_1:F32 -> @+x1_2:F32 -> @+x1_3:F32 -> @+x2_0:F32 -> @+x2_1:F32 -> @+x2_2:F32 -> @rv:Pair(Array<F32>, F32) -> @b:Array<F32> -> GR

def gr_10 source · line 125 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @+x1_1:F32 -> @+x1_2:F32 -> @+x1_3:F32 -> @+x2_0:F32 -> @+x2_1:F32 -> @rv:Pair(Array<F32>, F32) -> @b:Array<F32> -> GR

def gr_9 source · line 129 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @+x1_1:F32 -> @+x1_2:F32 -> @+x1_3:F32 -> @+x2_0:F32 -> @rv:Pair(Array<F32>, F32) -> @b:Array<F32> -> GR

def gr_8 source · line 133 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @+x1_1:F32 -> @+x1_2:F32 -> @+x1_3:F32 -> @rv:Pair(Array<F32>, F32) -> @b:Array<F32> -> GR

def gr_7 source · line 137 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @+x1_1:F32 -> @+x1_2:F32 -> @rv:Pair(Array<F32>, F32) -> @b:Array<F32> -> GR

def gr_6 source · line 141 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @+x1_1:F32 -> @rv:Pair(Array<F32>, F32) -> @b:Array<F32> -> GR

def gr_5 source · line 145 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @+x1_0:F32 -> @rv:Pair(Array<F32>, F32) -> @b:Array<F32> -> GR

def gr_4 source · line 149 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @+x0_3:F32 -> @rv:Pair(Array<F32>, F32) -> @b:Array<F32> -> GR

def gr_3 source · line 153 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @+x0_2:F32 -> @rv:Pair(Array<F32>, F32) -> @b:Array<F32> -> GR

def gr_2 source · line 157 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @+x0_1:F32 -> @rv:Pair(Array<F32>, F32) -> @b:Array<F32> -> GR

def gr_1 source · line 161 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+x0_0:F32 -> @rv:Pair(Array<F32>, F32) -> @b:Array<F32> -> GR

def gr_0 source · line 165 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @rv:Pair(Array<F32>, F32) -> @b:Array<F32> -> GR

def turn source · line 170 · raw

@+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @a:Array<F32> -> @b:Array<F32> -> GR

the turn whose A values start at ia and B values at ib

def wr source · line 188 · raw

@ok:Bool -> @+ac:Bool -> @+idx:U32 -> @+x:F32 -> @c:Array<F32> -> Array<F32>

writes cell (i, j) of C when it is inside n x m

def e_of source · line 251 · raw

@+ac:Bool -> @+n:Nat -> @+m:Nat -> @+k:Nat -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> E

the product's sizes and strides

def tiles source · line 254 · raw

@+n:Nat -> @+m:Nat -> Nat

def mm_fin source · line 267 · raw

@-n:Nat -> @-k:Nat -> @-m:Nat -> @g:ABC -> 0x0f6479f09ada7ae614e64e31e8f5a730/main.MMul<n, k, m>

def mm_nt_fin source · line 271 · raw

@-n:Nat -> @-k:Nat -> @-m:Nat -> @g:ABC -> 0x0f6479f09ada7ae614e64e31e8f5a730/main.MMulNT<n, k, m>

def mm_tn_fin source · line 275 · raw

@-n:Nat -> @-k:Nat -> @-m:Nat -> @g:ABC -> 0x0f6479f09ada7ae614e64e31e8f5a730/main.MMulTN<n, k, m>

def depth2 source · line 342 · raw

@big:Bool -> @+n:Nat -> Nat

def depth source · line 348 · raw

@+n:Nat -> Nat

leaves for n cells: 2^14 when there are that many, else the fewest powers of two that cover them

def share source · line 352 · raw

@+t:U32 -> @+n:U32 -> @+l:U32 -> Nat

how many of the cells t, t + l, t + 2l, .. lie below n

def none source · line 356 · raw

@u:Unit -> Array<F32>

an array of one cell, for an unused input

def abc_g source · line 537 · raw

@a:Array<F32> -> @b:Array<F32> -> @r:ABC -> 0x0f6479f09ada7ae614e64e31e8f5a730/main.G

Unsafe

unsafe mm source · line 180 · raw

@kg:Nat -> @+ia:U32 -> @+ib:U32 -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+rem:U32 -> @+rot:Nat -> @+s0_0_0:F32 -> @+s1_0_0:F32 -> @+s2_0_0:F32 -> @+s3_0_0:F32 -> @+s0_0_1:F32 -> @+s1_0_1:F32 -> @+s2_0_1:F32 -> @+s3_0_1:F32 -> @+s0_0_2:F32 -> @+s1_0_2:F32 -> @+s2_0_2:F32 -> @+s3_0_2:F32 -> @+s0_0_3:F32 -> @+s1_0_3:F32 -> @+s2_0_3:F32 -> @+s3_0_3:F32 -> @+s0_1_0:F32 -> @+s1_1_0:F32 -> @+s2_1_0:F32 -> @+s3_1_0:F32 -> @+s0_1_1:F32 -> @+s1_1_1:F32 -> @+s2_1_1:F32 -> @+s3_1_1:F32 -> @+s0_1_2:F32 -> @+s1_1_2:F32 -> @+s2_1_2:F32 -> @+s3_1_2:F32 -> @+s0_1_3:F32 -> @+s1_1_3:F32 -> @+s2_1_3:F32 -> @+s3_1_3:F32 -> @+s0_2_0:F32 -> @+s1_2_0:F32 -> @+s2_2_0:F32 -> @+s3_2_0:F32 -> @+s0_2_1:F32 -> @+s1_2_1:F32 -> @+s2_2_1:F32 -> @+s3_2_1:F32 -> @+s0_2_2:F32 -> @+s1_2_2:F32 -> @+s2_2_2:F32 -> @+s3_2_2:F32 -> @+s0_2_3:F32 -> @+s1_2_3:F32 -> @+s2_2_3:F32 -> @+s3_2_3:F32 -> @+s0_3_0:F32 -> @+s1_3_0:F32 -> @+s2_3_0:F32 -> @+s3_3_0:F32 -> @+s0_3_1:F32 -> @+s1_3_1:F32 -> @+s2_3_1:F32 -> @+s3_3_1:F32 -> @+s0_3_2:F32 -> @+s1_3_2:F32 -> @+s2_3_2:F32 -> @+s3_3_2:F32 -> @+s0_3_3:F32 -> @+s1_3_3:F32 -> @+s2_3_3:F32 -> @+s3_3_3:F32 -> @g:GR -> T

kg more full turns; g holds the current turn's values. The last call (kg = 0) adds the turn that holds the steps past the last full turn (rem = k mod 4 of them), counting only those, and combines the sums.

unsafe put source · line 195 · raw

@+ac:Bool -> @+n:U32 -> @+m:U32 -> @+i0:U32 -> @+j0:U32 -> @c:Array<F32> -> @t:T -> Array<F32>

the tile at rows i0.., columns j0.. of C, from the loop's result; A and B are dropped (the caller holds them)

unsafe tile source · line 201 · raw

@+e:E -> @+i0:U32 -> @+j0:U32 -> @+a:Array<F32> -> @+b:Array<F32> -> @c:Array<F32> -> Array<F32>

unsafe leaf_if source · line 208 · raw

@ok:Bool -> @+e:E -> @+t:U32 -> @+tcols:U32 -> @+a:Array<F32> -> @+b:Array<F32> -> @c:Array<F32> -> Array<F32>

leaf t computes tile t (row-major over the tiles); leaves past the last tile write nothing

unsafe leaf source · line 214 · raw

@+e:E -> @+t:U32 -> @+a:Array<F32> -> @+b:Array<F32> -> @c:Array<F32> -> Array<F32>

unsafe tree source · line 220 · raw

@+e:E -> @d:Nat -> @+t:U32 -> @+a:Array<F32> -> @+b:Array<F32> -> @+c:Array<F32> -> Array<F32>

unsafe tree_new source · line 231 · raw

@+e:E -> @d:Nat -> @+a:Array<F32> -> @+b:Array<F32> -> @+cd:Nat -> Array<F32>

C made inside the bang: the root of the ! call allocates it on the device. Made on the host instead, a new C often reuses a block whose pages sit on the device, so zeroing it on the host pulls them back over PCIe and the bang moves them again (a 256 x 1536 product: 9.2 ms against 6.0, measured 2026-10-18). The leaves write every cell of C.

unsafe bang_new source · line 235 · raw

@+e:E -> @d:Nat -> @+a:Array<F32> -> @+b:Array<F32> -> @+cd:Nat -> Array<F32>

unsafe bang source · line 240 · raw

@+e:E -> @d:Nat -> @+a:Array<F32> -> @+b:Array<F32> -> @c:Array<F32> -> Array<F32>

one bang over the tiles; A and B are shared with every leaf and come back unchanged

unsafe run_e source · line 247 · raw

@+e:E -> @+tiles:U32 -> @+a:Array<F32> -> @+b:Array<F32> -> @c:Array<F32> -> ABC

unsafe gemm_new source · line 259 · raw

@+n:Nat -> @+m:Nat -> @+k:Nat -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @+a:Array<F32> -> @+b:Array<F32> -> ABC

C (n x m) = A · B with k steps into a new C made on the device

unsafe gemm source · line 264 · raw

@+ac:Bool -> @+n:Nat -> @+m:Nat -> @+k:Nat -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @a:Array<F32> -> @b:Array<F32> -> @c:Array<F32> -> ABC

C (n x m) = A · B with k steps, or C + A · B when ac, C[i][j] = sum_p A[i*arow + p*sa] * B[p*sb + j*bcol]

unsafe matmul source · line 281 · raw

@+n:Nat -> @+k:Nat -> @+m:Nat -> @par:Nat -> @a:0x0f6479f09ada7ae614e64e31e8f5a730/main.Mat<n, k> -> @b:0x0f6479f09ada7ae614e64e31e8f5a730/main.Mat<k, m> -> 0x0f6479f09ada7ae614e64e31e8f5a730/main.MMul<n, k, m>

C = A · B (n x k) · (k x m), tensor-array's TA.Mat.matmul bits

unsafe matmul_acc source · line 288 · raw

@+n:Nat -> @+k:Nat -> @+m:Nat -> @par:Nat -> @a:0x0f6479f09ada7ae614e64e31e8f5a730/main.Mat<n, k> -> @b:0x0f6479f09ada7ae614e64e31e8f5a730/main.Mat<k, m> -> @c:0x0f6479f09ada7ae614e64e31e8f5a730/main.Mat<n, m> -> 0x0f6479f09ada7ae614e64e31e8f5a730/main.MMul<n, k, m>

C + A · B, into C (n x m)

unsafe matmul_nt source · line 295 · raw

@+n:Nat -> @+k:Nat -> @+m:Nat -> @par:Nat -> @a:0x0f6479f09ada7ae614e64e31e8f5a730/main.Mat<n, k> -> @b:0x0f6479f09ada7ae614e64e31e8f5a730/main.Mat<m, k> -> 0x0f6479f09ada7ae614e64e31e8f5a730/main.MMulNT<n, k, m>

C = A · Bᵀ (n x k) · (m x k)ᵀ: for weights stored with one row per output

unsafe matmul_nt_acc source · line 302 · raw

@+n:Nat -> @+k:Nat -> @+m:Nat -> @par:Nat -> @a:0x0f6479f09ada7ae614e64e31e8f5a730/main.Mat<n, k> -> @b:0x0f6479f09ada7ae614e64e31e8f5a730/main.Mat<m, k> -> @c:0x0f6479f09ada7ae614e64e31e8f5a730/main.Mat<n, m> -> 0x0f6479f09ada7ae614e64e31e8f5a730/main.MMulNT<n, k, m>

C + A · Bᵀ, into C (n x m)

unsafe matmul_tn source · line 309 · raw

@+n:Nat -> @+k:Nat -> @+m:Nat -> @par:Nat -> @a:0x0f6479f09ada7ae614e64e31e8f5a730/main.Mat<k, n> -> @b:0x0f6479f09ada7ae614e64e31e8f5a730/main.Mat<k, m> -> 0x0f6479f09ada7ae614e64e31e8f5a730/main.MMulTN<n, k, m>

C = Aᵀ · B (k x n)ᵀ · (k x m): weight gradient, Xᵀ · dY

unsafe matmul_tn_acc source · line 316 · raw

@+n:Nat -> @+k:Nat -> @+m:Nat -> @par:Nat -> @a:0x0f6479f09ada7ae614e64e31e8f5a730/main.Mat<k, n> -> @b:0x0f6479f09ada7ae614e64e31e8f5a730/main.Mat<k, m> -> @c:0x0f6479f09ada7ae614e64e31e8f5a730/main.Mat<n, m> -> 0x0f6479f09ada7ae614e64e31e8f5a730/main.MMulTN<n, k, m>

C + Aᵀ · B, into C (n x m): dW += Xᵀ · dY

unsafe join2 source · line 381 · raw

@x:O2 -> @y:O2 -> O2

unsafe join3 source · line 386 · raw

@x:O3 -> @y:O3 -> O3

unsafe join4 source · line 391 · raw

@x:O4 -> @y:O4 -> O4

unsafe tree1 source · line 396 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> Array<F32>) -> @+d:Nat -> @+t:U32 -> @+l:U32 -> @+e:E -> @+x1:Array<F32> -> @+x2:Array<F32> -> @+x3:Array<F32> -> @+x4:Array<F32> -> @+oa:Array<F32> -> Array<F32>

unsafe root1 source · line 404 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> Array<F32>) -> @+d:Nat -> @+e:E -> @+x1:Array<F32> -> @+x2:Array<F32> -> @+x3:Array<F32> -> @+x4:Array<F32> -> @oa:Array<F32> -> Array<F32>

unsafe root1_new source · line 408 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> Array<F32>) -> @+d:Nat -> @+e:E -> @+x1:Array<F32> -> @+x2:Array<F32> -> @+x3:Array<F32> -> @+x4:Array<F32> -> @+ca:Nat -> Array<F32>

unsafe go1 source · line 412 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> Array<F32>) -> @+d:Nat -> @+e:E -> @+x1:Array<F32> -> @+x2:Array<F32> -> @+x3:Array<F32> -> @+x4:Array<F32> -> @oa:Array<F32> -> R1

unsafe go1_new source · line 416 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> Array<F32>) -> @+d:Nat -> @+e:E -> @+x1:Array<F32> -> @+x2:Array<F32> -> @+x3:Array<F32> -> @+x4:Array<F32> -> @+ca:Nat -> R1

unsafe run1 source · line 421 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> Array<F32>) -> @+d:Nat -> @+e:E -> @x1:Array<F32> -> @x2:Array<F32> -> @x3:Array<F32> -> @x4:Array<F32> -> @oa:Array<F32> -> R1

one bang over 2^d leaves with 1 output written in place

unsafe run1_new source · line 426 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> Array<F32>) -> @+d:Nat -> @+e:E -> @x1:Array<F32> -> @x2:Array<F32> -> @x3:Array<F32> -> @x4:Array<F32> -> @+ca:Nat -> R1

one bang over 2^d leaves with 1 new output of 2^c.. cells, made on the device

unsafe tree2 source · line 430 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:O2 -> O2) -> @+d:Nat -> @+t:U32 -> @+l:U32 -> @+e:E -> @+x1:Array<F32> -> @+x2:Array<F32> -> @+x3:Array<F32> -> @+x4:Array<F32> -> @+oa:Array<F32> -> @+ob:Array<F32> -> O2

unsafe root2 source · line 438 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:O2 -> O2) -> @+d:Nat -> @+e:E -> @+x1:Array<F32> -> @+x2:Array<F32> -> @+x3:Array<F32> -> @+x4:Array<F32> -> @oa:Array<F32> -> @ob:Array<F32> -> O2

unsafe root2_new source · line 442 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:O2 -> O2) -> @+d:Nat -> @+e:E -> @+x1:Array<F32> -> @+x2:Array<F32> -> @+x3:Array<F32> -> @+x4:Array<F32> -> @+ca:Nat -> @+cb:Nat -> O2

unsafe go2 source · line 446 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:O2 -> O2) -> @+d:Nat -> @+e:E -> @+x1:Array<F32> -> @+x2:Array<F32> -> @+x3:Array<F32> -> @+x4:Array<F32> -> @oa:Array<F32> -> @ob:Array<F32> -> R2

unsafe go2_new source · line 450 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:O2 -> O2) -> @+d:Nat -> @+e:E -> @+x1:Array<F32> -> @+x2:Array<F32> -> @+x3:Array<F32> -> @+x4:Array<F32> -> @+ca:Nat -> @+cb:Nat -> R2

unsafe run2 source · line 455 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:O2 -> O2) -> @+d:Nat -> @+e:E -> @x1:Array<F32> -> @x2:Array<F32> -> @x3:Array<F32> -> @x4:Array<F32> -> @oa:Array<F32> -> @ob:Array<F32> -> R2

one bang over 2^d leaves with 2 outputs written in place

unsafe run2_new source · line 460 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:O2 -> O2) -> @+d:Nat -> @+e:E -> @x1:Array<F32> -> @x2:Array<F32> -> @x3:Array<F32> -> @x4:Array<F32> -> @+ca:Nat -> @+cb:Nat -> R2

one bang over 2^d leaves with 2 new outputs of 2^c.. cells, made on the device

unsafe tree3 source · line 464 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:O3 -> O3) -> @+d:Nat -> @+t:U32 -> @+l:U32 -> @+e:E -> @+x1:Array<F32> -> @+x2:Array<F32> -> @+x3:Array<F32> -> @+x4:Array<F32> -> @+oa:Array<F32> -> @+ob:Array<F32> -> @+oc:Array<F32> -> O3

unsafe root3 source · line 472 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:O3 -> O3) -> @+d:Nat -> @+e:E -> @+x1:Array<F32> -> @+x2:Array<F32> -> @+x3:Array<F32> -> @+x4:Array<F32> -> @oa:Array<F32> -> @ob:Array<F32> -> @oc:Array<F32> -> O3

unsafe root3_new source · line 476 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:O3 -> O3) -> @+d:Nat -> @+e:E -> @+x1:Array<F32> -> @+x2:Array<F32> -> @+x3:Array<F32> -> @+x4:Array<F32> -> @+ca:Nat -> @+cb:Nat -> @+cc:Nat -> O3

unsafe go3 source · line 480 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:O3 -> O3) -> @+d:Nat -> @+e:E -> @+x1:Array<F32> -> @+x2:Array<F32> -> @+x3:Array<F32> -> @+x4:Array<F32> -> @oa:Array<F32> -> @ob:Array<F32> -> @oc:Array<F32> -> R3

unsafe go3_new source · line 484 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:O3 -> O3) -> @+d:Nat -> @+e:E -> @+x1:Array<F32> -> @+x2:Array<F32> -> @+x3:Array<F32> -> @+x4:Array<F32> -> @+ca:Nat -> @+cb:Nat -> @+cc:Nat -> R3

unsafe run3 source · line 489 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:O3 -> O3) -> @+d:Nat -> @+e:E -> @x1:Array<F32> -> @x2:Array<F32> -> @x3:Array<F32> -> @x4:Array<F32> -> @oa:Array<F32> -> @ob:Array<F32> -> @oc:Array<F32> -> R3

one bang over 2^d leaves with 3 outputs written in place

unsafe run3_new source · line 494 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:O3 -> O3) -> @+d:Nat -> @+e:E -> @x1:Array<F32> -> @x2:Array<F32> -> @x3:Array<F32> -> @x4:Array<F32> -> @+ca:Nat -> @+cb:Nat -> @+cc:Nat -> R3

one bang over 2^d leaves with 3 new outputs of 2^c.. cells, made on the device

unsafe tree4 source · line 498 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:O4 -> O4) -> @+d:Nat -> @+t:U32 -> @+l:U32 -> @+e:E -> @+x1:Array<F32> -> @+x2:Array<F32> -> @+x3:Array<F32> -> @+x4:Array<F32> -> @+oa:Array<F32> -> @+ob:Array<F32> -> @+oc:Array<F32> -> @+od:Array<F32> -> O4

unsafe root4 source · line 506 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:O4 -> O4) -> @+d:Nat -> @+e:E -> @+x1:Array<F32> -> @+x2:Array<F32> -> @+x3:Array<F32> -> @+x4:Array<F32> -> @oa:Array<F32> -> @ob:Array<F32> -> @oc:Array<F32> -> @od:Array<F32> -> O4

unsafe root4_new source · line 510 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:O4 -> O4) -> @+d:Nat -> @+e:E -> @+x1:Array<F32> -> @+x2:Array<F32> -> @+x3:Array<F32> -> @+x4:Array<F32> -> @+ca:Nat -> @+cb:Nat -> @+cc:Nat -> @+cd:Nat -> O4

unsafe go4 source · line 514 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:O4 -> O4) -> @+d:Nat -> @+e:E -> @+x1:Array<F32> -> @+x2:Array<F32> -> @+x3:Array<F32> -> @+x4:Array<F32> -> @oa:Array<F32> -> @ob:Array<F32> -> @oc:Array<F32> -> @od:Array<F32> -> R4

unsafe go4_new source · line 518 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:O4 -> O4) -> @+d:Nat -> @+e:E -> @+x1:Array<F32> -> @+x2:Array<F32> -> @+x3:Array<F32> -> @+x4:Array<F32> -> @+ca:Nat -> @+cb:Nat -> @+cc:Nat -> @+cd:Nat -> R4

unsafe run4 source · line 523 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:O4 -> O4) -> @+d:Nat -> @+e:E -> @x1:Array<F32> -> @x2:Array<F32> -> @x3:Array<F32> -> @x4:Array<F32> -> @oa:Array<F32> -> @ob:Array<F32> -> @oc:Array<F32> -> @od:Array<F32> -> R4

one bang over 2^d leaves with 4 outputs written in place

unsafe run4_new source · line 528 · raw

@-E:Data -> @-f:(@+t:U32 -> @+l:U32 -> @+e:E -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:Array<F32> -> @_:O4 -> O4) -> @+d:Nat -> @+e:E -> @x1:Array<F32> -> @x2:Array<F32> -> @x3:Array<F32> -> @x4:Array<F32> -> @+ca:Nat -> @+cb:Nat -> @+cc:Nat -> @+cd:Nat -> R4

one bang over 2^d leaves with 4 new outputs of 2^c.. cells, made on the device

unsafe mp_s3 source · line 542 · raw

@+ac:Bool -> @+n:Nat -> @+m:Nat -> @+w:Nat -> @+w32:U32 -> @+m32:U32 -> @a:Array<F32> -> @as:Array<F32> -> @c:Array<F32> -> @sb:0x0f6479f09ada7ae614e64e31e8f5a730/main.SL -> 0x0f6479f09ada7ae614e64e31e8f5a730/main.G

unsafe mp_s2 source · line 548 · raw

@+ac:Bool -> @+n:Nat -> @+m:Nat -> @+w:Nat -> @+w32:U32 -> @+m32:U32 -> @+o:U32 -> @c:Array<F32> -> @b:Array<F32> -> @sa:0x0f6479f09ada7ae614e64e31e8f5a730/main.SL -> 0x0f6479f09ada7ae614e64e31e8f5a730/main.G

unsafe mp_step source · line 553 · raw

@+ac:Bool -> @+n:Nat -> @+m:Nat -> @+k32:U32 -> @+bi:U32 -> @a:Array<F32> -> @b:Array<F32> -> @c:Array<F32> -> 0x0f6479f09ada7ae614e64e31e8f5a730/main.G

unsafe mp_go source · line 557 · raw

@nb:Nat -> @+bi:U32 -> @+n:Nat -> @+m:Nat -> @+k32:U32 -> @g:0x0f6479f09ada7ae614e64e31e8f5a730/main.G -> 0x0f6479f09ada7ae614e64e31e8f5a730/main.G

unsafe mm_precise2 source · line 563 · raw

@long:Bool -> @+n:Nat -> @+k:Nat -> @+m:Nat -> @+par:Nat -> @a:0x0f6479f09ada7ae614e64e31e8f5a730/main.Mat<n, k> -> @b:0x0f6479f09ada7ae614e64e31e8f5a730/main.Mat<k, m> -> 0x0f6479f09ada7ae614e64e31e8f5a730/main.MMul<n, k, m>

unsafe matmul_precise source · line 570 · raw

@+n:Nat -> @+k:Nat -> @+m:Nat -> @+par:Nat -> @a:0x0f6479f09ada7ae614e64e31e8f5a730/main.Mat<n, k> -> @b:0x0f6479f09ada7ae614e64e31e8f5a730/main.Mat<k, m> -> 0x0f6479f09ada7ae614e64e31e8f5a730/main.MMul<n, k, m>

C = A · B with k summed in blocks of 1024: TA.Mat.matmul_precise's bits (opt-in)