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/native/omegese45/translate/rep2en.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 / native / omegese45 / translate / rep2en.om` 625 lines ยท 11536 bytes Raw Blame History 1 note SPDX-License-Identifier: AGPL-3.0-only 2 note rep2en: goal G + model report P + runtime facts.tsv -> fixed-template 3 note English built only from the runtime facts. Success is printed only when 4 note every job of G has, as its last facts row, class ok and exit 0, and P 5 note agrees with G and with the facts. A P that contradicts the facts gives 6 note `G2E_CONTRADICT ` and 30; an invalid input `G2E_INVALID ` 7 note and 31. Facts follow interface v1.2 section 5: exact header line, exit 8 note to class/code map, ok rows with mjr1_outcome 1 and a P-256 compressed 9 note verifier key, and a legal job/attempt history (otfrows, othist). 10 note Needs otio.om, vocab.om, msg.om, otmsg.om before it and otfrag.om 11 note after it. Templates are documented in TRANSLATOR.md. 12 text otfr "Completed and verified: one matmul_u32 job multiplying a | by | matrix by a | matrix with seed |; job | dag_id | mjr1_sha256 |.\n|Completed and verified: two matmul_u32 jobs, each multiplying a | matrix, with seeds | and |Not completed: refused before dispatch (code bound): the goal asks for a | matmul and a dimension is outside the admitted range 1 to 256; nothing was dispatched.\n|Not completed: job | was refused (code | failed (code |): |G2E_CONTRADICT |G2E_INVALID |usage: rep2en FACTS_TSV < goal-and-report\n|the worker refused a replay of an already executed job|the job was refused for budget or fuel|the worker refused the job|the connection to the worker failed|the verifier refused the worker receipt|the verifier recompute failed|the recomputed result did not match the worker result|a local input or output error occurred|goal |report |facts\n|input\n|operands\n|jobs\n|class\n|code\n|dispatch\n|bound\n" 13 text othdt "job\tattempt\tm\tk\tn\tseed\texit\tclass\tcode\tdag_id\tmjr1_sha256\tmjr1_outcome\tverifier\n" 14 15 const OTFMAX ulong 65536 16 const OTRMAX ulong 64 17 note facts.tsv bytes, row field offsets/lengths (13 per row), row values 18 note (job attempt m k n seed exit class code; class 1 ok 2 refused 3 fail; 19 note code = vocabulary id 14..21 or 0 for `-`). 20 global otfb uchar 65536 21 global otfo ulong 832 22 global otfl ulong 832 23 global otrv ulong 576 24 global otnr ulong 1 25 global otpath uchar 4096 26 note Goal: kind (6 mm, 7 pair), m, k, n, s, t. Report: outcome id (10 ok, 27 note 11 refused, 12 fail), kind, m, k, n, s, t, code id. 28 global otg ulong 6 29 global otp ulong 8 30 31 note Field f of facts row r equals the vocabulary word id. 32 fn otfeqw r ulong f ulong id ulong to bool 33 ocvinit 34 x = add mul r 13 f 35 o = get otfo x 36 l = get otfl x 37 if ne l get ocwl id 38 ret false 39 end 40 w = get ocwo id 41 for i ulong l 42 if ne get otfb add o i get ocvtsv add w i 43 ret false 44 end 45 end 46 ret true 47 end 48 49 note Field is exactly `-`. 50 fn otfdash r ulong f ulong to bool 51 x = add mul r 13 f 52 if ne get otfl x 1 53 ret false 54 end 55 ret eq get otfb get otfo x 45 56 end 57 58 note Field is n lowercase hex digits. 59 fn otfhex r ulong f ulong n ulong to bool 60 x = add mul r 13 f 61 if ne get otfl x n 62 ret false 63 end 64 o = get otfo x 65 for i ulong n 66 c = get otfb add o i 67 ok = or and ge c 48 le c 57 and ge c 97 le c 102 68 if not ok 69 ret false 70 end 71 end 72 ret true 73 end 74 75 note Field is 64 lowercase hex digits or exactly `-`. 76 fn otfhod r ulong f ulong to bool 77 if otfdash r f 78 ret true 79 end 80 ret otfhex r f 64 81 end 82 83 note Field is exactly `1` (MJR1 outcome byte 1, completed). 84 fn otfone r ulong f ulong to bool 85 x = add mul r 13 f 86 if ne get otfl x 1 87 ret false 88 end 89 ret eq get otfb get otfo x 49 90 end 91 92 note Field is a P-256 compressed public key: 66 lowercase hex digits 93 note starting `02` or `03`. 94 fn otfkey r ulong f ulong to bool 95 if not otfhex r f 66 96 ret false 97 end 98 o = get otfo add mul r 13 f 99 if ne get otfb o 48 100 ret false 101 end 102 c = get otfb add o 1 103 ret or eq c 50 eq c 51 104 end 105 106 note Decimal value of field f of row r; OTBAD2 when not 1..9 digits. 107 const OTBAD2 ulong `1099511627776` 108 fn otfnum r ulong f ulong to ulong 109 x = add mul r 13 f 110 o = get otfo x 111 l = get otfl x 112 if or eq l 0 gt l 9 113 ret OTBAD2 114 end 115 v = ulong 0 116 for i ulong l 117 c = get otfb add o i 118 if or lt c 48 gt c 57 119 ret OTBAD2 120 end 121 v = add mul v 10 ulong sub c 48 122 end 123 ret v 124 end 125 126 note Append field f of row r. 127 fn otpfld r ulong f ulong to void 128 x = add mul r 13 f 129 o = get otfo x 130 for i ulong get otfl x 131 otpb get otfb add o i 132 end 133 end 134 135 note otfb[0, n) starts with the exact header line othdt. 136 fn othdrok n ulong to bool 137 h = len othdt 138 if lt n h 139 ret false 140 end 141 for i ulong h 142 if ne get otfb i get othdt i 143 ret false 144 end 145 end 146 ret true 147 end 148 149 note Split otfb[h, n), h = the header length, into rows of 13 150 note TAB-separated fields. False when a row is malformed, a line is empty 151 note (other than the final newline), or there are more than OTRMAX rows. 152 fn otfsplit n ulong to bool 153 put otnr 0 0 154 r = ulong 0 155 f = ulong 0 156 p = len othdt 157 b = p 158 while le p n bound 65537 159 c = uchar 10 160 if lt p n 161 c = get otfb p 162 end 163 if or eq c 9 eq c 10 164 if eq c 10 165 if and eq p b eq f 0 166 if lt p n 167 ret false 168 end 169 p = add p 1 170 continue 171 end 172 end 173 if ge r OTRMAX 174 ret false 175 end 176 if ge f 13 177 ret false 178 end 179 x = add mul r 13 f 180 put otfo x b 181 put otfl x sub p b 182 f = add f 1 183 b = add p 1 184 if eq c 10 185 if ne f 13 186 ret false 187 end 188 r = add r 1 189 f = 0 190 end 191 end 192 p = add p 1 193 end 194 if ne f 0 195 ret false 196 end 197 put otnr 0 r 198 ret true 199 end 200 201 note Decode and check each row's values into otrv (9 per row). False on a 202 note row that is not a well-formed facts row (see TRANSLATOR.md). 203 fn otfrows to bool 204 for r ulong get otnr 0 205 v = mul r 9 206 for f ulong 7 207 x = otfnum r f 208 if eq x OTBAD2 209 ret false 210 end 211 put otrv add v f x 212 end 213 cl = ulong 0 214 if otfeqw r 7 10 215 cl = 1 216 end 217 if otfeqw r 7 11 218 cl = 2 219 end 220 if otfeqw r 7 12 221 cl = 3 222 end 223 if eq cl 0 224 ret false 225 end 226 put otrv add v 7 cl 227 cd = ulong 0 228 if not otfdash r 8 229 for id ulong 8 230 if otfeqw r 8 add id 14 231 cd = add id 14 232 end 233 end 234 if eq cd 0 235 ret false 236 end 237 end 238 put otrv add v 8 cd 239 ex = get otrv add v 6 240 if eq cl 1 241 if or ne ex 0 ne cd 0 242 ret false 243 end 244 if not and otfhex r 9 64 otfhex r 10 64 245 ret false 246 end 247 if not otfone r 11 248 ret false 249 end 250 if not otfkey r 12 251 ret false 252 end 253 else 254 if eq cd 0 255 ret false 256 end 257 if not and otfdash r 11 otfdash r 12 258 ret false 259 end 260 note A non-ok row may carry a real dag_id or a receipt digest: each is 261 note 64 lowercase hex or `-` (interface v1.2 section 5). 262 if not and otfhod r 9 otfhod r 10 263 ret false 264 end 265 note Code -> class and exit (interface v1.2 section 5): replay, budget, 266 note worker (ids 14..16) are refused with exit 11; transport (17) fails 267 note with exit 10; receipt, recomp, verdict, io (18..21) fail with 12..15. 268 wc = ulong 3 269 wx = sub cd 6 270 if le cd 16 271 wc = 2 272 wx = 11 273 end 274 if eq cd 17 275 wx = 10 276 end 277 if ne cl wc 278 ret false 279 end 280 if ne ex wx 281 ret false 282 end 283 end 284 end 285 ret true 286 end 287 288 fn otrval r ulong f ulong to ulong 289 ret get otrv add mul r 9 f 290 end 291 292 note Job/attempt history (interface v1.2 section 5). Jobs appear in order 293 note starting at 1, each with attempt 1 first. A second row for the same 294 note job is legal only as attempt 2 right after an attempt-1 `fail 295 note transport`. A row for the next job is legal only after the previous 296 note job's last row was ok. So nothing follows a job's ok row, every 297 note non-ok row other than one retried transport failure is the last row, 298 note and every attempt is 1 or 2, increasing within a job. 299 note pt: the previous row was an attempt-1 `fail transport`; pk: it was ok. 300 fn othist to bool 301 pj = ulong 0 302 pt = false 303 pk = false 304 for r ulong get otnr 0 305 j = otrval r 0 306 a = otrval r 1 307 if eq j pj 308 if not and eq a 2 pt 309 ret false 310 end 311 else 312 if not and eq j add pj 1 eq a 1 313 ret false 314 end 315 if and gt pj 0 not pk 316 ret false 317 end 318 end 319 c7 = otrval r 7 320 c8 = otrval r 8 321 pj = j 322 pt = and eq a 1 and eq c7 3 eq c8 17 323 pk = eq c7 1 324 end 325 ret true 326 end 327 328 note Row r states the goal dims and seed sd. 329 fn otrowok r ulong sd ulong to bool 330 if ne otrval r 2 get otg 1 331 ret false 332 end 333 if ne otrval r 3 get otg 2 334 ret false 335 end 336 if ne otrval r 4 get otg 3 337 ret false 338 end 339 ret eq otrval r 5 sd 340 end 341 342 note Emit `G2E_CONTRADICT ` (fragment fw) and return 30. 343 fn otcontra fw ulong to int 344 put otol 0 0 345 otpfr 17 346 otpfr fw 347 ret 30 348 end 349 350 note Emit `G2E_INVALID ` and return 31. 351 fn otinval fw ulong to int 352 put otol 0 0 353 otpfr 18 354 otpfr fw 355 ret 31 356 end 357 358 fn otrdims to void 359 otpdec get otg 1 360 otpfr 1 361 otpdec get otg 2 362 otpfr 2 363 otpdec get otg 2 364 otpfr 1 365 otpdec get otg 3 366 end 367 368 note Index of the last facts row of job j, or OTRMAX when there is none. 369 fn otlast j ulong to ulong 370 x = OTRMAX 371 for r ulong get otnr 0 372 if eq otrval r 0 j 373 x = r 374 end 375 end 376 ret x 377 end 378 379 note "; job {j} dag_id {dag} mjr1_sha256 {sha}" 380 fn otpjob j ulong r ulong to void 381 otpfr 4 382 otpdec j 383 otpfr 5 384 otpfld r 9 385 otpfr 6 386 otpfld r 10 387 end 388 389 note Read the facts file named by argument 1 into otfb. Returns the byte 390 note count or -1. 391 fn otrdfacts to long 392 an = argread 1 otpath 0 4096 393 if le an 0 394 ret neg long 1 395 end 396 fd = fopen otpath 0 ulong an 0 0 397 if lt fd 0 398 ret neg long 1 399 end 400 n = ulong 0 401 while true bound 65537 402 if ge n OTFMAX 403 ret neg long 1 404 end 405 k = read int fd otfb n sub OTFMAX n 406 if lt k 0 407 ret neg long 1 408 end 409 if eq k 0 410 break 411 end 412 n = add n ulong k 413 end 414 c = fclose int fd 415 ret long n 416 end 417 418 note rep2en on otin[0, n): first line G, second line P. Returns the exit 419 note code with otob holding the English sentence or the typed line. 420 fn otrepen n ulong to int 421 note Split stdin into two lines. 422 e1 = n 423 for i ulong n 424 if eq get otin i 10 425 e1 = i 426 break 427 end 428 end 429 if ge e1 n 430 ret otinval 31 431 end 432 s2 = add e1 1 433 e2 = n 434 if gt e2 s2 435 if eq get otin sub e2 1 10 436 e2 = sub e2 1 437 end 438 end 439 if le e2 s2 440 ret otinval 31 441 end 442 note Goal. 443 if not otcopy 0 e1 444 ret otinval 31 445 end 446 v = ocsetgl e1 447 if lt v 0 448 put otol 0 0 449 otpfr 18 450 otpfr 28 451 otprs v 452 otpb 10 453 ret 31 454 end 455 for i ulong 6 456 put otg i get ocgv i 457 end 458 note Report. 459 if not otcopy s2 sub e2 s2 460 ret otinval 31 461 end 462 v = ocvline sub e2 s2 4 463 if lt v 0 464 put otol 0 0 465 otpfr 18 466 otpfr 29 467 otprs v 468 otpb 10 469 ret 31 470 end 471 oc = get ocids 1 472 put otp 0 oc 473 if eq oc 10 474 put otp 1 get ocids 2 475 put otp 2 ochexv 3 3 476 put otp 3 ochexv 8 3 477 put otp 4 ochexv 13 3 478 put otp 5 ochexv 18 4 479 put otp 6 0 480 if eq get ocids 2 7 481 put otp 6 ochexv 24 4 482 end 483 else 484 put otp 7 get ocids 2 485 end 486 note Facts. 487 fl = otrdfacts 488 if lt fl 0 489 ret otinval 30 490 end 491 if not othdrok ulong fl 492 ret otinval 30 493 end 494 if not otfsplit ulong fl 495 ret otinval 30 496 end 497 if not otfrows 498 ret otinval 30 499 end 500 if not othist 501 ret otinval 30 502 end 503 nj = ulong 1 504 if eq get otg 0 7 505 nj = 2 506 end 507 note P operands against G. 508 if eq oc 10 509 same = true 510 for i ulong 5 511 if ne get otp add i 1 get otg i 512 same = false 513 end 514 end 515 if eq nj 2 516 if ne get otp 6 get otg 5 517 same = false 518 end 519 end 520 if not same 521 ret otcontra 32 522 end 523 end 524 note Every facts row against G. 525 nr = get otnr 0 526 for r ulong nr 527 j = otrval r 0 528 if or lt j 1 gt j nj 529 ret otcontra 33 530 end 531 sd = get otg 4 532 if eq j 2 533 sd = get otg 5 534 end 535 same = otrowok r sd 536 if not same 537 ret otcontra 32 538 end 539 end 540 if eq oc 10 541 note Success needs the last row of every job to be class ok, exit 0. 542 for jj ulong nj 543 r = otlast add jj 1 544 if eq r OTRMAX 545 ret otcontra 33 546 end 547 if ne otrval r 7 1 548 ret otcontra 34 549 end 550 end 551 r1 = otlast 1 552 if eq nj 1 553 otpfr 0 554 otrdims 555 otpfr 3 556 otpdec get otg 4 557 otpjob 1 r1 558 otpfr 7 559 ret 0 560 end 561 r2 = otlast 2 562 otpfr 8 563 otrdims 564 otpfr 9 565 otpdec get otg 4 566 otpfr 10 567 otpdec get otg 5 568 otpjob 1 r1 569 otpjob 2 r2 570 otpfr 7 571 ret 0 572 end 573 cd = get otp 7 574 if eq cd 13 575 note Bound: decided before dispatch, so no facts rows and a G dim 576 note outside 1..256. 577 if gt nr 0 578 ret otcontra 37 579 end 580 adm = true 581 for i ulong 3 582 d = get otg add i 1 583 if or lt d 1 gt d 256 584 adm = false 585 end 586 end 587 if adm 588 ret otcontra 37 589 end 590 otpfr 11 591 otpdec get otg 1 592 otpfr 1 593 otpdec get otg 2 594 otpfr 1 595 otpdec get otg 3 596 otpfr 12 597 ret 0 598 end 599 if eq nr 0 600 ret otcontra 36 601 end 602 rl = sub nr 1 603 wantc = ulong 2 604 if eq oc 12 605 wantc = 3 606 end 607 if ne otrval rl 7 wantc 608 ret otcontra 34 609 end 610 if ne otrval rl 8 cd 611 ret otcontra 35 612 end 613 otpfr 13 614 otpdec otrval rl 0 615 if eq oc 11 616 otpfr 14 617 else 618 otpfr 15 619 end 620 otpword cd 621 otpfr 16 622 otpfr add 6 cd 623 otpfr 7 624 ret 0 625 end