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 / addmm.om

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