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/mutant1-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 / mutant1-independent-unit.om` 774 lines ยท 13218 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 note MUTANT omits the dimension admission checks 374 end 375 ret 0 376 end 377 378 fn afstep lr ulong to int 379 status = afvalidate 380 if ne status 0 381 ret status 382 end 383 if not affinite lr 384 ret -22 385 end 386 if ne and lr `2147483648` 0 387 ret -22 388 end 389 for t ulong 4 390 for i ulong afcount t 391 if not affinite afget t i 392 ret -22 393 end 394 end 395 end 396 for i ulong 128 397 put AQ i 0 398 end 399 loss = ulong 0 400 for row ulong 2 401 for col ulong 2 402 v = afget 2 col 403 for k ulong 3 404 x = afget 0 add mul row 3 k 405 w = afget 1 add mul k 2 col 406 v = add32 v mul32 x w 407 end 408 pos = add mul row 2 col 409 afput 4 pos v 410 r = add32 v xor afget 3 pos `2147483648` 411 loss = add32 loss mul32 r r 412 g = mul32 `1073741824` r 413 afput 7 col add32 afq 7 col g 414 for k ulong 3 415 xp = add mul row 3 k 416 wp = add mul k 2 col 417 gx = mul32 g afget 1 wp 418 gw = mul32 g afget 0 xp 419 afput 5 xp add32 afq 5 xp gx 420 afput 6 wp add32 afq 6 wp gw 421 end 422 end 423 end 424 note Commit only after all finite-result checks; rejected steps preserve AP and AL. 425 for i ulong 6 426 delta = mul32 lr afq 6 i 427 afput 1 i add32 afget 1 i xor delta `2147483648` 428 end 429 for i ulong 2 430 delta = mul32 lr afq 7 i 431 afput 2 i add32 afget 2 i xor delta `2147483648` 432 end 433 if not affinite loss 434 ret -23 435 end 436 for t ulong 8 437 if and ne t 0 ne t 3 438 for i ulong afcount t 439 if not affinite afq t i 440 ret -23 441 end 442 end 443 end 444 end 445 for t ulong 8 446 if and ne t 0 ne t 3 447 for i ulong afcount t 448 put AP add mul t 16 i afq t i 449 end 450 end 451 end 452 put AL 0 loss 453 ret 0 454 end 455 note Independent Architecture303 reviewer. Literal symbolic oracle and central differences. 456 note No imported author test helper, expected arithmetic, or generated product source. 457 global BI ulong 14 458 global PI ulong 14 459 global MI ulong 14 460 global PL ulong 14 461 global ML ulong 14 462 global GI ulong 14 463 global DL ulong 14 464 global OLD ulong 129 465 global NC ulong 1 466 global DIG uchar 24 467 text OK "INDEPENDENT_AFFINE_PASS checks=" 468 text BAD "INDEPENDENT_AFFINE_FAIL check=" 469 text EOL "\n" 470 471 fn dec n ulong to void 472 p = ulong 24 473 while gt n 0 bound 24 474 p = sub p 1 475 put DIG p uchar add 48 rem n 10 476 n = div n 10 477 end 478 w = write 1 DIG p sub 24 p 479 end 480 481 fn chk value bool to void 482 put NC 0 add get NC 0 1 483 if not value 484 w = write 1 BAD 0 len BAD 485 dec get NC 0 486 w = write 1 EOL 0 1 487 exit 1 488 end 489 end 490 491 fn tables to void 492 note Decimal IEEE bitwords from independently evaluated symbolic polynomials. 493 put BI 0 `1065353216` 494 put BI 1 `3221225472` 495 put BI 2 `1077936128` 496 put BI 3 `1073741824` 497 put BI 4 0 498 put BI 5 `3212836864` 499 put BI 6 `1056964608` 500 put BI 7 `3196059648` 501 put BI 8 `1065353216` 502 put BI 9 `1061158912` 503 put BI 10 `3204448256` 504 put BI 11 `1073741824` 505 put BI 12 `1040187392` 506 put BI 13 `3204448256` 507 put PI 0 `1066401792` 508 put PI 1 `3220176896` 509 put PI 2 `1078460416` 510 put PI 3 `1074266112` 511 put PI 4 `1040187392` 512 put PI 5 `3210739712` 513 put PI 6 `1059061760` 514 put PI 7 `3187671040` 515 put PI 8 `1066401792` 516 put PI 9 `1063256064` 517 put PI 10 `3200253952` 518 put PI 11 `1074266112` 519 put PI 12 `1048576000` 520 put PI 13 `3200253952` 521 put MI 0 `1063256064` 522 put MI 1 `3221749760` 523 put MI 2 `1077411840` 524 put MI 3 `1072693248` 525 put MI 4 `3187671040` 526 put MI 5 `3213885440` 527 put MI 6 `1052770304` 528 put MI 7 `3200253952` 529 put MI 8 `1063256064` 530 put MI 9 `1059061760` 531 put MI 10 `3206545408` 532 put MI 11 `1072693248` 533 put MI 12 0 534 put MI 13 `3206545408` 535 put GI 0 `3230662656` 536 put GI 1 `3221749760` 537 put GI 2 `1096941568` 538 put GI 3 `1082916864` 539 put GI 4 0 540 put GI 5 `3246718976` 541 put GI 6 `1082654720` 542 put GI 7 `3238526976` 543 put GI 8 `1095237632` 544 put GI 9 `3241148416` 545 put GI 10 `3250585600` 546 put GI 11 `1102839808` 547 put GI 12 `3212836864` 548 put GI 13 `3217031168` 549 put PL 0 `1108321536` 550 put PL 1 `1108404480` 551 put PL 2 `1108947968` 552 put PL 3 `1108612352` 553 put PL 4 `1108474112` 554 put PL 5 `1107940352` 555 put PL 6 `1108627456` 556 put PL 7 `1108209664` 557 put PL 8 `1108893696` 558 put PL 9 `1108123648` 559 put PL 10 `1107722240` 560 put PL 11 `1109278720` 561 put PL 12 `1108443136` 562 put PL 13 `1108426752` 563 put ML 0 `1108616448` 564 put ML 1 `1108543744` 565 put ML 2 `1108022272` 566 put ML 3 `1108325632` 567 put ML 4 `1108474112` 568 put ML 5 `1109029888` 569 put ML 6 `1108348928` 570 put ML 7 `1108766720` 571 put ML 8 `1108074496` 572 put ML 9 `1108844544` 573 put ML 10 `1109295104` 574 put ML 11 `1107738624` 575 put ML 12 `1108508672` 576 put ML 13 `1108525056` 577 put DL 0 `3213885440` 578 put DL 1 `3204972544` 579 put DL 2 `1080164352` 580 put DL 3 `1066139648` 581 put DL 4 0 582 put DL 5 `3229941760` 583 put DL 6 `1065877504` 584 put DL 7 `3221749760` 585 put DL 8 `1078460416` 586 put DL 9 `3224371200` 587 put DL 10 `3233808384` 588 put DL 11 `1086062592` 589 put DL 12 `3196059648` 590 put DL 13 `3200253952` 591 end 592 593 fn loc p ulong to ulong 594 if lt p 6 595 ret p 596 end 597 if lt p 12 598 ret add p 10 599 end 600 ret add p 20 601 end 602 603 fn dim t ulong rank ulong a ulong b ulong to void 604 d = mul t 24 605 s = mul t 8 606 n = mul a b 607 put AD d 1 608 put AD add d 1 1 609 put AD add d 2 rank 610 put AD add d 3 n 611 put AD add d 5 add t 1 612 put AD add d 6 add t 9 613 put AD add d 8 a 614 put AD add d 16 b 615 if eq rank 2 616 put AD add d 9 b 617 put AD add d 17 1 618 end 619 put AS s 1 620 put AS add s 2 add t 1 621 put AS add s 3 add t 9 622 put AS add s 4 1 623 put AS add s 5 n 624 end 625 626 fn init to void 627 for i ulong 192 628 put AD i 0 629 end 630 for i ulong 64 631 put AS i 0 632 end 633 for i ulong 128 634 put AP i `2143289344` 635 end 636 put AL 0 `1092616192` 637 dim 0 2 2 3 638 dim 1 2 3 2 639 dim 2 1 2 1 640 dim 3 2 2 2 641 dim 4 2 2 2 642 dim 5 2 2 3 643 dim 6 2 3 2 644 dim 7 1 2 1 645 for p ulong 14 646 put AP loc p get BI p 647 end 648 put AP 48 `1048576000` 649 put AP 49 `1065353216` 650 put AP 50 `3212836864` 651 put AP 51 `1056964608` 652 end 653 654 fn freeze to void 655 for i ulong 128 656 put OLD i get AP i 657 end 658 put OLD 128 get AL 0 659 end 660 661 fn same to void 662 for i ulong 128 663 chk eq get OLD i get AP i 664 end 665 chk eq get OLD 128 get AL 0 666 end 667 668 fn grads to void 669 for i ulong 6 670 chk eq get AP add 80 i get GI i 671 chk eq get AP add 96 i get GI add i 6 672 end 673 chk eq get AP 112 get GI 12 674 chk eq get AP 113 get GI 13 675 end 676 677 fn one to void 678 init 679 chk eq afstep `1023410176` 0 680 chk eq get AP 64 `3224895488` 681 chk eq get AP 65 `1081081856` 682 chk eq get AP 66 `1070596096` 683 chk eq get AP 67 `3225419776` 684 chk eq get AL 0 `1108467712` 685 grads 686 chk eq get AP 16 `1052508160` 687 chk eq get AP 17 `1015021568` 688 chk eq get AP 18 `1058799616` 689 chk eq get AP 19 `1066139648` 690 chk eq get AP 20 `1048576000` 691 chk eq get AP 21 `1067581440` 692 chk eq get AP 32 `1042284544` 693 chk eq get AP 33 `3202875392` 694 for i ulong 6 695 chk eq get AP i get BI i 696 end 697 chk eq get AP 48 `1048576000` 698 chk eq get AP 49 `1065353216` 699 chk eq get AP 50 `3212836864` 700 chk eq get AP 51 `1056964608` 701 note Non-tensor padding must remain unchanged by the fixed-slot commit. 702 for t ulong 8 703 chk eq get AP add mul t 16 15 `2143289344` 704 end 705 end 706 707 fn central to void 708 for p ulong 14 709 init 710 put AP loc p get PI p 711 chk eq afstep 0 0 712 hi = get AL 0 713 chk eq hi get PL p 714 init 715 put AP loc p get MI p 716 chk eq afstep 0 0 717 lo = get AL 0 718 chk eq lo get ML p 719 note Expected loss difference is a literal from symbolic exact arithmetic. 720 chk eq add32 hi xor lo `2147483648` get DL p 721 end 722 init 723 chk eq afstep 0 0 724 grads 725 freeze 726 chk eq afstep 0 0 727 same 728 end 729 730 fn reject to void 731 init 732 put AD 8 3 733 put AD 9 2 734 put AD 16 2 735 freeze 736 chk eq afstep 0 -21 737 same 738 init 739 put AD 6 0 740 freeze 741 chk eq afstep 0 -5 742 same 743 init 744 put AS 3 10 745 freeze 746 chk eq afstep 0 -5 747 same 748 init 749 freeze 750 chk eq afstep `2147483648` -22 751 same 752 init 753 put AP 17 `2143289344` 754 freeze 755 chk eq afstep 0 -22 756 same 757 init 758 put AP 0 `2139095039` 759 put AP 16 `2139095039` 760 freeze 761 chk eq afstep 0 -23 762 same 763 end 764 765 fn main to int 766 tables 767 one 768 central 769 reject 770 w = write 1 OK 0 len OK 771 dec get NC 0 772 w = write 1 EOL 0 1 773 ret 0 774 end