Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/seed/ng/front/kernels/matmul.om # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / seed / ng / front / kernels / matmul.om` 63 lines ยท 1414 bytes Raw Blame History 1 note matmul: C = A B for 300 x 300 ulong matrices in global arrays, A[i][j] = (i + 2j) rem 13, 2 note B[i][j] = (3i + j) rem 11; prints the sum of all elements of C and its trace. 3 note OMC-EFF-2: main writes the nanoseconds between its two monons readings (the computation, without 4 note start-up and output) as one decimal line on stderr; stdout is unchanged. 5 global out uchar 32 6 global ma ulong 90000 7 global mb ulong 90000 8 global mc ulong 90000 9 fn putnum fd int v ulong to void 10 put out 31 10 11 p = ulong 31 12 x = v 13 while gt x 9 14 p = sub p 1 15 put out p uchar add rem x 10 48 16 x = div x 10 17 end 18 p = sub p 1 19 put out p uchar add x 48 20 w = write fd out p sub 32 p 21 end 22 fn fill to void 23 for i ulong 300 24 for j ulong 300 25 put ma add mul i 300 j rem add i mul j 2 13 26 put mb add mul i 300 j rem add mul i 3 j 11 27 end 28 end 29 end 30 note mm: the row offset r and the column walk q are kept in names; the direct form 31 note add s mul get ma add mul i 300 k get mb add mul k 300 j needs more than the 16 registers (error 12) 32 fn mm to void 33 for i ulong 300 34 r = mul i 300 35 for j ulong 300 36 s = ulong 0 37 q = j 38 for k ulong 300 39 s = add s mul get ma add r k get mb q 40 q = add q 300 41 end 42 put mc add r j s 43 end 44 end 45 end 46 fn main to int 47 t0 = monons 48 fill 49 mm 50 tot = ulong 0 51 tr = ulong 0 52 for i ulong 300 53 for j ulong 300 54 tot = add tot get mc add mul i 300 j 55 end 56 tr = add tr get mc add mul i 301 0 57 end 58 t1 = monons 59 putnum 2 ulong sub t1 t0 60 putnum 1 tot 61 putnum 1 tr 62 ret 0 63 end