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/native/prefetch/classify.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 / native / prefetch / classify.om` 499 lines ยท 8612 bytes Raw Blame History 1 note SPDX-License-Identifier: AGPL-3.0-only 2 note Historical decode-graph prefetch control classifier. argv:exit,log,receipt. 3 note Trusted runner output only. Bounded 64KiB files; strict emitted JSON subset. 4 note Allowed FAIL slots 3 4 5 7 10 11 (mask 3256): the unordered o_proj race on GB10 fails every 5 note graph-vs-graph and A-vs-C check; CAUGHT needs slot 4 or 5 (mask 48), B identical=0 iff slot 7. 6 text invalid "PREFETCH_CONTROL: INVALID\n" 7 text caught "PREFETCH_CONTROL: CAUGHT\n" 8 text missed "PREFETCH_CONTROL: UNCAUGHT\n" 9 text checks "A (baseline, host glue) \nA deterministic over \nC (one list per token) \nC deterministic over \nargmax token identical: \nlogits A vs C within \nB (one launch per submission) \nB bit-identical to C (x, hidden, logits, token) in every rep\nnegative control: SWIGLU mutant fails the comparison \nnegative control: COMBINE mutant fails the comparison \nC after the mutants bit-identical to the first C\ntimeline: \ntimeline off: \ndgraph prefetch 1 (red 1)\nok: \nFAIL: \nchip: 13 checks, \n failed: FAIL\n failed: PASS\n" 10 text marker "dgraph prefetch 1 (red 1)" 11 text okprefix "ok: " 12 text failpre "FAIL: " 13 text summary "chip: 13 checks, " 14 text sumtail " failed: FAIL" 15 text passtail " failed: PASS" 16 text keys "checks\nfailed\nverdict\nreps\nred\ncached_weights\nlayers\nvocab\npos\nA\nC\nA_vs_C\nmutant1\nmutant2\nC0_token\nC0_logits_fnv\ntimeline\nmedian_ns\nB\ntok_same\ncaught\nrc\nidentical\n" 17 text failword "FAIL" 18 text password "PASS" 19 global data uchar 65537 20 global path uchar 4096 21 global states ulong 32 22 global seen ulong 1 23 global values ulong 19 24 global badcount ulong 1 25 global mode ulong 1 26 global ls ulong 3 27 global js ulong 4 28 global isint ulong 1 29 global owners ulong 32 30 global leafmask ulong 1 31 global badmask ulong 1 32 fn reject to void 33 r = write 1 invalid 0 len invalid 34 exit 65 35 end 36 fn load index ulong to ulong 37 n = argread index path 0 len path 38 if le n 0 39 reject 40 end 41 fd = fopen path 0 ulong n 0 0 42 if lt fd 0 43 reject 44 end 45 have = ulong 0 46 while lt have len data 47 r = read int fd data have sub len data have 48 if lt r 0 49 reject 50 end 51 if eq r 0 52 if ne fclose int fd 0 53 reject 54 end 55 if gt have 65536 56 reject 57 end 58 ret have 59 end 60 have = add have ulong r 61 end 62 reject 63 ret 0 64 end 65 fn matchtxt start ulong size ulong id ulong table bool to bool 66 p = ulong 0 67 which = ulong 0 68 n = len checks 69 if table 70 n = len keys 71 end 72 for i ulong n 73 b = get checks 0 74 if table 75 b = get keys i 76 else 77 b = get checks i 78 end 79 if eq b 10 80 if eq which id 81 if table 82 ret eq p size 83 end 84 ret le p size 85 end 86 which = add which 1 87 p = 0 88 else 89 if eq which id 90 if ge p size 91 ret false 92 end 93 if ne get data add start p b 94 ret false 95 end 96 p = add p 1 97 end 98 end 99 end 100 ret false 101 end 102 fn logline start ulong size ulong to void 103 if ne get ls 2 0 104 reject 105 end 106 if gt size 2048 107 reject 108 end 109 if and eq size len marker matchtxt start size 13 false 110 put ls 1 add get ls 1 1 111 end 112 kind = ulong 0 113 if matchtxt start size 14 false 114 kind = 4 115 end 116 if matchtxt start size 15 false 117 kind = 6 118 end 119 if ne kind 0 120 count = get ls 0 121 if ge count 13 122 reject 123 end 124 if not matchtxt add start kind sub size kind count false 125 reject 126 end 127 if eq kind 6 128 if eq and shl ulong 1 count 3256 0 129 reject 130 end 131 put badcount 0 add get badcount 0 1 132 put badmask 0 or get badmask 0 shl ulong 1 count 133 end 134 put ls 0 add count 1 135 end 136 if matchtxt start size 16 false 137 if or ne get ls 0 13 ne get ls 1 1 138 reject 139 end 140 p = add start len summary 141 if ne ulong get data p add 48 get badcount 0 142 reject 143 end 144 p = add p 1 145 if ne size add add len summary 1 len sumtail 146 reject 147 end 148 id = ulong 17 149 if eq get badcount 0 0 150 id = 18 151 end 152 if not matchtxt p len sumtail id false 153 reject 154 end 155 put ls 2 1 156 end 157 end 158 fn logcheck n ulong to void 159 start = ulong 0 160 for i ulong n 161 b = get data i 162 if or lt b 32 gt b 126 163 if ne b 10 164 reject 165 end 166 end 167 if eq b 10 168 logline start sub i start 169 start = add i 1 170 end 171 end 172 if or ne start n ne get ls 2 1 173 reject 174 end 175 end 176 note JSON states:object key/end0,key1,colon2,value3,comma/end4; array value/end5,value6,comma/end7. 177 fn jstring to ulong 178 start = add get js 1 1 179 i = start 180 while lt i get js 0 181 b = get data i 182 if eq b 34 183 put js 1 add i 1 184 ret start 185 end 186 if or lt b 32 or gt b 126 eq b 92 187 reject 188 end 189 i = add i 1 190 end 191 reject 192 ret 0 193 end 194 fn digit i ulong to bool 195 if ge i get js 0 196 ret false 197 end 198 b = get data i 199 ret and ge b 48 le b 57 200 end 201 fn jnumber to ulong 202 i = get js 1 203 put isint 0 1 204 if eq get data i 45 205 put isint 0 0 206 i = add i 1 207 end 208 if not digit i 209 reject 210 end 211 v = sub ulong get data i 48 212 i = add i 1 213 if ne v 0 214 while digit i 215 if gt v `1000000000000000000` 216 reject 217 end 218 v = add mul v 10 sub ulong get data i 48 219 i = add i 1 220 end 221 end 222 if and lt i get js 0 eq get data i 46 223 put isint 0 0 224 i = add i 1 225 begin = i 226 while digit i 227 i = add i 1 228 end 229 if eq i begin 230 reject 231 end 232 end 233 if and lt i get js 0 or eq get data i 101 eq get data i 69 234 put isint 0 0 235 i = add i 1 236 if and lt i get js 0 or eq get data i 43 eq get data i 45 237 i = add i 1 238 end 239 begin = i 240 while digit i 241 i = add i 1 242 end 243 if eq i begin 244 reject 245 end 246 end 247 put js 1 i 248 ret v 249 end 250 fn jkey to void 251 if ne get data get js 1 34 252 reject 253 end 254 start = jstring 255 size = sub sub get js 1 start 1 256 put js 3 99 257 if eq get js 2 1 258 for k ulong 19 259 if matchtxt start size k true 260 put js 3 k 261 bit = shl ulong 1 k 262 if ne and get seen 0 bit 0 263 reject 264 end 265 put seen 0 or get seen 0 bit 266 end 267 end 268 end 269 if eq get js 2 2 270 for k ulong 4 271 if matchtxt start size add k 19 true 272 put js 3 add k 19 273 end 274 end 275 end 276 put states sub get js 2 1 2 277 end 278 fn jstrval key ulong to void 279 start = jstring 280 if and eq get js 2 1 ne key 15 281 if or ne key 2 ne sub sub get js 1 start 1 4 282 reject 283 end 284 for j ulong 4 285 expected = get failword j 286 if eq get badcount 0 0 287 expected = get password j 288 end 289 if ne get data add start j expected 290 reject 291 end 292 end 293 put values 2 1 294 end 295 if and eq get js 2 1 eq key 15 296 if ne sub sub get js 1 start 1 16 297 reject 298 end 299 for j ulong 16 300 b = get data add start j 301 if not or and ge b 48 le b 57 and ge b 97 le b 102 302 reject 303 end 304 end 305 end 306 end 307 fn leaf key ulong value ulong to void 308 owner = get owners 1 309 slot = ulong 99 310 want = ulong 1 311 if and eq owner 11 eq key 19 312 slot = 0 313 if ne and get badmask 0 16 0 314 want = 0 315 end 316 end 317 if and or eq owner 12 eq owner 13 or eq key 20 eq key 21 318 slot = add mul sub owner 12 2 1 319 if eq key 20 320 slot = add slot 1 321 else 322 want = 0 323 end 324 end 325 if and eq owner 18 eq key 22 326 slot = 5 327 if ne and get badmask 0 128 0 328 want = 0 329 end 330 end 331 if lt slot 6 332 bit = shl ulong 1 slot 333 if ne and get leafmask 0 bit 0 334 reject 335 end 336 if or eq get isint 0 0 ne value want 337 reject 338 end 339 put leafmask 0 or get leafmask 0 bit 340 end 341 end 342 fn jvalue to void 343 depth = get js 2 344 key = get js 3 345 i = get js 1 346 b = get data i 347 state = get states sub depth 1 348 next = ulong 4 349 if ne state 3 350 next = 7 351 end 352 put states sub depth 1 next 353 if or eq b 123 eq b 91 354 if eq depth 1 355 if or ne b 123 or lt key 9 or eq key 14 or eq key 15 ge key 19 356 reject 357 end 358 end 359 if ge depth len states 360 reject 361 end 362 next = 0 363 if eq b 91 364 next = 5 365 end 366 put states depth next 367 put owners depth key 368 put js 2 add depth 1 369 put js 1 add i 1 370 ret 371 end 372 if eq b 34 373 jstrval key 374 ret 375 end 376 v = jnumber 377 if eq depth 1 378 if or ge key 19 eq key 2 379 reject 380 end 381 if and ge key 9 ne key 14 382 reject 383 end 384 if eq get isint 0 0 385 reject 386 end 387 put values key v 388 else 389 if eq depth 2 390 leaf key v 391 end 392 end 393 end 394 fn jstep to void 395 i = get js 1 396 b = get data i 397 if or eq b 32 or eq b 10 or eq b 13 eq b 9 398 put js 1 add i 1 399 ret 400 end 401 depth = get js 2 402 if eq depth 0 403 reject 404 end 405 state = get states sub depth 1 406 if or and eq b 125 or eq state 0 eq state 4 and eq b 93 or eq state 5 eq state 7 407 put js 2 sub depth 1 408 put js 1 add i 1 409 ret 410 end 411 if eq state 2 412 if ne b 58 413 reject 414 end 415 put states sub depth 1 3 416 put js 1 add i 1 417 ret 418 end 419 if or eq state 4 eq state 7 420 if ne b 44 421 reject 422 end 423 next = ulong 1 424 if eq state 7 425 next = 6 426 end 427 put states sub depth 1 next 428 put js 1 add i 1 429 ret 430 end 431 if or eq state 0 eq state 1 432 jkey 433 ret 434 end 435 if and ne state 3 and ne state 5 ne state 6 436 reject 437 end 438 jvalue 439 end 440 fn jsonchk n ulong to void 441 if or eq n 0 ne get data 0 123 442 reject 443 end 444 put js 0 n 445 put js 1 1 446 put js 2 1 447 put js 3 99 448 put states 0 0 449 while lt get js 1 n 450 jstep 451 end 452 if ne get leafmask 0 63 453 reject 454 end 455 if or ne get js 2 0 ne get seen 0 524287 456 reject 457 end 458 if or ne get values 0 13 ne get values 1 get badcount 0 459 reject 460 end 461 if or ne get values 2 1 ne get values 3 3 462 reject 463 end 464 if or ne get values 4 0 ne get values 5 1 465 reject 466 end 467 if or ne get values 6 2 or ne get values 7 151936 ne get values 8 300 468 reject 469 end 470 end 471 fn main to int 472 if ne argcnt 4 473 reject 474 end 475 r = argread 1 path 0 len path 476 if ne r 1 477 reject 478 end 479 if and ne get path 0 48 ne get path 0 49 480 reject 481 end 482 put mode 0 sub ulong get path 0 48 483 n = load 2 484 logcheck n 485 if and ne get badcount 0 0 eq and get badmask 0 48 0 486 reject 487 end 488 if ne eq get mode 0 0 eq get badcount 0 0 489 reject 490 end 491 n = load 3 492 jsonchk n 493 if eq get badcount 0 0 494 r = write 1 missed 0 len missed 495 ret 1 496 end 497 r = write 1 caught 0 len caught 498 ret 0 499 end