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/gpu/nvidia/checks/gemm_num.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 / gpu / nvidia / checks / gemm_num.om` 93 lines ยท 2350 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note gpu/nvidia/checks/gemm_num.om: the Omega port of CUDApp tests/gemm_ex_om_num_test.c. Composed after 3 note gpu/nvidia/om/gemmex/num.om, gpu/nvidia/om/gemmex/probe.om and gpu/nvidia/checks/lib.om; run with 4 note gpu/nvidia/checks/gemm_num.tsv, whose rows the C number formats of the old test wrote over a sweep. 5 note Each row is one sweep and holds the FNV-1a-64 digest of every answer the C gave in it, so every answer is 6 note compared without storing each one. The check regenerates the inputs and digests gx_probe's answers: 7 note r OP X0 XEND STEP N DIGEST ops 0 to 4 at x = X0, X0+STEP, ... below XEND (N of them) 8 note x N DIGEST op 5 over the first N words of the old test's xorshift stream (odd steps: an f32 9 note widened to f64, its low 12 bits flipped on every other one of them) 10 note b T N DIGEST op 6 for kind T over every 16-bit u (kind 0 reads u << 16 | u), N = 65536 11 text t_name "GEMM_NUM" 12 fn cname to void 13 for i ulong len t_name bound 64 14 ckoc ulong get t_name i 15 end 16 end 17 fn gxfnv h ulong v ulong to ulong 18 ret mul xor h v `1099511628211` 19 end 20 fn gxsweep op ulong x0 ulong xend ulong step ulong n ulong to ulong 21 h = ulong `14695981039346656037` 22 for j ulong n bound `4294967296` 23 h = gxfnv h gx_probe op add x0 mul j step 24 end 25 ret h 26 end 27 fn gxstream n ulong to ulong 28 s = ulong `88172645463325252` 29 h = ulong `14695981039346656037` 30 for i ulong n bound `4294967296` 31 s = xor s shl s 13 32 s = xor s shr s 7 33 s = xor s shl s 17 34 d = s 35 if ne and i 1 0 36 d = bitcast ulong f64 bitcast f32 uint shr s 32 37 if eq and i 2 0 38 d = xor d and s 4095 39 end 40 end 41 h = gxfnv h gx_probe 5 d 42 end 43 ret h 44 end 45 fn gxbad t ulong to ulong 46 h = ulong `14695981039346656037` 47 for u ulong 65536 48 v = u 49 if eq t 0 50 v = or shl u 16 u 51 end 52 h = gxfnv h gx_probe 6 or shl t 32 v 53 end 54 ret h 55 end 56 fn crow to bool 57 k = ckch 0 0 58 if eq k 114 59 if ne ckcnt 7 60 ckbad 61 end 62 op = cknum 1 63 x0 = cknum 2 64 xend = cknum 3 65 step = cknum 4 66 if or or gt op 4 eq step 0 or ge x0 xend gt xend `4294967296` 67 ckbad 68 end 69 n = div add sub xend x0 sub step 1 step 70 if ne n cknum 5 71 ret false 72 end 73 ret eq gxsweep op x0 xend step n cknum 6 74 end 75 if eq k 120 76 if ne ckcnt 3 77 ckbad 78 end 79 ret eq gxstream cknum 1 cknum 2 80 end 81 if eq k 98 82 if ne ckcnt 4 83 ckbad 84 end 85 t = cknum 1 86 if or gt t 4 ne cknum 2 65536 87 ckbad 88 end 89 ret eq gxbad t cknum 3 90 end 91 ckbad 92 ret false 93 end