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/runtime/check/platpolicy-check.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 / runtime / check / platpolicy-check.om` 203 lines ยท 4092 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note gpu/runtime/check/platpolicy-check.om: runs plat_policy of gpu/nvidia/om/platform-linux/plat_policy.om for every 3 note message kind 0..15 on xorshift64 inputs with boundary values (for kind 7, every other case a short text of 4 note digits, blanks and signs packed eight bytes to a word from m[2], its length in m[1]), and prints what the C 5 note oracle printed for plat_c of CUDApp src/omega_gpu_platform_linux_cpolicy.h (gpu/runtime/README.md). 6 note gpu/runtime/check/platpolicy.expect.txt is that oracle's output. Composed after plat_policy.om. OM-1, as 7 note plat_policy.om is (it names a parameter out, a word OM-2 reserves), so the output goes through a fixed buffer 8 note that is written out whenever it fills, and the fixed texts are ranges of pq_all. 9 global pq_s ulong 1 10 global pq_o uchar 4096 11 global pq_n ulong 1 12 global pq_b ulong 32 13 text pq_tx " \t\n+-0123456789x" 14 note kind 0 5, case 5 6, r= 11 3, q= 14 3, cases= 17 7, nonzero= 24 9, fnv= 33 5 15 text pq_all "kind case r= q= cases= nonzero= fnv=" 16 fn pqflush to void 17 n = get pq_n 0 18 o = ulong 0 19 while lt o n bound `9223372036854775807` 20 x = write 1 pq_o o sub n o 21 if le x 0 22 exit 3 23 end 24 o = add o ulong x 25 end 26 put pq_n 0 0 27 end 28 fn pqoc c ulong to void 29 if ge get pq_n 0 len pq_o 30 pqflush 31 end 32 n = get pq_n 0 33 put pq_o n uchar c 34 put pq_n 0 add n 1 35 end 36 fn pqt off ulong n ulong to void 37 for i ulong n 38 pqoc ulong get pq_all add off i 39 end 40 end 41 fn pqnum v ulong to void 42 if ge v 10 43 pqnum div v 10 44 end 45 pqoc add 48 rem v 10 46 end 47 fn pqhex v ulong to void 48 for i ulong 16 49 c = and shr v mul 4 sub 15 i 15 50 if lt c 10 51 pqoc add 48 c 52 else 53 pqoc add 87 c 54 end 55 end 56 end 57 fn pqrnd to ulong 58 s = get pq_s 0 59 s = xor s shl s 13 60 s = xor s shr s 7 61 s = xor s shl s 17 62 put pq_s 0 s 63 ret s 64 end 65 fn pqval to ulong 66 r = pqrnd 67 sel = and r 7 68 if lt sel 4 69 ret get pq_b and shr r 3 31 70 end 71 if lt sel 6 72 ret and shr r 3 127 73 end 74 ret pqrnd 75 end 76 fn pqfnv h ulong w ulong to ulong 77 for b ulong 8 78 h = mul xor h and shr w mul 8 b 255 `1099511628211` 79 end 80 ret h 81 end 82 note the text case of kind 7: n = 1 + rnd mod 34 bytes, each the text pq_tx at rnd and 15, from m[2] up 83 fn pqtext m edit ulong 16 to void 84 n = add 1 rem pqrnd 34 85 for i ulong 5 86 put m add i 2 0 87 end 88 for i ulong n 89 if lt i 40 90 w = add 2 div i 8 91 c = ulong get pq_tx and pqrnd 15 92 put m w or get m w shl c mul rem i 8 8 93 end 94 end 95 put m 1 n 96 end 97 fn pqline kind ulong c ulong r ulong q view ulong 16 to void 98 pqt 0 5 99 pqnum kind 100 pqt 5 6 101 pqnum c 102 pqt 11 3 103 pqnum r 104 pqt 14 3 105 for i ulong 16 106 pqnum get q i 107 if lt i 15 108 pqoc 44 109 else 110 pqoc 10 111 end 112 end 113 end 114 fn pqcase kind ulong c ulong m edit ulong 16 to void 115 for i ulong 16 116 put m i pqval 117 end 118 put m 0 kind 119 if and eq kind 7 eq rem c 2 0 120 pqtext m 121 end 122 note kind 12, every other case: a slot (c/2) mod 3 that matches m[2], m[3] 123 if and eq kind 12 eq rem c 2 0 124 s = mul rem div c 2 3 2 125 put m 1 add 2 rem get m 1 4 126 put m add 4 s get m 2 127 put m add 5 s get m 3 128 end 129 end 130 fn pqkind kind ulong to void 131 nc = ulong 4096 132 m = new ulong 16 0 133 q = new ulong 16 0 134 h = ulong `14695981039346656037` 135 nz = ulong 0 136 for c ulong nc 137 pqcase kind c m 138 note q starts zero, as plat_decide of CUDApp src/omega_gpu_platform_linux.c sets it before each call 139 for i ulong 16 140 put q i 0 141 end 142 r = plat_policy m q 143 if lt c 2 144 pqline kind c r q 145 end 146 h = pqfnv h r 147 for i ulong 16 148 h = pqfnv h get q i 149 end 150 if ne r 0 151 nz = add nz 1 152 end 153 end 154 pqt 0 5 155 pqnum kind 156 pqt 17 7 157 pqnum nc 158 pqt 24 9 159 pqnum nz 160 pqt 33 5 161 pqhex h 162 pqoc 10 163 pqflush 164 end 165 fn main to int 166 put pq_s 0 `88172645463325252` 167 put pq_b 0 0 168 put pq_b 1 1 169 put pq_b 2 2 170 put pq_b 3 3 171 put pq_b 4 4 172 put pq_b 5 8 173 put pq_b 6 9 174 put pq_b 7 10 175 put pq_b 8 12 176 put pq_b 9 13 177 put pq_b 10 15 178 put pq_b 11 16 179 put pq_b 12 32 180 put pq_b 13 33 181 put pq_b 14 47 182 put pq_b 15 50 183 put pq_b 16 51 184 put pq_b 17 52 185 put pq_b 18 121 186 put pq_b 19 4095 187 put pq_b 20 4096 188 put pq_b 21 4097 189 put pq_b 22 65536 190 put pq_b 23 999999 191 put pq_b 24 `4294967295` 192 put pq_b 25 `4294967296` 193 put pq_b 26 `1099511627776` 194 put pq_b 27 `1844674407370955161` 195 put pq_b 28 `9223372036854775808` 196 put pq_b 29 `18446744073709547520` 197 put pq_b 30 `18446744073709551614` 198 put pq_b 31 `18446744073709551615` 199 for kind ulong 16 200 pqkind kind 201 end 202 ret 0 203 end