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/avv.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 / avv.om` 132 lines ยท 3433 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note gpu/nvidia/checks/avv.om: the shared part of the avv-* checks, the view calls of CUDApp tests/attn_views_cases.c 3 note (the fixture of tests/attn_views_diff.c) and sweeps around them, compared with the pending C bodies of 4 note src/omega_attn_views.h (CUDAPP_MIGRATION_PENDING_ATTN_VIEWS). Each view unit carries om2 and is a program's head 5 note alone, so each has its own check: the unit, lib.om, lib-om2.om, its avv-UNIT.om (text t_name, text t_au, fn 6 note cname, fn avcap, fn avop) and then this part. Rows: 7 note UNIT L n A B v X r h 8 note A and B are two arrays of L elements, each given as a b m k c p1 v1 p2 v2: element i is (a*i + b) mod m, or 9 note word i of X (16 hex digits each, - when unused) when m is 0 (A only); then c when k > 0 and i mod k is 0; 10 note then v1 at i = p1 and v2 at i = p2; cut to the element width (and, for f32, taken as its bits). avop runs the 11 note unit on the first n elements with the value v and must answer r; h is the FNV-1a digest 12 note (h = (h xor e) * `1099511628211` from `1469598103934665603`) of the L elements of the array the unit writes, or of 13 note A for a unit that only reads. L above avcap (the largest local array of the element type, 4 MiB) is ckbad. 14 note element i of the explicit list X 15 fn avw i ulong to ulong 16 w = ulong 0 17 for j ulong 8 18 w = or shl w 8 ckhex 22 add mul i 8 j 19 end 20 ret w 21 end 22 fn avx s view ulong 9 i ulong to ulong 23 x = ulong 0 24 if eq get s 2 0 25 x = avw i 26 else 27 x = rem add mul get s 0 i get s 1 get s 2 28 end 29 k = get s 3 30 if gt k 0 31 if eq rem i k 0 32 x = get s 4 33 end 34 end 35 if eq i get s 5 36 x = get s 6 37 end 38 if eq i get s 7 39 x = get s 8 40 end 41 ret x 42 end 43 fn avgc d edit uchar * s view ulong 9 l ulong to void 44 for i ulong l bound `1000003` 45 put d i uchar and avx s i 255 46 end 47 end 48 fn avgs d edit ushort * s view ulong 9 l ulong to void 49 for i ulong l bound `1000003` 50 put d i ushort and avx s i 65535 51 end 52 end 53 fn avgu d edit uint * s view ulong 9 l ulong to void 54 for i ulong l bound `1000003` 55 put d i uint and avx s i `4294967295` 56 end 57 end 58 fn avgf d edit f32 * s view ulong 9 l ulong to void 59 for i ulong l bound `1000003` 60 put d i bitcast f32 uint and avx s i `4294967295` 61 end 62 end 63 fn avgl d edit ulong * s view ulong 9 l ulong to void 64 for i ulong l bound `1000003` 65 put d i avx s i 66 end 67 end 68 fn avhc d view uchar * l ulong to ulong 69 h = ulong `1469598103934665603` 70 for i ulong l bound `1000003` 71 h = mul xor h ulong get d i `1099511628211` 72 end 73 ret h 74 end 75 fn avhs d view ushort * l ulong to ulong 76 h = ulong `1469598103934665603` 77 for i ulong l bound `1000003` 78 h = mul xor h ulong get d i `1099511628211` 79 end 80 ret h 81 end 82 fn avhu d view uint * l ulong to ulong 83 h = ulong `1469598103934665603` 84 for i ulong l bound `1000003` 85 h = mul xor h ulong get d i `1099511628211` 86 end 87 ret h 88 end 89 fn avhf d view f32 * l ulong to ulong 90 h = ulong `1469598103934665603` 91 for i ulong l bound `1000003` 92 h = mul xor h ulong bitcast uint get d i `1099511628211` 93 end 94 ret h 95 end 96 fn avhl d view ulong * l ulong to ulong 97 h = ulong `1469598103934665603` 98 for i ulong l bound `1000003` 99 h = mul xor h get d i `1099511628211` 100 end 101 ret h 102 end 103 fn crow to bool 104 if or ne ckcnt 25 not ckis 0 t_au 105 ckbad 106 end 107 l = cknum 1 108 n = cknum 2 109 if or gt l avcap gt n l 110 ckbad 111 end 112 a = new ulong 9 0 113 b = new ulong 9 0 114 for j ulong 9 115 put a j cknum add 3 j 116 put b j cknum add 12 j 117 end 118 if eq get b 2 0 119 ckbad 120 end 121 if eq get a 2 0 122 if ne ckhexn 22 mul l 8 123 ckbad 124 end 125 end 126 o = new ulong 2 0 127 avop a b l n cknum 21 o 128 if ne get o 0 cknum 23 129 ret false 130 end 131 ret eq get o 1 cknum 24 132 end