interplane.Get Omega
Read in your language

omega-bridge

Omega-first language interoperability: checked conversion backends and native language bindings

Brought by drakestapleton

branch main Branches Tags History

omega-bridge / pytorch / kernels / mm.om

20 lines · 510 bytes Raw Blame History
1note mm: o[M,N] = a[M,K] @ b[K,N] (aten.mm), row-major f32. Each dot product is summed in f64 and
2note rounded once to f32. The caller supplies const lines M K N MK KN MN before this text.
3fn mmdot a view f32 MK b view f32 KN i ulong j ulong to f64
4s = 0.0f64
5ia = mul i K
6rb = j
7for k ulong K
8s = add s mul f64 get a ia f64 get b rb
9ia = add ia 1
10rb = add rb N
11end
12ret s
13end
14fn mm a view f32 MK b view f32 KN o edit f32 MN to void
15for i ulong M
16for j ulong N
17put o add mul i N j f32 mmdot a b i j
18end
19end
20end