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/aien-train/blob/main/evidence/ECOSYSTEM6/independent-review/mutant2-independent-unit.om # 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 Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-train / evidence / ECOSYSTEM6 / independent-review / mutant2-independent-unit.om` 784 lines ยท 13306 bytes Raw Blame History 1 note SPDX-License-Identifier: AGPL-3.0-only 2 note Native IEEE binary32 addition over bit patterns, RNE and gradual underflow. 3 note Canonical positive quiet NaN; no foreign floating runtime or compiler f32 type. 4 fn ajam x ulong n ulong to ulong 5 if eq n 0 6 ret x 7 end 8 if ge n 64 9 if ne x 0 10 ret 1 11 end 12 ret 0 13 end 14 q = shr x n 15 mask = sub shl 1 n 1 16 if ne and x mask 0 17 q = or q 1 18 end 19 ret q 20 end 21 fn add32 aa ulong bb ulong to ulong 22 a = and aa `4294967295` 23 b = and bb `4294967295` 24 if or gt and a `2147483647` `2139095040` gt and b `2147483647` `2139095040` 25 ret `2143289344` 26 end 27 if lt and a `2147483647` and b `2147483647` 28 t = a 29 a = b 30 b = t 31 end 32 if eq and a `2147483647` `2139095040` 33 if and eq and b `2147483647` `2139095040` ne and xor a b `2147483648` 0 34 ret `2143289344` 35 end 36 ret a 37 end 38 if eq and b `2147483647` 0 39 if eq and a `2147483647` 0 40 ret and and a b `2147483648` 41 end 42 ret a 43 end 44 sign = and a `2147483648` 45 ea = and shr a 23 255 46 eb = and shr b 23 255 47 ma = and a `8388607` 48 mb = and b `8388607` 49 if eq ea 0 50 ea = 1 51 else 52 ma = or ma `8388608` 53 end 54 if eq eb 0 55 eb = 1 56 else 57 mb = or mb `8388608` 58 end 59 ma = shl ma 3 60 mb = shl mb 3 61 mb = ajam mb sub ea eb 62 if eq and xor a b `2147483648` 0 63 ma = add ma mb 64 if ge ma `134217728` 65 ma = ajam ma 1 66 ea = add ea 1 67 end 68 else 69 ma = sub ma mb 70 if eq ma 0 71 ret 0 72 end 73 while and lt ma `67108864` gt ea 1 74 ma = shl ma 1 75 ea = sub ea 1 76 end 77 end 78 q = shr ma 3 79 r = and ma 7 80 if gt r 4 81 q = add q 1 82 else 83 if eq r 4 84 if ne and q 1 0 85 q = add q 1 86 end 87 end 88 end 89 if ge q `16777216` 90 q = shr q 1 91 ea = add ea 1 92 end 93 if ge ea 255 94 ret or sign `2139095040` 95 end 96 if lt q `8388608` 97 ea = 0 98 end 99 q = and q `8388607` 100 ea = shl ea 23 101 q = or q ea 102 ret or sign q 103 end 104 note SPDX-License-Identifier: AGPL-3.0-only 105 note Native IEEE binary32 multiplication represented as bits; no host floating runtime. 106 note Round-to-nearest ties-to-even, gradual underflow, signed zeros and infinities. 107 note Canonical positive quiet NaN for every NaN result. Inputs are low32 bits. 108 fn mround x ulong shift ulong to ulong 109 if eq shift 0 110 ret x 111 end 112 if gt shift 63 113 ret 0 114 end 115 q = shr x shift 116 mask = sub shl 1 shift 1 117 r = and x mask 118 half = shl 1 sub shift 1 119 if or gt r half and eq r half ne and q 1 0 120 q = add q 1 121 end 122 ret q 123 end 124 fn mul32 aa ulong bb ulong to ulong 125 a = and aa `4294967295` 126 b = and bb `4294967295` 127 sign = and xor a b `2147483648` 128 ea = long and shr a 23 255 129 eb = long and shr b 23 255 130 ma = and a `8388607` 131 mb = and b `8388607` 132 if or and eq ea 255 ne ma 0 and eq eb 255 ne mb 0 133 ret `2143289344` 134 end 135 if or eq ea 255 eq eb 255 136 if or eq and a `2147483647` 0 eq and b `2147483647` 0 137 ret `2143289344` 138 end 139 ret or sign `2139095040` 140 end 141 if or eq and a `2147483647` 0 eq and b `2147483647` 0 142 ret sign 143 end 144 if eq ea 0 145 ea = 1 146 while lt ma `8388608` 147 ma = shl ma 1 148 ea = sub ea 1 149 end 150 else 151 ma = or ma `8388608` 152 end 153 if eq eb 0 154 eb = 1 155 while lt mb `8388608` 156 mb = shl mb 1 157 eb = sub eb 1 158 end 159 else 160 mb = or mb `8388608` 161 end 162 product = mul ma mb 163 e = sub add ea eb 127 164 shift = long 23 165 if ge product `140737488355328` 166 shift = 24 167 e = add e 1 168 end 169 if lt e 1 170 shift = add shift sub 1 e 171 e = 0 172 end 173 q = mround product ulong shift 174 if eq e 0 175 if ge q `8388608` 176 e = 1 177 end 178 else 179 if ge q `16777216` 180 q = shr q 1 181 e = add e 1 182 end 183 end 184 if ge e 255 185 ret or sign `2139095040` 186 end 187 q = and q `8388607` 188 e = shl e 23 189 q = or q ulong e 190 ret or sign q 191 end 192 note M20 metadata-v1. Integer metadata only; no allocator or numeric execution. 193 note ED: schema,dtype,rank,elements,offset,slot,generation,reserved,shape8,stride8. 194 note ES: live,retired,slot,generation,dtype,elements,reserved,reserved. 195 note ES is the caller-owned allocator snapshot. It is not untrusted wire input. 196 global ED ulong 24 197 global ES ulong 8 198 199 fn emshape to int 200 rank = get ED 2 201 if gt rank 8 202 ret -2 203 end 204 n = ulong 1 205 for d ulong rank 206 size = get ED add 8 d 207 if eq size 0 208 ret -3 209 end 210 if gt size div `1073741824` n 211 ret -8 212 end 213 n = mul n size 214 end 215 if ne get ED 3 n 216 ret -3 217 end 218 ret 0 219 end 220 221 fn emlive slot ulong gen ulong to int 222 if gt slot `4294967295` 223 ret -5 224 end 225 if or ne get ES 0 1 ne get ES 1 0 226 ret -5 227 end 228 if or eq gen 0 ne slot get ES 2 229 ret -5 230 end 231 if ne gen get ES 3 232 ret -5 233 end 234 ret 0 235 end 236 237 fn embounds to int 238 size = get ES 5 239 offset = get ED 4 240 if or eq size 0 gt size `1073741824` 241 ret -8 242 end 243 if ge offset size 244 ret -6 245 end 246 note Compare against remaining extent before multiplication, never overflow. 247 room = sub sub size 1 offset 248 for d ulong get ED 2 249 count = sub get ED add 8 d 1 250 stride = get ED add 16 d 251 if ne stride 0 252 if gt count div room stride 253 ret -6 254 end 255 room = sub room mul count stride 256 end 257 end 258 ret 0 259 end 260 261 fn emcheck to int 262 if or ne get ED 0 1 ne get ED 7 0 263 ret -1 264 end 265 if or ne get ES 6 0 ne get ES 7 0 266 ret -1 267 end 268 dtype = get ED 1 269 if or lt dtype 1 gt dtype 3 270 ret -4 271 end 272 status = emshape 273 if ne status 0 274 ret status 275 end 276 status = emlive get ED 5 get ED 6 277 if ne status 0 278 ret status 279 end 280 if ne dtype get ES 4 281 ret -4 282 end 283 ret embounds 284 end 285 286 fn emrelease slot ulong gen ulong to int 287 status = emlive slot gen 288 if ne status 0 289 ret status 290 end 291 note A maximal generation is retired, never wrapped into a valid old handle. 292 if eq gen `18446744073709551615` 293 put ES 1 1 294 else 295 put ES 3 add gen 1 296 end 297 put ES 0 0 298 ret 0 299 end 300 note SPDX-License-Identifier: AGPL-3.0-only 301 note Bounded host FP32 consumer. Uses external pinned L720 add32/mul32 and M20 emcheck. 302 note Eight independent tensors X,W,b,T,Y,dX,dW,db in 16-cell slots. 303 note Values are IEEE binary32 bits in ulong carriers, not integer fixed-point values. 304 note AD/AS are trusted local descriptor and allocator snapshots, not wire records. 305 global AD ulong 192 306 global AS ulong 64 307 global AP ulong 128 308 global AQ ulong 128 309 global AL ulong 1 310 311 fn afcount t ulong to ulong 312 if or eq t 2 eq t 7 313 ret 2 314 end 315 if or eq t 3 eq t 4 316 ret 4 317 end 318 ret 6 319 end 320 321 fn afget t ulong i ulong to ulong 322 ret get AP add mul t 16 i 323 end 324 325 fn afq t ulong i ulong to ulong 326 ret get AQ add mul t 16 i 327 end 328 329 fn afput t ulong i ulong v ulong to void 330 put AQ add mul t 16 i v 331 end 332 333 fn affinite x ulong to bool 334 if gt x `4294967295` 335 ret false 336 end 337 ret lt and x `2147483647` `2139095040` 338 end 339 340 fn afvalidate to int 341 for t ulong 8 342 for i ulong 24 343 put ED i get AD add mul t 24 i 344 end 345 for i ulong 8 346 put ES i get AS add mul t 8 i 347 end 348 status = emcheck 349 if ne status 0 350 ret status 351 end 352 note Contiguous owned local carriers only. This does not claim strided numeric kernels. 353 if or ne get ED 1 1 ne get ED 4 0 354 ret -20 355 end 356 if or ne get ED 5 add t 1 ne get ES 5 afcount t 357 ret -20 358 end 359 rank = ulong 2 360 rows = ulong 2 361 cols = ulong 3 362 if or eq t 1 eq t 6 363 rows = 3 364 cols = 2 365 end 366 if or eq t 3 eq t 4 367 cols = 2 368 end 369 if or eq t 2 eq t 7 370 rank = 1 371 cols = 1 372 end 373 if or ne get ED 2 rank ne get ED 8 rows 374 ret -21 375 end 376 if ne get ED 16 cols 377 ret -21 378 end 379 if eq rank 2 380 if or ne get ED 9 cols ne get ED 17 1 381 ret -21 382 end 383 end 384 end 385 ret 0 386 end 387 388 fn afstep lr ulong to int 389 status = afvalidate 390 if ne status 0 391 ret status 392 end 393 if not affinite lr 394 ret -22 395 end 396 if ne and lr `2147483648` 0 397 ret -22 398 end 399 for t ulong 4 400 for i ulong afcount t 401 if not affinite afget t i 402 ret -22 403 end 404 end 405 end 406 for i ulong 128 407 put AQ i 0 408 end 409 loss = ulong 0 410 for row ulong 2 411 for col ulong 2 412 v = afget 2 col 413 for k ulong 3 414 x = afget 0 add mul row 3 k 415 w = afget 1 add mul k 2 col 416 v = add32 v mul32 x w 417 end 418 pos = add mul row 2 col 419 afput 4 pos v 420 r = add32 v xor afget 3 pos `2147483648` 421 loss = add32 loss mul32 r r 422 g = mul32 `1073741824` r 423 afput 7 col add32 afq 7 col g 424 for k ulong 3 425 xp = add mul row 3 k 426 wp = add mul k 2 col 427 gx = mul32 g afget 1 wp 428 gw = mul32 g afget 0 xp 429 afput 5 xp add32 afq 5 xp gx 430 afput 6 wp add32 afq 6 wp gw 431 end 432 end 433 end 434 note Commit only after all finite-result checks; rejected steps preserve AP and AL. 435 for i ulong 6 436 delta = mul32 lr afq 6 i 437 afput 1 i add32 afget 1 i delta 438 end 439 for i ulong 2 440 delta = mul32 lr afq 7 i 441 afput 2 i add32 afget 2 i xor delta `2147483648` 442 end 443 if not affinite loss 444 ret -23 445 end 446 for t ulong 8 447 if and ne t 0 ne t 3 448 for i ulong afcount t 449 if not affinite afq t i 450 ret -23 451 end 452 end 453 end 454 end 455 for t ulong 8 456 if and ne t 0 ne t 3 457 for i ulong afcount t 458 put AP add mul t 16 i afq t i 459 end 460 end 461 end 462 put AL 0 loss 463 ret 0 464 end 465 note Independent Architecture303 reviewer. Literal symbolic oracle and central differences. 466 note No imported author test helper, expected arithmetic, or generated product source. 467 global BI ulong 14 468 global PI ulong 14 469 global MI ulong 14 470 global PL ulong 14 471 global ML ulong 14 472 global GI ulong 14 473 global DL ulong 14 474 global OLD ulong 129 475 global NC ulong 1 476 global DIG uchar 24 477 text OK "INDEPENDENT_AFFINE_PASS checks=" 478 text BAD "INDEPENDENT_AFFINE_FAIL check=" 479 text EOL "\n" 480 481 fn dec n ulong to void 482 p = ulong 24 483 while gt n 0 bound 24 484 p = sub p 1 485 put DIG p uchar add 48 rem n 10 486 n = div n 10 487 end 488 w = write 1 DIG p sub 24 p 489 end 490 491 fn chk value bool to void 492 put NC 0 add get NC 0 1 493 if not value 494 w = write 1 BAD 0 len BAD 495 dec get NC 0 496 w = write 1 EOL 0 1 497 exit 1 498 end 499 end 500 501 fn tables to void 502 note Decimal IEEE bitwords from independently evaluated symbolic polynomials. 503 put BI 0 `1065353216` 504 put BI 1 `3221225472` 505 put BI 2 `1077936128` 506 put BI 3 `1073741824` 507 put BI 4 0 508 put BI 5 `3212836864` 509 put BI 6 `1056964608` 510 put BI 7 `3196059648` 511 put BI 8 `1065353216` 512 put BI 9 `1061158912` 513 put BI 10 `3204448256` 514 put BI 11 `1073741824` 515 put BI 12 `1040187392` 516 put BI 13 `3204448256` 517 put PI 0 `1066401792` 518 put PI 1 `3220176896` 519 put PI 2 `1078460416` 520 put PI 3 `1074266112` 521 put PI 4 `1040187392` 522 put PI 5 `3210739712` 523 put PI 6 `1059061760` 524 put PI 7 `3187671040` 525 put PI 8 `1066401792` 526 put PI 9 `1063256064` 527 put PI 10 `3200253952` 528 put PI 11 `1074266112` 529 put PI 12 `1048576000` 530 put PI 13 `3200253952` 531 put MI 0 `1063256064` 532 put MI 1 `3221749760` 533 put MI 2 `1077411840` 534 put MI 3 `1072693248` 535 put MI 4 `3187671040` 536 put MI 5 `3213885440` 537 put MI 6 `1052770304` 538 put MI 7 `3200253952` 539 put MI 8 `1063256064` 540 put MI 9 `1059061760` 541 put MI 10 `3206545408` 542 put MI 11 `1072693248` 543 put MI 12 0 544 put MI 13 `3206545408` 545 put GI 0 `3230662656` 546 put GI 1 `3221749760` 547 put GI 2 `1096941568` 548 put GI 3 `1082916864` 549 put GI 4 0 550 put GI 5 `3246718976` 551 put GI 6 `1082654720` 552 put GI 7 `3238526976` 553 put GI 8 `1095237632` 554 put GI 9 `3241148416` 555 put GI 10 `3250585600` 556 put GI 11 `1102839808` 557 put GI 12 `3212836864` 558 put GI 13 `3217031168` 559 put PL 0 `1108321536` 560 put PL 1 `1108404480` 561 put PL 2 `1108947968` 562 put PL 3 `1108612352` 563 put PL 4 `1108474112` 564 put PL 5 `1107940352` 565 put PL 6 `1108627456` 566 put PL 7 `1108209664` 567 put PL 8 `1108893696` 568 put PL 9 `1108123648` 569 put PL 10 `1107722240` 570 put PL 11 `1109278720` 571 put PL 12 `1108443136` 572 put PL 13 `1108426752` 573 put ML 0 `1108616448` 574 put ML 1 `1108543744` 575 put ML 2 `1108022272` 576 put ML 3 `1108325632` 577 put ML 4 `1108474112` 578 put ML 5 `1109029888` 579 put ML 6 `1108348928` 580 put ML 7 `1108766720` 581 put ML 8 `1108074496` 582 put ML 9 `1108844544` 583 put ML 10 `1109295104` 584 put ML 11 `1107738624` 585 put ML 12 `1108508672` 586 put ML 13 `1108525056` 587 put DL 0 `3213885440` 588 put DL 1 `3204972544` 589 put DL 2 `1080164352` 590 put DL 3 `1066139648` 591 put DL 4 0 592 put DL 5 `3229941760` 593 put DL 6 `1065877504` 594 put DL 7 `3221749760` 595 put DL 8 `1078460416` 596 put DL 9 `3224371200` 597 put DL 10 `3233808384` 598 put DL 11 `1086062592` 599 put DL 12 `3196059648` 600 put DL 13 `3200253952` 601 end 602 603 fn loc p ulong to ulong 604 if lt p 6 605 ret p 606 end 607 if lt p 12 608 ret add p 10 609 end 610 ret add p 20 611 end 612 613 fn dim t ulong rank ulong a ulong b ulong to void 614 d = mul t 24 615 s = mul t 8 616 n = mul a b 617 put AD d 1 618 put AD add d 1 1 619 put AD add d 2 rank 620 put AD add d 3 n 621 put AD add d 5 add t 1 622 put AD add d 6 add t 9 623 put AD add d 8 a 624 put AD add d 16 b 625 if eq rank 2 626 put AD add d 9 b 627 put AD add d 17 1 628 end 629 put AS s 1 630 put AS add s 2 add t 1 631 put AS add s 3 add t 9 632 put AS add s 4 1 633 put AS add s 5 n 634 end 635 636 fn init to void 637 for i ulong 192 638 put AD i 0 639 end 640 for i ulong 64 641 put AS i 0 642 end 643 for i ulong 128 644 put AP i `2143289344` 645 end 646 put AL 0 `1092616192` 647 dim 0 2 2 3 648 dim 1 2 3 2 649 dim 2 1 2 1 650 dim 3 2 2 2 651 dim 4 2 2 2 652 dim 5 2 2 3 653 dim 6 2 3 2 654 dim 7 1 2 1 655 for p ulong 14 656 put AP loc p get BI p 657 end 658 put AP 48 `1048576000` 659 put AP 49 `1065353216` 660 put AP 50 `3212836864` 661 put AP 51 `1056964608` 662 end 663 664 fn freeze to void 665 for i ulong 128 666 put OLD i get AP i 667 end 668 put OLD 128 get AL 0 669 end 670 671 fn same to void 672 for i ulong 128 673 chk eq get OLD i get AP i 674 end 675 chk eq get OLD 128 get AL 0 676 end 677 678 fn grads to void 679 for i ulong 6 680 chk eq get AP add 80 i get GI i 681 chk eq get AP add 96 i get GI add i 6 682 end 683 chk eq get AP 112 get GI 12 684 chk eq get AP 113 get GI 13 685 end 686 687 fn one to void 688 init 689 chk eq afstep `1023410176` 0 690 chk eq get AP 64 `3224895488` 691 chk eq get AP 65 `1081081856` 692 chk eq get AP 66 `1070596096` 693 chk eq get AP 67 `3225419776` 694 chk eq get AL 0 `1108467712` 695 grads 696 chk eq get AP 16 `1052508160` 697 chk eq get AP 17 `1015021568` 698 chk eq get AP 18 `1058799616` 699 chk eq get AP 19 `1066139648` 700 chk eq get AP 20 `1048576000` 701 chk eq get AP 21 `1067581440` 702 chk eq get AP 32 `1042284544` 703 chk eq get AP 33 `3202875392` 704 for i ulong 6 705 chk eq get AP i get BI i 706 end 707 chk eq get AP 48 `1048576000` 708 chk eq get AP 49 `1065353216` 709 chk eq get AP 50 `3212836864` 710 chk eq get AP 51 `1056964608` 711 note Non-tensor padding must remain unchanged by the fixed-slot commit. 712 for t ulong 8 713 chk eq get AP add mul t 16 15 `2143289344` 714 end 715 end 716 717 fn central to void 718 for p ulong 14 719 init 720 put AP loc p get PI p 721 chk eq afstep 0 0 722 hi = get AL 0 723 chk eq hi get PL p 724 init 725 put AP loc p get MI p 726 chk eq afstep 0 0 727 lo = get AL 0 728 chk eq lo get ML p 729 note Expected loss difference is a literal from symbolic exact arithmetic. 730 chk eq add32 hi xor lo `2147483648` get DL p 731 end 732 init 733 chk eq afstep 0 0 734 grads 735 freeze 736 chk eq afstep 0 0 737 same 738 end 739 740 fn reject to void 741 init 742 put AD 8 3 743 put AD 9 2 744 put AD 16 2 745 freeze 746 chk eq afstep 0 -21 747 same 748 init 749 put AD 6 0 750 freeze 751 chk eq afstep 0 -5 752 same 753 init 754 put AS 3 10 755 freeze 756 chk eq afstep 0 -5 757 same 758 init 759 freeze 760 chk eq afstep `2147483648` -22 761 same 762 init 763 put AP 17 `2143289344` 764 freeze 765 chk eq afstep 0 -22 766 same 767 init 768 put AP 0 `2139095039` 769 put AP 16 `2139095039` 770 freeze 771 chk eq afstep 0 -23 772 same 773 end 774 775 fn main to int 776 tables 777 one 778 central 779 reject 780 w = write 1 OK 0 len OK 781 dec get NC 0 782 w = write 1 EOL 0 1 783 ret 0 784 end