aien-train
AIEN training programme: language-model history, GB10 constraints and the route to training on the project engine. Plans and runnable checks are distinguished.
Brought by drakestapleton
aien-train / native / si19 / omexp.om
| 1 | note SPDX-License-Identifier: AGPL-3.0-only |
| 2 | note aien-train#24 ORIG-1: omexp-v1 experience records of the Omega matvec realization |
| 3 | note chooser (docs/si19/ORIG1-CONTRACT.md). Reader, admission checks, typed features, |
| 4 | note partitions and the deterministic baselines. No training here; no execution authority. |
| 5 | note RB raw record bytes (at most 2048 records of 256 bytes); RW decoded words, record r |
| 6 | note word i at r*32+i; RC: 0 records admitted, 1 bytes, 2 FNV-1a 64 of the bytes, 3 last |
| 7 | note status, 4..8 records per family 0..4; XF the 12 state features of the last oxfeat |
| 8 | note call in 1/16 units; LB the allow-list text (hashes with AUTHORIZED/SYNTHETIC/REVOKED). |
| 9 | note v2 admission (docs/si19/ORIG1-CONTRACT-v2.md, oxadm2): RC[9] = 1, RA per-record code |
| 10 | note (0 admitted, negative reason), RS per-record split (0 TRAIN, 1 VALIDATION, 2 HELD-OUT, |
| 11 | note 3 refused), RQ refusal counts by reason (RQ[0] admitted, RQ[k] reason -k). AU: audit. |
| 12 | global RB uchar 524288 |
| 13 | global RW ulong 65536 |
| 14 | global RC ulong 16 |
| 15 | global XF long 12 |
| 16 | global LB uchar 4100 |
| 17 | global RA long 2048 |
| 18 | global RS uchar 2048 |
| 19 | global RQ ulong 32 |
| 20 | global AU ulong 32 |
| 21 | |
| 22 | fn oxlg16 v ulong to ulong |
| 23 | note floor(log2 v)*16 plus a truncated 4-bit fraction; 0 for v = 0. |
| 24 | if eq v 0 |
| 25 | ret 0 |
| 26 | end |
| 27 | e = ulong 0 |
| 28 | q = v |
| 29 | while gt q 1 bound 64 |
| 30 | q = shr q 1 |
| 31 | e = add e 1 |
| 32 | end |
| 33 | ret sub add shr shl v 4 e mul 16 e 16 |
| 34 | end |
| 35 | |
| 36 | fn oxget pos ulong to ulong |
| 37 | v = ulong 0 |
| 38 | for i ulong 8 |
| 39 | v = or v shl ulong get RB add pos i mul i 8 |
| 40 | end |
| 41 | ret v |
| 42 | end |
| 43 | |
| 44 | fn oxword r ulong i ulong to ulong |
| 45 | ret get RW add mul r 32 i |
| 46 | end |
| 47 | |
| 48 | fn oxfam r ulong to ulong |
| 49 | ret oxword r 2 |
| 50 | end |
| 51 | |
| 52 | fn oxcore r ulong to ulong |
| 53 | ret oxword r 3 |
| 54 | end |
| 55 | |
| 56 | fn oxpress r ulong to ulong |
| 57 | ret oxword r 4 |
| 58 | end |
| 59 | |
| 60 | fn oxm r ulong to ulong |
| 61 | ret oxword r 5 |
| 62 | end |
| 63 | |
| 64 | fn oxn r ulong to ulong |
| 65 | ret oxword r 6 |
| 66 | end |
| 67 | |
| 68 | fn oxseq r ulong to ulong |
| 69 | ret oxword r 14 |
| 70 | end |
| 71 | |
| 72 | fn oxpart r ulong to ulong |
| 73 | note v1: family 0 TRAIN, 1 DEV, 2..4 TEST. v2 (RC[9] = 1): the record's workload-family |
| 74 | note split from oxadm2, 3 for a refused record (never in any partition). |
| 75 | if eq get RC 9 1 |
| 76 | ret ulong get RS r |
| 77 | end |
| 78 | f = oxfam r |
| 79 | if gt f 1 |
| 80 | ret 2 |
| 81 | end |
| 82 | ret f |
| 83 | end |
| 84 | |
| 85 | fn oxcache core ulong to ulong |
| 86 | note Last private cache per core class (contract s.1). |
| 87 | if eq core 0 |
| 88 | ret 2097152 |
| 89 | end |
| 90 | if eq core 1 |
| 91 | ret 524288 |
| 92 | end |
| 93 | ret 1048576 |
| 94 | end |
| 95 | |
| 96 | fn oxchk1 r ulong to int |
| 97 | note Header, enumerations, shape and profile words of one record. |
| 98 | if ne oxword r 0 3553143591248351811 |
| 99 | ret -2 |
| 100 | end |
| 101 | if ne oxword r 1 1 |
| 102 | ret -2 |
| 103 | end |
| 104 | if or gt oxfam r 4 gt oxcore r 2 |
| 105 | ret -3 |
| 106 | end |
| 107 | k = oxword r 13 |
| 108 | if or gt oxpress r 15 or eq k 0 gt k 8 |
| 109 | ret -3 |
| 110 | end |
| 111 | m = oxm r |
| 112 | n = oxn r |
| 113 | if or or eq m 0 gt m 8192 or eq n 0 gt n 8192 |
| 114 | ret -4 |
| 115 | end |
| 116 | if eq oxword r 7 0 |
| 117 | ret -4 |
| 118 | end |
| 119 | if ne oxword r 10 oxcache oxcore r |
| 120 | ret -9 |
| 121 | end |
| 122 | if ne oxword r 9 mul add add mul m n m n 8 |
| 123 | ret -9 |
| 124 | end |
| 125 | ret 0 |
| 126 | end |
| 127 | |
| 128 | fn oxchk2 r ulong to int |
| 129 | note Eligible mask, measurements, verified flags and the mismatch word. |
| 130 | k = oxword r 13 |
| 131 | e = oxword r 12 |
| 132 | if eq and e 1 0 |
| 133 | ret -5 |
| 134 | end |
| 135 | if ge e shl 1 k |
| 136 | ret -5 |
| 137 | end |
| 138 | for a ulong k |
| 139 | if ne and shr e a 1 0 |
| 140 | if eq oxword r add 16 a 0 |
| 141 | ret -6 |
| 142 | end |
| 143 | if ne oxword r add 24 a 1 |
| 144 | ret -6 |
| 145 | end |
| 146 | end |
| 147 | end |
| 148 | if ne oxword r 31 0 |
| 149 | ret -7 |
| 150 | end |
| 151 | ret 0 |
| 152 | end |
| 153 | |
| 154 | fn oxleak n ulong to int |
| 155 | note A TEST-H1 shape key present in TRAIN or DEV is held-out contamination. |
| 156 | for r ulong n |
| 157 | if eq oxfam r 2 |
| 158 | for q ulong n |
| 159 | if lt oxfam q 2 |
| 160 | if and eq oxm q oxm r eq oxn q oxn r |
| 161 | ret -11 |
| 162 | end |
| 163 | end |
| 164 | end |
| 165 | end |
| 166 | end |
| 167 | ret 0 |
| 168 | end |
| 169 | |
| 170 | fn oxfnv n ulong to ulong |
| 171 | note FNV-1a 64 over RB[0..n): the dataset identity for the allow-list and lineage. |
| 172 | h = ulong 14695981039346656037 |
| 173 | for i ulong n |
| 174 | h = mul xor h ulong get RB i 1099511628211 |
| 175 | end |
| 176 | ret h |
| 177 | end |
| 178 | |
| 179 | fn oxload n ulong to int |
| 180 | note Decode and admit RB[0..n). Nothing is admitted on refusal. |
| 181 | put RC 0 0 |
| 182 | put RC 3 0 |
| 183 | put RC 9 0 |
| 184 | if or eq n 0 or ne rem n 256 0 gt n 524288 |
| 185 | put RC 3 wsenc -1 |
| 186 | ret -1 |
| 187 | end |
| 188 | c = div n 256 |
| 189 | for r ulong c |
| 190 | for i ulong 32 |
| 191 | put RW add mul r 32 i oxget add mul r 256 mul i 8 |
| 192 | end |
| 193 | end |
| 194 | for r ulong c |
| 195 | s = oxchk1 r |
| 196 | if ge s 0 |
| 197 | s = oxchk2 r |
| 198 | end |
| 199 | if lt s 0 |
| 200 | put RC 3 wsenc long s |
| 201 | ret s |
| 202 | end |
| 203 | if gt r 0 |
| 204 | if le oxseq r oxseq sub r 1 |
| 205 | put RC 3 wsenc -8 |
| 206 | ret -8 |
| 207 | end |
| 208 | end |
| 209 | end |
| 210 | s = oxleak c |
| 211 | if lt s 0 |
| 212 | put RC 3 wsenc long s |
| 213 | ret s |
| 214 | end |
| 215 | for f ulong 5 |
| 216 | put RC add 4 f 0 |
| 217 | end |
| 218 | for r ulong c |
| 219 | f = add 4 oxfam r |
| 220 | put RC f add get RC f 1 |
| 221 | end |
| 222 | put RC 0 c |
| 223 | put RC 1 n |
| 224 | put RC 2 oxfnv n |
| 225 | ret 0 |
| 226 | end |
| 227 | |
| 228 | fn oxdigit p ulong to bool |
| 229 | b = get LB p |
| 230 | ret and ge b 48 le b 57 |
| 231 | end |
| 232 | |
| 233 | fn oxline p ulong n ulong to ulong |
| 234 | note Position after the end of the line that starts at p. |
| 235 | while lt p n bound 4096 |
| 236 | if eq get LB p 10 |
| 237 | ret add p 1 |
| 238 | end |
| 239 | p = add p 1 |
| 240 | end |
| 241 | ret n |
| 242 | end |
| 243 | |
| 244 | fn oxstatus p ulong n ulong to int |
| 245 | note The status token at p: first letter and length decide; -13 when malformed. |
| 246 | q = p |
| 247 | go = true |
| 248 | while and go lt q n bound 4096 |
| 249 | b = get LB q |
| 250 | if or eq b 32 eq b 10 |
| 251 | go = false |
| 252 | else |
| 253 | q = add q 1 |
| 254 | end |
| 255 | end |
| 256 | k = sub q p |
| 257 | b = get LB p |
| 258 | if and eq b 65 eq k 10 |
| 259 | ret 1 |
| 260 | end |
| 261 | if and eq b 83 eq k 9 |
| 262 | ret 2 |
| 263 | end |
| 264 | if and eq b 82 eq k 7 |
| 265 | ret -12 |
| 266 | end |
| 267 | ret -13 |
| 268 | end |
| 269 | |
| 270 | fn oxallow n ulong h ulong to int |
| 271 | note Lines "<decimal fnv> <AUTHORIZED|SYNTHETIC|REVOKED> <label>". 1 authorized owner |
| 272 | note data, 2 synthetic fixture, -12 revoked, -13 absent or malformed. |
| 273 | p = ulong 0 |
| 274 | while lt p n bound 4096 |
| 275 | v = ulong 0 |
| 276 | q = p |
| 277 | d = ulong 0 |
| 278 | while and lt q n oxdigit q bound 24 |
| 279 | v = add mul v 10 sub ulong get LB q 48 |
| 280 | q = add q 1 |
| 281 | d = add d 1 |
| 282 | end |
| 283 | if and gt d 0 eq v h |
| 284 | if and lt q n eq get LB q 32 |
| 285 | ret oxstatus add q 1 n |
| 286 | end |
| 287 | ret -13 |
| 288 | end |
| 289 | p = oxline p n |
| 290 | end |
| 291 | ret -13 |
| 292 | end |
| 293 | |
| 294 | fn oxcand r ulong a ulong to bool |
| 295 | note Admissible: eligible bit, a measurement and a verified flag. |
| 296 | if ge a oxword r 13 |
| 297 | ret false |
| 298 | end |
| 299 | if eq and shr oxword r 12 a 1 0 |
| 300 | ret false |
| 301 | end |
| 302 | if eq oxword r add 16 a 0 |
| 303 | ret false |
| 304 | end |
| 305 | ret eq oxword r add 24 a 1 |
| 306 | end |
| 307 | |
| 308 | fn oxcost r ulong a ulong to ulong |
| 309 | ret oxword r add 16 a |
| 310 | end |
| 311 | |
| 312 | fn oxt16 r ulong a ulong to long |
| 313 | ret sub long oxlg16 oxcost r a long oxlg16 oxcost r 0 |
| 314 | end |
| 315 | |
| 316 | fn oxflag v bool to long |
| 317 | if v |
| 318 | ret 16 |
| 319 | end |
| 320 | ret 0 |
| 321 | end |
| 322 | |
| 323 | fn oxfeat r ulong to void |
| 324 | note The frozen state vector (contract s.3), 1/16 units. |
| 325 | m = oxm r |
| 326 | n = oxn r |
| 327 | lm = oxlg16 m |
| 328 | ln = oxlg16 n |
| 329 | put XF 0 16 |
| 330 | put XF 1 long lm |
| 331 | put XF 2 long ln |
| 332 | put XF 3 long shr mul lm ln 8 |
| 333 | put XF 4 long shr mul ln ln 8 |
| 334 | put XF 5 oxflag le n 3 |
| 335 | put XF 6 oxflag ne rem n 4 0 |
| 336 | d = sub long oxlg16 oxword r 9 long oxlg16 oxword r 10 |
| 337 | if lt d 0 |
| 338 | d = 0 |
| 339 | end |
| 340 | if gt d 256 |
| 341 | d = 256 |
| 342 | end |
| 343 | put XF 7 d |
| 344 | c = oxcore r |
| 345 | put XF 8 oxflag eq c 0 |
| 346 | put XF 9 oxflag eq c 1 |
| 347 | put XF 10 oxflag eq c 2 |
| 348 | p = oxpress r |
| 349 | if gt p 15 |
| 350 | p = 15 |
| 351 | end |
| 352 | put XF 11 mul 16 long p |
| 353 | end |
| 354 | |
| 355 | fn oxbest r ulong to ulong |
| 356 | note The cheapest admissible arm, lowest index on a tie (analysis bound). |
| 357 | b = ulong 0 |
| 358 | k = oxword r 13 |
| 359 | for a ulong k |
| 360 | if oxcand r a |
| 361 | if lt oxcost r a oxcost r b |
| 362 | b = a |
| 363 | end |
| 364 | end |
| 365 | end |
| 366 | ret b |
| 367 | end |
| 368 | |
| 369 | fn oxrule r ulong to ulong |
| 370 | note The incumbent fixed rule: unroll2 when N <= 8, else unroll4_dual; reference if not admissible. |
| 371 | a = ulong 3 |
| 372 | if le oxn r 8 |
| 373 | a = 2 |
| 374 | end |
| 375 | if oxcand r a |
| 376 | ret a |
| 377 | end |
| 378 | ret 0 |
| 379 | end |
| 380 | |
| 381 | fn oxnearok q ulong c ulong p ulong to bool |
| 382 | note A retrieval neighbour: TRAIN, same core class; in v2 also the same pressure bucket. |
| 383 | if or ne oxpart q 0 ne oxcore q c |
| 384 | ret false |
| 385 | end |
| 386 | if eq get RC 9 1 |
| 387 | ret eq oxpress q p |
| 388 | end |
| 389 | ret true |
| 390 | end |
| 391 | |
| 392 | fn oxl1 q ulong lm long ln long to long |
| 393 | note L1 distance of record q to (lm, ln) in lg16 units. |
| 394 | ret add wsabs sub lm long oxlg16 oxm q wsabs sub ln long oxlg16 oxn q |
| 395 | end |
| 396 | |
| 397 | fn oxnear r ulong to ulong |
| 398 | note Nearest TRAIN record of the same core class by L1 on (lg16 M, lg16 N); lowest index tie. |
| 399 | note v2 also requires the same pressure bucket (oxnearok). |
| 400 | c = oxcore r |
| 401 | p = oxpress r |
| 402 | lm = long oxlg16 oxm r |
| 403 | ln = long oxlg16 oxn r |
| 404 | b = ulong 1048576 |
| 405 | bd = long 1099511627776 |
| 406 | for q ulong get RC 0 |
| 407 | if oxnearok q c p |
| 408 | d = oxl1 q lm ln |
| 409 | if lt d bd |
| 410 | bd = d |
| 411 | b = q |
| 412 | end |
| 413 | end |
| 414 | end |
| 415 | ret b |
| 416 | end |
| 417 | |
| 418 | fn oxstatic core ulong to ulong |
| 419 | note The single arm with the lowest total TRAIN cost on that core class, lowest index tie; |
| 420 | note an arm missing from any such record is not a candidate. |
| 421 | t = new ulong 8 0 |
| 422 | k = new ulong 8 0 |
| 423 | c = ulong 0 |
| 424 | for q ulong get RC 0 |
| 425 | if and eq oxpart q 0 eq oxcore q core |
| 426 | c = add c 1 |
| 427 | for a ulong 8 |
| 428 | if oxcand q a |
| 429 | put t a add get t a oxcost q a |
| 430 | put k a add get k a 1 |
| 431 | end |
| 432 | end |
| 433 | end |
| 434 | end |
| 435 | b = ulong 0 |
| 436 | for a ulong 8 |
| 437 | if eq get k a c |
| 438 | if lt get t a get t b |
| 439 | b = a |
| 440 | end |
| 441 | end |
| 442 | end |
| 443 | ret b |
| 444 | end |
| 445 | |
| 446 | fn oxfl v ulong to ulong |
| 447 | note floor(log2 v) for v >= 1: the workload-family coordinate. |
| 448 | e = ulong 0 |
| 449 | q = v |
| 450 | while gt q 1 bound 64 |
| 451 | q = shr q 1 |
| 452 | e = add e 1 |
| 453 | end |
| 454 | ret e |
| 455 | end |
| 456 | |
| 457 | fn oxcell r ulong to ulong |
| 458 | note Workload family (shape lineage) of record r: 16 floor(log2 M) + floor(log2 N). |
| 459 | ret add mul oxfl oxm r 16 oxfl oxn r |
| 460 | end |
| 461 | |
| 462 | fn oxhspl cm ulong cn ulong to ulong |
| 463 | note Frozen split of the family (cm, cn): h = FNV-1a 64 over the two bytes cm, cn; |
| 464 | note k = (h >> 32) mod 10; 0..5 TRAIN, 6..7 VALIDATION, 8..9 HELD-OUT. |
| 465 | h = ulong 14695981039346656037 |
| 466 | h = mul xor h cm 1099511628211 |
| 467 | h = mul xor h cn 1099511628211 |
| 468 | k = rem shr h 32 10 |
| 469 | if le k 5 |
| 470 | ret 0 |
| 471 | end |
| 472 | if le k 7 |
| 473 | ret 1 |
| 474 | end |
| 475 | ret 2 |
| 476 | end |
| 477 | |
| 478 | fn oxspl r ulong to ulong |
| 479 | ret oxhspl oxfl oxm r oxfl oxn r |
| 480 | end |
| 481 | |
| 482 | fn oxfmt2 r ulong to int |
| 483 | note v2 format, supported enumerations, shape range and profile of one record. |
| 484 | if ne oxword r 0 3553143591248351811 |
| 485 | ret -2 |
| 486 | end |
| 487 | if ne oxword r 1 1 |
| 488 | ret -2 |
| 489 | end |
| 490 | if or gt oxfam r 5 gt oxcore r 1 |
| 491 | ret -3 |
| 492 | end |
| 493 | if or gt oxpress r 1 ne oxword r 13 6 |
| 494 | ret -3 |
| 495 | end |
| 496 | m = oxm r |
| 497 | n = oxn r |
| 498 | if or or eq m 0 gt m 8192 or eq n 0 gt n 8192 |
| 499 | ret -4 |
| 500 | end |
| 501 | if gt mul m n 524288 |
| 502 | ret -4 |
| 503 | end |
| 504 | k = oxword r 7 |
| 505 | if or eq k 0 gt k 1048576 |
| 506 | ret -4 |
| 507 | end |
| 508 | if ne oxword r 10 oxcache oxcore r |
| 509 | ret -9 |
| 510 | end |
| 511 | if ne oxword r 9 mul add add mul m n m n 8 |
| 512 | ret -9 |
| 513 | end |
| 514 | ret 0 |
| 515 | end |
| 516 | |
| 517 | fn oxpair2 r ulong to bool |
| 518 | note The complete arm set of the profile for this state: arms 0..4 eligible, measured and |
| 519 | note verified; arm 5 (planted) neither eligible, measured nor verified; arms 6, 7 absent. |
| 520 | if ne oxword r 12 31 |
| 521 | ret false |
| 522 | end |
| 523 | for a ulong 5 |
| 524 | if or eq oxword r add 16 a 0 ne oxword r add 24 a 1 |
| 525 | ret false |
| 526 | end |
| 527 | end |
| 528 | if or ne oxword r 21 0 ne oxword r 29 0 |
| 529 | ret false |
| 530 | end |
| 531 | ret and eq oxword r 22 0 eq oxword r 23 0 |
| 532 | end |
| 533 | |
| 534 | fn oxval2 r ulong to int |
| 535 | note Pairing (-14), measurement range (-10: ps per call 1..2^40-1, the integer record's |
| 536 | note analogue of a non-finite value) and the mismatch word (-7). |
| 537 | if not oxpair2 r |
| 538 | ret -14 |
| 539 | end |
| 540 | for a ulong 5 |
| 541 | if ge oxword r add 16 a 1099511627776 |
| 542 | ret -10 |
| 543 | end |
| 544 | end |
| 545 | if gt oxword r 31 0 |
| 546 | ret -7 |
| 547 | end |
| 548 | ret 0 |
| 549 | end |
| 550 | |
| 551 | fn oxsame q ulong r ulong to bool |
| 552 | note Same decision state key: core class, pressure bucket, M and N. |
| 553 | if or ne oxm q oxm r ne oxn q oxn r |
| 554 | ret false |
| 555 | end |
| 556 | ret and eq oxcore q oxcore r eq oxpress q oxpress r |
| 557 | end |
| 558 | |
| 559 | fn oxdup2 r ulong to bool |
| 560 | note An earlier admitted record has the same state key (duplicate state, every arm). |
| 561 | d = false |
| 562 | for q ulong r |
| 563 | if eq get RA q 0 |
| 564 | if oxsame q r |
| 565 | d = true |
| 566 | end |
| 567 | end |
| 568 | end |
| 569 | ret d |
| 570 | end |
| 571 | |
| 572 | fn oxrec2 r ulong to int |
| 573 | note v2 reason for record r, first failing check: -2 format, -3 unsupported enumeration, |
| 574 | note -4 shape, -9 profile, -14 unpaired, -10 out of range, -7 unverified, -8 sequence not |
| 575 | note increasing, -15 duplicate state; 0 admitted. |
| 576 | s = oxfmt2 r |
| 577 | if ne s 0 |
| 578 | ret s |
| 579 | end |
| 580 | s = oxval2 r |
| 581 | if ne s 0 |
| 582 | ret s |
| 583 | end |
| 584 | if gt r 0 |
| 585 | if ge oxseq sub r 1 oxseq r |
| 586 | ret -8 |
| 587 | end |
| 588 | end |
| 589 | if oxdup2 r |
| 590 | ret -15 |
| 591 | end |
| 592 | ret 0 |
| 593 | end |
| 594 | |
| 595 | fn oxconf q ulong r ulong to bool |
| 596 | note Two admitted records that share a workload family or a shape but not a split. |
| 597 | if eq get RS q get RS r |
| 598 | ret false |
| 599 | end |
| 600 | if eq oxcell q oxcell r |
| 601 | ret true |
| 602 | end |
| 603 | ret and eq oxm q oxm r eq oxn q oxn r |
| 604 | end |
| 605 | |
| 606 | fn oxdisj c ulong to int |
| 607 | note Workload-disjoint split check over admitted records: -11 on any conflict. |
| 608 | for r ulong c |
| 609 | if lt get RS r 3 |
| 610 | for q ulong r |
| 611 | if lt get RS q 3 |
| 612 | if oxconf q r |
| 613 | ret int -11 |
| 614 | end |
| 615 | end |
| 616 | end |
| 617 | end |
| 618 | end |
| 619 | ret 0 |
| 620 | end |
| 621 | |
| 622 | fn oxdec n ulong to ulong |
| 623 | note Decode RB[0..n) into RW without any check; returns the record count. |
| 624 | c = div n 256 |
| 625 | for r ulong c |
| 626 | for i ulong 32 |
| 627 | put RW add mul r 32 i oxget add mul r 256 mul i 8 |
| 628 | end |
| 629 | end |
| 630 | ret c |
| 631 | end |
| 632 | |
| 633 | fn oxtally c ulong to void |
| 634 | note Per-record reasons into RA and RQ, splits into RS, admitted per split into RC[4..6]. |
| 635 | for r ulong c |
| 636 | s = oxrec2 r |
| 637 | put RA r long s |
| 638 | k = ulong neg long s |
| 639 | put RQ k add get RQ k 1 |
| 640 | put RS r 3 |
| 641 | if eq s 0 |
| 642 | p = oxspl r |
| 643 | put RS r uchar p |
| 644 | put RC add 4 p add get RC add 4 p 1 |
| 645 | end |
| 646 | end |
| 647 | end |
| 648 | |
| 649 | fn oxadm2 n ulong to int |
| 650 | note v2 admission of RB[0..n): whole-file size refusal (-1) or disjointness failure (-11) |
| 651 | note admits nothing; otherwise every record is admitted or refused with a counted reason. |
| 652 | put RC 0 0 |
| 653 | put RC 3 0 |
| 654 | put RC 9 0 |
| 655 | for i ulong 32 |
| 656 | put RQ i 0 |
| 657 | end |
| 658 | for i ulong 16 |
| 659 | put RC i 0 |
| 660 | end |
| 661 | if or eq n 0 or ne rem n 256 0 gt n 524288 |
| 662 | put RC 3 wsenc -1 |
| 663 | ret -1 |
| 664 | end |
| 665 | c = oxdec n |
| 666 | put RC 9 1 |
| 667 | oxtally c |
| 668 | s = oxdisj c |
| 669 | if lt s 0 |
| 670 | put RC 9 0 |
| 671 | put RC 3 wsenc long s |
| 672 | ret s |
| 673 | end |
| 674 | put RC 0 c |
| 675 | put RC 1 n |
| 676 | put RC 2 oxfnv n |
| 677 | put RC 10 get RQ 0 |
| 678 | ret 0 |
| 679 | end |
| 680 | |
| 681 | fn oxwkey q ulong r ulong to bool |
| 682 | note Same workload: core class, M, N and the job seed (operands are regenerated from it). |
| 683 | if or ne oxm q oxm r ne oxn q oxn r |
| 684 | ret false |
| 685 | end |
| 686 | ret and eq oxcore q oxcore r eq oxword q 8 oxword r 8 |
| 687 | end |
| 688 | |
| 689 | fn oxfirst r ulong a0 ulong a1 ulong to ulong |
| 690 | note First record q in [a0, a1) with the workload of r; 1048576 when none. |
| 691 | b = ulong 1048576 |
| 692 | q = a1 |
| 693 | while gt q a0 bound 4096 |
| 694 | q = sub q 1 |
| 695 | if oxwkey q r |
| 696 | b = q |
| 697 | end |
| 698 | end |
| 699 | ret b |
| 700 | end |
| 701 | |
| 702 | fn oxfirsts r ulong a0 ulong a1 ulong to ulong |
| 703 | note First record q in [a0, a1) with the state key of r (oxsame); 1048576 when none. |
| 704 | b = ulong 1048576 |
| 705 | q = a1 |
| 706 | while gt q a0 bound 4096 |
| 707 | q = sub q 1 |
| 708 | if oxsame q r |
| 709 | b = q |
| 710 | end |
| 711 | end |
| 712 | ret b |
| 713 | end |
| 714 | |
| 715 | fn oxauinc k ulong to void |
| 716 | put AU k add get AU k 1 |
| 717 | end |
| 718 | |
| 719 | fn oxaub r ulong na ulong to void |
| 720 | note Audit of one record r of file B against file A = records [0, na). |
| 721 | f = oxfam r |
| 722 | if gt f 1 |
| 723 | oxauinc 12 |
| 724 | end |
| 725 | q = oxfirst r 0 na |
| 726 | if lt q 1048576 |
| 727 | oxauinc 0 |
| 728 | oxauinc add 1 f |
| 729 | if eq oxbest q oxbest r |
| 730 | oxauinc 6 |
| 731 | end |
| 732 | end |
| 733 | if lt oxfirsts r 0 na 1048576 |
| 734 | oxauinc 7 |
| 735 | end |
| 736 | end |
| 737 | |
| 738 | fn oxtrcell r ulong na ulong to bool |
| 739 | note A TRAIN (family 0) record of file A, same core class, in the workload family of r. |
| 740 | h = false |
| 741 | for q ulong na |
| 742 | if and eq oxfam q 0 eq oxcore q oxcore r |
| 743 | if eq oxcell q oxcell r |
| 744 | h = true |
| 745 | end |
| 746 | end |
| 747 | end |
| 748 | ret h |
| 749 | end |
| 750 | |
| 751 | fn oxxfam r ulong na ulong to bool |
| 752 | note The workload of r also occurs in file A under another family word. |
| 753 | h = false |
| 754 | for q ulong na |
| 755 | if ne oxfam q oxfam r |
| 756 | if oxwkey q r |
| 757 | h = true |
| 758 | end |
| 759 | end |
| 760 | end |
| 761 | ret h |
| 762 | end |
| 763 | |
| 764 | fn oxaua r ulong na ulong to void |
| 765 | note Audit of one record r of file A against itself. |
| 766 | if lt oxfirsts r 0 r 1048576 |
| 767 | oxauinc 8 |
| 768 | end |
| 769 | if oxxfam r na |
| 770 | oxauinc 9 |
| 771 | end |
| 772 | f = oxfam r |
| 773 | if or eq f 2 eq f 3 |
| 774 | oxauinc 11 |
| 775 | if oxtrcell r na |
| 776 | oxauinc 10 |
| 777 | end |
| 778 | end |
| 779 | end |
| 780 | |
| 781 | fn oxaudit na ulong nb ulong to void |
| 782 | note Leakage audit of two decoded files, A = records [0, na), B = [na, na + nb). AU: 0 B |
| 783 | note workloads present in A, 1..5 by B family 0..4, 6 of those with the same oracle arm, |
| 784 | note 7 B state keys present in A, 8 A duplicate state keys, 9 A workloads under two family |
| 785 | note words, 10 A TEST (families 2, 3) records whose workload family holds an A TRAIN record |
| 786 | note of the same core class, 11 A records of families 2, 3, 12 B records of families 2..4 |
| 787 | note (the v1 TEST partition). |
| 788 | for i ulong 32 |
| 789 | put AU i 0 |
| 790 | end |
| 791 | for r ulong na |
| 792 | oxaua r na |
| 793 | end |
| 794 | for k ulong nb |
| 795 | oxaub add na k na |
| 796 | end |
| 797 | end |