~/bend-docscommunity

main.bend relies on unsafe/foreign

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

bend-ml-tensor-fork: bend-ml-tensor-array's products, with the parallel blocks sharing their operands; and par1..par4, any kernel over blocks of a range sharing up to four arrays.

import bend-ml-tensor-array@0.1.20.0/main.bend as TA import bend-ml-tensor-fork@0.1.7.1/main.bend as TF TF.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. A product that splits (tensor-array's split_depth, two or more rows) packs A and B once into cells of 8, as the sequential path does (in blocks of lines when an operand holds 16384 cells or more), and every node of the fork tree shares the two packed operands and C through Base's Array.fork: two handles to one block, no copy. Each leaf runs tensor-array's cells (t8_rows, t8_cols) straight into its own rows (or columns) of C, as copies here whose inner loop reads with Base's @unsafe Array.get_unchecked (bendlang/bend#1880, Bend 2.0.40), the indices inside the operands by construction (u8_dot). tensor-array's parallel path instead clones an operand at every node and hands each block's cells back as a list that is then written into C. A product that does not split runs the same cells in one block, and a product with one row runs tensor-array's sequential code. The bits are those of tensor-array at depth 0, at every depth and thread count (tests/bits.bend).

Not proved, and marked so: Array.fork and Array.join are @unsafe in Base (two handles to one array break the single owner that the proofs rely on), and so is Array.get_unchecked (an index the caller promises is below the capacity), so the defs below that call them are @unsafe, and bend main.bend names every def that relies on them. Nothing checks that a leaf never writes A or B, or that two leaves' blocks of C are disjoint; the blocks are the halves of the fork tree, as in tensor-array's own split. tests/bits.bend checks both by sampling. All of it is Bend: no foreign code.

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

Types

type B2 source · line 34 · raw

@-A:Type -> @-B:Type -> Type

type B3 source · line 37 · raw

@-A:Type -> @-B:Type -> @-C:Type -> Type

type B4 source · line 40 · raw

@-A:Type -> @-B:Type -> @-C:Type -> @-D:Type -> Type

type PE source · line 130 · raw

Data

type SE source · line 381 · raw

Data

type CL source · line 441 · raw

Type

Definitions

def depth_go source · line 116 · raw

@f:Nat -> @ok:Bool -> @+n:U32 -> @+p:U32 -> @d:Nat -> Nat

the smallest d with 2^d >= n (TA.cap_depth's answer) by doubling a U32: log2(n) steps, where cap_depth compares Nats (a share of every product's time at 512 x 1536)

def depth source · line 125 · raw

@+n:Nat -> Nat

def pk_b2 source · line 133 · raw

@r:0x5c5507d77be847e1e454ec33ab54e087/main.PK -> B2<F32, 0x5c5507d77be847e1e454ec33ab54e087/main.T8>

def pk_leaf source · line 139 · raw

@+e:PE -> @+i0:U32 -> @+cnt:Nat -> @r:B2<F32, 0x5c5507d77be847e1e454ec33ab54e087/main.T8> -> B2<F32, 0x5c5507d77be847e1e454ec33ab54e087/main.T8>

lines i0 .. i0+cnt-1 into their cells

def pk_of source · line 144 · raw

@r:B2<F32, 0x5c5507d77be847e1e454ec33ab54e087/main.T8> -> 0x5c5507d77be847e1e454ec33ab54e087/main.PK

def pk_d source · line 150 · raw

@big:Bool -> @d:Nat -> Nat

one block below 16384 cells (MNIST's 100 x 784 and 128 x 784 pack faster in one), else 2^d

def tg_c source · line 163 · raw

@g:0x5c5507d77be847e1e454ec33ab54e087/main.TG -> Array<F32>

def gemm_rows source · line 280 · raw

@+ac:Bool -> @d:Nat -> @+n:Nat -> @+m:Nat -> @+k:Nat -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @a:Array<F32> -> @b:Array<F32> -> @c:Array<F32> -> 0x5c5507d77be847e1e454ec33ab54e087/main.G

two or more rows: the shared tree when d > 0, the same cells in one block at d = 0

def gemm_any2 source · line 287 · raw

@+ac:Bool -> @one:Bool -> @d:Nat -> @+n:Nat -> @+m:Nat -> @+k:Nat -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @a:Array<F32> -> @b:Array<F32> -> @c:Array<F32> -> 0x5c5507d77be847e1e454ec33ab54e087/main.G

def gemm_any source · line 295 · raw

@+ac:Bool -> @d:Nat -> @+n:Nat -> @+m:Nat -> @+k:Nat -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @a:Array<F32> -> @b:Array<F32> -> @c:Array<F32> -> 0x5c5507d77be847e1e454ec33ab54e087/main.G

TA.gemm_any's arguments and result; one row runs the scalar loop at every depth, as in tensor-array 0.1.12.0

def matmul source · line 301 · raw

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

C = A · B (n x k) · (k x m)

def matmul_acc source · line 307 · raw

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

C + A · B, into C

def matmul_nt source · line 313 · raw

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

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

def matmul_nt_acc source · line 319 · raw

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

C + A · Bᵀ, into C

def matmul_tn source · line 325 · raw

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

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

def matmul_tn_acc source · line 331 · raw

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

C + Aᵀ · B, into C: dW += Xᵀ · dY

def sr3 source · line 385 · raw

@+mm1:Nat -> @+o:U32 -> @+label:Nat -> @+s:F32 -> @+nf:F32 -> @q:0x5c5507d77be847e1e454ec33ab54e087/main.AF -> 0x5c5507d77be847e1e454ec33ab54e087/main.L2

a row's loss term log(max(p, 1e-12)) and its gradient: cea_row3..cea_row0 without the running loss

def sr2 source · line 390 · raw

@+mm1:Nat -> @+o:U32 -> @+label:Nat -> @+nf:F32 -> @q:0x5c5507d77be847e1e454ec33ab54e087/main.AF -> 0x5c5507d77be847e1e454ec33ab54e087/main.L2

def sr1 source · line 395 · raw

@+mm1:Nat -> @+o:U32 -> @+label:Nat -> @+nf:F32 -> @q:0x5c5507d77be847e1e454ec33ab54e087/main.AF -> 0x5c5507d77be847e1e454ec33ab54e087/main.L2

def sr0 source · line 400 · raw

@+mm1:Nat -> @+o:U32 -> @+label:Nat -> @+nf:F32 -> @r:Pair(Array<F32>, F32) -> 0x5c5507d77be847e1e454ec33ab54e087/main.L2

def ce_put source · line 405 · raw

@+i:U32 -> @lab:Array<U32> -> @t:Array<F32> -> @q:0x5c5507d77be847e1e454ec33ab54e087/main.L2 -> B3<F32, U32, F32>

def ce_row source · line 410 · raw

@+mm1:Nat -> @+mu:U32 -> @+nf:F32 -> @+i:U32 -> @z:Array<F32> -> @t:Array<F32> -> @r:Pair(Array<U32>, U32) -> B3<F32, U32, F32>

def ce_step source · line 415 · raw

@+mm1:Nat -> @+mu:U32 -> @+nf:F32 -> @+i:U32 -> @g:B3<F32, U32, F32> -> B3<F32, U32, F32>

def ce_loop source · line 420 · raw

@k:Nat -> @+mm1:Nat -> @+mu:U32 -> @+nf:F32 -> @+i:U32 -> @g:B3<F32, U32, F32> -> B3<F32, U32, F32>

def ce_leaf source · line 428 · raw

@+e:SE -> @+i0:U32 -> @+cnt:Nat -> @g:B3<F32, U32, F32> -> B3<F32, U32, F32>

rows i0 .. i0+cnt-1: their gradients in the logits, their loss terms in t

def ce_sum source · line 434 · raw

@k:Nat -> @+i:U32 -> @+loss:F32 -> @r:Pair(Array<F32>, F32) -> F32

the loss over k terms, in row order from +0.0, as cea_rows adds them

def lab_fit source · line 445 · raw

@inside:Bool -> @+y:Nat -> @+c:Nat -> Nat

a label past the row gives p = 0 and no one-hot cell, as c does: kept as c so that it fits a U32

def lab_take source · line 453 · raw

@n:Nat -> @labels:List<&2, Nat> -> @+mm1:Nat -> @+c:Nat -> @+i:U32 -> @+k:Nat -> @a:Array<U32> -> CL

up to n labels into a, counted in k; the rest stays a list

def ce_fin2 source · line 463 · raw

@-n:Nat -> @-c:Nat -> @+nf:F32 -> @+mm1:Nat -> @+mu:U32 -> @+k:Nat -> @rest:List<&2, Nat> -> @g:B3<F32, U32, F32> -> 0x5c5507d77be847e1e454ec33ab54e087/main.MCE<n, c>

after the blocks: the loss from t, then any labels past the n rows, in order, then tensor-array's mean

def softmax_ce2 source · line 474 · raw

@seq:Bool -> @+n:Nat -> @+c:Nat -> @+d:Nat -> @z:0x5c5507d77be847e1e454ec33ab54e087/main.Mat<n, c> -> @labels:List<&2, Nat> -> 0x5c5507d77be847e1e454ec33ab54e087/main.MCE<n, c>

def softmax_ce source · line 483 · raw

@+n:Nat -> @+c:Nat -> @+par:Nat -> @z:0x5c5507d77be847e1e454ec33ab54e087/main.Mat<n, c> -> @labels:List<&2, Nat> -> 0x5c5507d77be847e1e454ec33ab54e087/main.MCE<n, c>

mean cross-entropy and its gradient, TA.Mat.softmax_ce's arguments and bits, with the rows in up to 2^par blocks (par = 0: tensor-array's own loop)

Unsafe

unsafe blocks1 source · line 44 · raw

@-E:Data -> @-A:Type -> @-f:(@+e:E -> @+i0:U32 -> @+cnt:Nat -> @_:Array<A> -> Array<A>) -> @+e:E -> @d:Nat -> @+i0:U32 -> @+cnt:Nat -> @pa:Pair(Array<A>, Array<A>) -> Array<A>

unsafe join2 source · line 53 · raw

@-A:Type -> @-B:Type -> @l:B2<A, B> -> @r:B2<A, B> -> B2<A, B>

unsafe blocks2 source · line 59 · raw

@-E:Data -> @-A:Type -> @-B:Type -> @-f:(@+e:E -> @+i0:U32 -> @+cnt:Nat -> @_:B2<A, B> -> B2<A, B>) -> @+e:E -> @d:Nat -> @+i0:U32 -> @+cnt:Nat -> @pa:Pair(Array<A>, Array<A>) -> @pb:Pair(Array<B>, Array<B>) -> B2<A, B>

unsafe join3 source · line 68 · raw

@-A:Type -> @-B:Type -> @-C:Type -> @l:B3<A, B, C> -> @r:B3<A, B, C> -> B3<A, B, C>

unsafe blocks3 source · line 74 · raw

@-E:Data -> @-A:Type -> @-B:Type -> @-C:Type -> @-f:(@+e:E -> @+i0:U32 -> @+cnt:Nat -> @_:B3<A, B, C> -> B3<A, B, C>) -> @+e:E -> @d:Nat -> @+i0:U32 -> @+cnt:Nat -> @pa:Pair(Array<A>, Array<A>) -> @pb:Pair(Array<B>, Array<B>) -> @pc:Pair(Array<C>, Array<C>) -> B3<A, B, C>

unsafe join4 source · line 83 · raw

@-A:Type -> @-B:Type -> @-C:Type -> @-D:Type -> @l:B4<A, B, C, D> -> @r:B4<A, B, C, D> -> B4<A, B, C, D>

unsafe blocks4 source · line 89 · raw

@-E:Data -> @-A:Type -> @-B:Type -> @-C:Type -> @-D:Type -> @-f:(@+e:E -> @+i0:U32 -> @+cnt:Nat -> @_:B4<A, B, C, D> -> B4<A, B, C, D>) -> @+e:E -> @d:Nat -> @+i0:U32 -> @+cnt:Nat -> @pa:Pair(Array<A>, Array<A>) -> @pb:Pair(Array<B>, Array<B>) -> @pc:Pair(Array<C>, Array<C>) -> @pd:Pair(Array<D>, Array<D>) -> B4<A, B, C, D>

unsafe par1 source · line 99 · raw

@-E:Data -> @-A:Type -> @-f:(@+e:E -> @+i0:U32 -> @+cnt:Nat -> @_:Array<A> -> Array<A>) -> @+e:E -> @d:Nat -> @+cnt:Nat -> @a:Array<A> -> Array<A>

f over 2^d blocks of 0 .. cnt-1, sharing the arrays

unsafe par2 source · line 103 · raw

@-E:Data -> @-A:Type -> @-B:Type -> @-f:(@+e:E -> @+i0:U32 -> @+cnt:Nat -> @_:B2<A, B> -> B2<A, B>) -> @+e:E -> @d:Nat -> @+cnt:Nat -> @a:Array<A> -> @b:Array<B> -> B2<A, B>

unsafe par3 source · line 107 · raw

@-E:Data -> @-A:Type -> @-B:Type -> @-C:Type -> @-f:(@+e:E -> @+i0:U32 -> @+cnt:Nat -> @_:B3<A, B, C> -> B3<A, B, C>) -> @+e:E -> @d:Nat -> @+cnt:Nat -> @a:Array<A> -> @b:Array<B> -> @c:Array<C> -> B3<A, B, C>

unsafe par4 source · line 111 · raw

@-E:Data -> @-A:Type -> @-B:Type -> @-C:Type -> @-D:Type -> @-f:(@+e:E -> @+i0:U32 -> @+cnt:Nat -> @_:B4<A, B, C, D> -> B4<A, B, C, D>) -> @+e:E -> @d:Nat -> @+cnt:Nat -> @a:Array<A> -> @b:Array<B> -> @c:Array<C> -> @x:Array<D> -> B4<A, B, C, D>

unsafe pk_par source · line 160 · raw

@d:Nat -> @+cnt:Nat -> @+tk:Nat -> @+k:Nat -> @+lstep:U32 -> @+st:U32 -> @a:Array<F32> -> 0x5c5507d77be847e1e454ec33ab54e087/main.PK

cnt lines of tk cells, in an array of 2^d' >= cnt * tk + 1 cells: one more than tensor-array's pk_pack gives when cnt * tk is a power of two (it then doubles), so that the cells' last read past a line stays inside it (u8_dot)

unsafe u8_dot source · line 182 · raw

@tk:Nat -> @+ia:U32 -> @+ib:U32 -> @s0:F32 -> @s1:F32 -> @s2:F32 -> @s3:F32 -> @ra:Pair(Array<0x5c5507d77be847e1e454ec33ab54e087/main.T8>, 0x5c5507d77be847e1e454ec33ab54e087/main.T8) -> @rb:Pair(Array<0x5c5507d77be847e1e454ec33ab54e087/main.T8>, 0x5c5507d77be847e1e454ec33ab54e087/main.T8) -> 0x5c5507d77be847e1e454ec33ab54e087/main.TD

TA.t8_dot: tk cells from ia (in a) and ib (in b); ra, rb hold the arrays and the cells at ia, ib, already read

unsafe u8_cell source · line 195 · raw

@+tk:Nat -> @+tku:U32 -> @+rot:Nat -> @+i:U32 -> @+j:U32 -> @a:Array<0x5c5507d77be847e1e454ec33ab54e087/main.T8> -> @b:Array<0x5c5507d77be847e1e454ec33ab54e087/main.T8> -> 0x5c5507d77be847e1e454ec33ab54e087/main.TR

TA.t8_cell: cell (i, j) of C. Its two first reads stay checked, though i * tk and j * tk are inside the operands: once per cell they cost nothing, and the masked index is what tells clang the loop's cells never wrap past 2^32, so it reads each cell with two vector loads; unchecked there, the loop's 16 loads stay scalar, and three products of 226.5 M multiply-adds ran 2.7 times the instructions (9.20 G against 3.45 G, NOTES.md, 2026-11-06)

unsafe u8_cols source · line 200 · raw

@+ac:Bool -> @mleft:Nat -> @+tk:Nat -> @+tku:U32 -> @+rot:Nat -> @+i:U32 -> @+j:U32 -> @+cidx:U32 -> @g:0x5c5507d77be847e1e454ec33ab54e087/main.TG -> 0x5c5507d77be847e1e454ec33ab54e087/main.TG

TA.t8_cols: cells j.. of row i, mleft of them, into C from cidx

unsafe u8_rows source · line 209 · raw

@+ac:Bool -> @nleft:Nat -> @+m:Nat -> @+tk:Nat -> @+tku:U32 -> @+rot:Nat -> @+i:U32 -> @+mu:U32 -> @g:0x5c5507d77be847e1e454ec33ab54e087/main.TG -> 0x5c5507d77be847e1e454ec33ab54e087/main.TG

TA.t8_rows: rows i.., nleft of them, every column

unsafe u8_seq source · line 218 · raw

@+ac:Bool -> @+n:Nat -> @+m:Nat -> @+tk:Nat -> @+tku:U32 -> @+rot:Nat -> @c:Array<F32> -> @p:0x5c5507d77be847e1e454ec33ab54e087/main.PKK -> 0x5c5507d77be847e1e454ec33ab54e087/main.G

TA.gemm_t8b's sequential path (d = 0) with these cells: A and B packed by pk_par in one block, C written in order

unsafe rblock source · line 225 · raw

@+ac:Bool -> @cnt:Nat -> @+m:Nat -> @+tk:Nat -> @+tku:U32 -> @+rot:Nat -> @+i0:U32 -> @+mu:U32 -> @a:Array<0x5c5507d77be847e1e454ec33ab54e087/main.T8> -> @b:Array<0x5c5507d77be847e1e454ec33ab54e087/main.T8> -> @c:Array<F32> -> Array<F32>

rows i0 .. i0+cnt-1 of C, every column

unsafe cbrows source · line 230 · raw

@+ac:Bool -> @n:Nat -> @+cnt:Nat -> @+tk:Nat -> @+tku:U32 -> @+rot:Nat -> @+i:U32 -> @+j0:U32 -> @+mu:U32 -> @g:0x5c5507d77be847e1e454ec33ab54e087/main.TG -> 0x5c5507d77be847e1e454ec33ab54e087/main.TG

columns j0 .. j0+cnt-1 of C, rows i.. (n more)

unsafe rpar source · line 239 · raw

@+ac:Bool -> @d:Nat -> @+cnt:Nat -> @+m:Nat -> @+tk:Nat -> @+tku:U32 -> @+rot:Nat -> @+i0:U32 -> @+mu:U32 -> @pa:Pair(Array<0x5c5507d77be847e1e454ec33ab54e087/main.T8>, Array<0x5c5507d77be847e1e454ec33ab54e087/main.T8>) -> @pb:Pair(Array<0x5c5507d77be847e1e454ec33ab54e087/main.T8>, Array<0x5c5507d77be847e1e454ec33ab54e087/main.T8>) -> @pc:Pair(Array<F32>, Array<F32>) -> Array<F32>

2^d blocks of rows of C, halved at each node; each pair holds two handles to one block

unsafe cpar source · line 249 · raw

@+ac:Bool -> @d:Nat -> @+cnt:Nat -> @+n:Nat -> @+tk:Nat -> @+tku:U32 -> @+rot:Nat -> @+j0:U32 -> @+mu:U32 -> @pa:Pair(Array<0x5c5507d77be847e1e454ec33ab54e087/main.T8>, Array<0x5c5507d77be847e1e454ec33ab54e087/main.T8>) -> @pb:Pair(Array<0x5c5507d77be847e1e454ec33ab54e087/main.T8>, Array<0x5c5507d77be847e1e454ec33ab54e087/main.T8>) -> @pc:Pair(Array<F32>, Array<F32>) -> Array<F32>

2^d blocks of columns of C

unsafe t8_tree source · line 259 · raw

@byrows:Bool -> @+ac:Bool -> @d:Nat -> @+n:Nat -> @+m:Nat -> @+tk:Nat -> @+tku:U32 -> @+rot:Nat -> @pa:Pair(Array<0x5c5507d77be847e1e454ec33ab54e087/main.T8>, Array<0x5c5507d77be847e1e454ec33ab54e087/main.T8>) -> @pb:Pair(Array<0x5c5507d77be847e1e454ec33ab54e087/main.T8>, Array<0x5c5507d77be847e1e454ec33ab54e087/main.T8>) -> @pc:Pair(Array<F32>, Array<F32>) -> Array<F32>

by rows when C has at least as many rows as columns, as tensor-array splits

unsafe t8_go source · line 268 · raw

@+ac:Bool -> @d:Nat -> @+n:Nat -> @+m:Nat -> @+tk:Nat -> @+tku:U32 -> @+rot:Nat -> @c:Array<F32> -> @p:0x5c5507d77be847e1e454ec33ab54e087/main.PKK -> 0x5c5507d77be847e1e454ec33ab54e087/main.G

the packed copies are dropped after the tree; A and B (unpacked) go back to the caller

unsafe gemm_fork source · line 276 · raw

@+ac:Bool -> @+d:Nat -> @+n:Nat -> @+m:Nat -> @+k:Nat -> @+arow:U32 -> @+sa:U32 -> @+sb:U32 -> @+bcol:U32 -> @a:Array<F32> -> @b:Array<F32> -> @c:Array<F32> -> 0x5c5507d77be847e1e454ec33ab54e087/main.G

C (n x m) = A · B (or C + A · B when ac), n >= 2, with 2^d blocks sharing A, B and C; in any layout of TA.gemm_any (arow, sa, sb, bcol); A and B come back intact

unsafe mp_s3 source · line 341 · raw

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

unsafe mp_s2 source · line 346 · raw

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

unsafe mp_step source · line 351 · raw

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

unsafe mp_go source · line 355 · raw

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

unsafe mm_precise2 source · line 361 · raw

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

unsafe matmul_precise source · line 368 · raw

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

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

unsafe ce_par3 source · line 469 · raw

@-n:Nat -> @-c:Nat -> @+nf:F32 -> @+mm1:Nat -> @+mu:U32 -> @+d:Nat -> @z:Array<F32> -> @lt:CL -> 0x5c5507d77be847e1e454ec33ab54e087/main.MCE<n, c>