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/bench/omc_efficiency/kernels/om2/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 / bench / omc_efficiency / kernels / om2 / matmul.om` 64 lines ยท 1423 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 om2 6 global obuf uchar 32 7 global ma ulong 90000 8 global mb ulong 90000 9 global mc ulong 90000 10 fn putnum fd int v ulong to void 11 put obuf 31 10 12 p = ulong 31 13 x = v 14 while gt x 9 15 p = sub p 1 16 put obuf p uchar add rem x 10 48 17 x = div x 10 18 end 19 p = sub p 1 20 put obuf p uchar add x 48 21 w = write fd obuf p sub 32 p 22 end 23 fn fill to void 24 for i ulong 300 25 for j ulong 300 26 put ma add mul i 300 j rem add i mul j 2 13 27 put mb add mul i 300 j rem add mul i 3 j 11 28 end 29 end 30 end 31 note mm: the row offset r and the column walk q are kept in names; the direct form 32 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) 33 fn mm to void 34 for i ulong 300 35 r = mul i 300 36 for j ulong 300 37 s = ulong 0 38 q = j 39 for k ulong 300 40 s = add s mul get ma add r k get mb q 41 q = add q 300 42 end 43 put mc add r j s 44 end 45 end 46 end 47 fn main to int 48 t0 = monons 49 fill 50 mm 51 tot = ulong 0 52 tr = ulong 0 53 for i ulong 300 54 for j ulong 300 55 tot = add tot get mc add mul i 300 j 56 end 57 tr = add tr get mc add mul i 301 0 58 end 59 t1 = monons 60 putnum 2 ulong sub t1 t0 61 putnum 1 tot 62 putnum 1 tr 63 ret 0 64 end