def t8_dot

bend-ml-tensor-array@0.1.19.0 · main.bend:938

import bend-ml-tensor-array@0.1.19.0/main.bend as BendMlTensorArray
import Base

938# the dot of two lines of cells: tk cells from ia (in a) and ib (in b); ra, rb hold the arrays and the cells at ia, ib,
939# already read. Product q of a cell goes to sum q mod 4, the first four before the last four, as dotr adds them.
940def t8_dot(tk: Nat, +ia: U32, +ib: U32, s0: F32, s1: F32, s2: F32, s3: F32, ra: Array<T8> & T8, rb: Array<T8> & T8) -> TD:
941  match tk ra rb:
942    case 0n Tuple{a, x} Tuple{b, y}:
943      TD{a, b, s0, s1, s2, s3}
944    case 1n+p Tuple{a, T8{x0, x1, x2, x3, x4, x5, x6, x7}} Tuple{b, T8{y0, y1, y2, y3, y4, y5, y6, y7}}:
945      t8_dot(p, (ia + 1 : U32), (ib + 1 : U32), ((s0 + (x0 * y0 : F32) : F32) + (x4 * y4 : F32) : F32), ((s1 + (x1 * y1 : F32) : F32) + (x5 * y5 : F32) : F32), ((s2 + (x2 * y2 : F32) : F32) + (x6 * y6 : F32) : F32), ((s3 + (x3 * y3 : F32) : F32) + (x7 * y7 : F32) : F32), Array.get(T8, a, (ia + 1 : U32)), Array.get(T8, b, (ib + 1 : U32)))

Uses (12)

Used by (1)