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
omega-mv / seed / build / phase0.om
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note seed/build/phase0.om: Pure seeded-Omega Helix Phase 0 Baseline & Determinism Floor Exit Gate. |
| 3 | note One offline command (zero C, zero Rust, zero shell, zero Python on the compiler-verification path): |
| 4 | note 1. Strict self-regeneration: c(sA, A) == A twice in a row with matching SHA-256 == seed/out/omc.sha256 |
| 5 | note 2. Full 4-rung birth (om-birth --verify) & pure-OM-2 build-closure gate (om-build-gate) |
| 6 | note 3. 78-theorem uor-gpu Lean 4 proof check (zero sorryAx, standard axioms only) + pure-OM-2 uor-gpu-gate |
| 7 | note 4. Pure-OM-2 builds & host gates for q36, inkling2, and dsv41 |
| 8 | note 5. Live GB10 silicon checks (q36-serve, inkling2-serve, inkling2-multistream, dsv41-decode) with nvrm_errors_delta = 0 |
| 9 | note Build: cat seed/build/common.om seed/build/phase0.om | seed/out/omc > build/om-phase0 |
| 10 | note Usage: om-phase0 [--host-only] [SCRATCH_DIR] |
| 11 | |
| 12 | text p0_usage "usage: om-phase0 [--host-only] [SCRATCH_DIR]\n" |
| 13 | text p0_fhost "--host-only" |
| 14 | text p0_defscr "build/helix-phase0" |
| 15 | text p0_omc "seed/out/omc" |
| 16 | text p0_omcsha "seed/out/omc.sha256" |
| 17 | text p0_omcsrc "seed/omc/omc.om" |
| 18 | text p0_com "seed/build/common.om" |
| 19 | text p0_s_bir "seed/build/birth.om" |
| 20 | text p0_s_gat "seed/build/gate.om" |
| 21 | text p0_s_gpu "seed/build/gpucoord.om" |
| 22 | text p0_lean_f "protocol/uor-gpu/proofs/UorGpuWorld.lean" |
| 23 | text p0_lean_pin "4242bcf69741fc3064f67083694e0e09f969eb4cc9ed4369d96154dc02a7238a" |
| 24 | text p0_bad_s1 "uses 'sorry'" |
| 25 | text p0_bad_s4 "[sorryAx" |
| 26 | text p0_bad_s5 " sorryAx" |
| 27 | text p0_bad_s2 "ofReduceBool" |
| 28 | text p0_bad_s3 "trustCompiler" |
| 29 | text p0_env_lean "LEAN" |
| 30 | text p0_env_home "HOME" |
| 31 | text p0_elan_suf "/.elan/bin/lean" |
| 32 | text p0_usr_lean "/usr/bin/lean" |
| 33 | text p0_sens_suf "/yardsticks/sensors" |
| 34 | text p0_csv_ext ".csv" |
| 35 | text p0_fver "--verify" |
| 36 | text p0_fsel "--self-test" |
| 37 | text p0_bq36 "build-q36" |
| 38 | text p0_bink "build-inkling2" |
| 39 | text p0_bdsv "build-dsv41" |
| 40 | text p0_om2 "si/directives/om2.om" |
| 41 | text p0_u_sha2 "om/tls/sha2.om" |
| 42 | text p0_u_b3 "protocol/uor-gpu/b3_uor.om" |
| 43 | text p0_u_s512 "protocol/omnet/om/sha512/sha512.om" |
| 44 | text p0_u_ed "protocol/omnet/om/ed25519/ed25519.om" |
| 45 | text p0_u_can "protocol/uor-gpu/canonical.om" |
| 46 | text p0_u_pvm "protocol/uor-gpu/payload_vm.om" |
| 47 | text p0_u_ver "protocol/uor-gpu/verify.om" |
| 48 | text p0_u_gat "protocol/uor-gpu/gate.om" |
| 49 | text p0_u_em "protocol/uor-gpu/emit_kernels.om" |
| 50 | text p0_u_eds "protocol/uor-gpu/ed_sign.om" |
| 51 | text p0_u_ug "protocol/uor-gpu/uor-gpu-gate.om" |
| 52 | text p0_dsv_t "/tmp/dsv41-m1-gate1-f7d3e9ee1/out/tensors.bin" |
| 53 | text p0_dsv_s "/tmp/dsv41-m1-sidecars" |
| 54 | text p0_dsv_s1 "/tmp/dsv41-m1-sidecars/engram1.bin" |
| 55 | text p0_dsv_map "om/gpu/dsv41/decoder/engram-token-map.u32" |
| 56 | text p0_dsv_msuf "/models/deepseek-v4.1-flash-314113f8" |
| 57 | text p0_dsv_l0 "layer0" |
| 58 | text p0_dsv_tok "1234" |
| 59 | text p0_p_r1 "/omc_regen1" |
| 60 | text p0_p_r2 "/omc_regen2" |
| 61 | text p0_p_src "/unit.om" |
| 62 | text p0_p_bir "/om-birth" |
| 63 | text p0_p_bw "/birth-w" |
| 64 | text p0_p_gat "/om-build-gate" |
| 65 | text p0_p_gw "/gate-w" |
| 66 | text p0_p_gpu "/om-gpucoord" |
| 67 | text p0_p_leano "/lean.out" |
| 68 | text p0_p_ug "/uor-gpu-gate" |
| 69 | text p0_p_q36 "/q36" |
| 70 | text p0_p_ink "/inkling2" |
| 71 | text p0_p_dsv "/dsv41" |
| 72 | text p0_p_q36s "/q36/q36-serve" |
| 73 | text p0_p_inks "/inkling2/inkling2-serve" |
| 74 | text p0_p_inkm "/inkling2/inkling2-multistream" |
| 75 | text p0_p_inka "/inkling2/check-arboris" |
| 76 | text p0_p_inkc "/inkling2/check-ms-server" |
| 77 | text p0_p_dsvs "/dsv41/check-swa-replay" |
| 78 | text p0_p_dsvd "/dsv41/dsv41-decode" |
| 79 | text p0_p_dsvo "/dsv41-layer0.bin" |
| 80 | text p0_m_ok_rg "PASS self-regen-2x omc=" |
| 81 | text p0_m_ok_bc "PASS build-closure\n" |
| 82 | text p0_m_ok_ln "PASS uor-gpu-lean4 theorems=78 sha256=" |
| 83 | text p0_m_ok_ug "PASS uor-gpu-gate P3\n" |
| 84 | text p0_m_ok_gp "PASS gpu-packages-host q36+inkling2+dsv41\n" |
| 85 | text p0_m_ok_si "PASS silicon q36-serve+inkling2+dsv41 nvrm_errors_delta=0\n" |
| 86 | text p0_m_sum1 "HELIX-PHASE0 PASS omc=" |
| 87 | text p0_m_sum2 " uor_lean=" |
| 88 | text p0_m_sum3 " theorems=78 nvrm_errors_delta=0\n" |
| 89 | text p0_m_sumh " theorems=78 hardware=HOST_ONLY\n" |
| 90 | text p0_m_fail "FAIL phase0: " |
| 91 | text p0_e_pin "seed/out/omc does not match seed/out/omc.sha256\n" |
| 92 | text p0_e_r1 "regen1 compile or SHA-256 mismatch\n" |
| 93 | text p0_e_r2 "regen2 compile or SHA-256 mismatch\n" |
| 94 | text p0_e_bir "om-birth --verify failed\n" |
| 95 | text p0_e_gat "om-build-gate failed\n" |
| 96 | text p0_e_lpin "UorGpuWorld.lean SHA-256 mismatch\n" |
| 97 | text p0_e_lrun "lean UorGpuWorld.lean failed or used forbidden axiom\n" |
| 98 | text p0_e_ug "uor-gpu-gate failed\n" |
| 99 | text p0_e_gp "gpucoord build or host check failed\n" |
| 100 | text p0_e_q36 "q36-serve --self-test failed\n" |
| 101 | text p0_e_inks "inkling2-serve --self-test failed\n" |
| 102 | text p0_e_inkm "inkling2-multistream failed\n" |
| 103 | text p0_e_dsv "dsv41-decode layer0 failed\n" |
| 104 | text p0_e_nvrm "nvrm_errors_delta != 0\n" |
| 105 | |
| 106 | global p0_scr uchar 4096 |
| 107 | global p0_scrl ulong 1 |
| 108 | global p0_host ulong 1 |
| 109 | global p0_pin uchar 64 |
| 110 | global p0_lean uchar 4096 |
| 111 | global p0_leanl ulong 1 |
| 112 | global p0_best uchar 256 |
| 113 | global p0_bestl ulong 1 |
| 114 | |
| 115 | fn p0_sp suf view uchar * to void |
| 116 | cb_pa_clr |
| 117 | for i ulong get p0_scrl 0 bound 4096 |
| 118 | cb_pa_ch get p0_scr i |
| 119 | end |
| 120 | cb_pa_tx suf |
| 121 | end |
| 122 | |
| 123 | fn p0_spb suf view uchar * to void |
| 124 | cb_pb_clr |
| 125 | for i ulong get p0_scrl 0 bound 4096 |
| 126 | cb_pb_ch get p0_scr i |
| 127 | end |
| 128 | cb_pb_tx suf |
| 129 | end |
| 130 | |
| 131 | fn p0_fail msg view uchar * to int |
| 132 | cb_err p0_m_fail |
| 133 | cb_err msg |
| 134 | ret 1 |
| 135 | end |
| 136 | |
| 137 | fn p0_hex_eq_pin to bool |
| 138 | for i ulong 64 |
| 139 | if ne get cb_shex i get p0_pin i |
| 140 | ret false |
| 141 | end |
| 142 | end |
| 143 | ret true |
| 144 | end |
| 145 | |
| 146 | fn p0_hex_eq_tx t view uchar * to bool |
| 147 | for i ulong 64 |
| 148 | if ne get cb_shex i get t i |
| 149 | ret false |
| 150 | end |
| 151 | end |
| 152 | ret true |
| 153 | end |
| 154 | |
| 155 | fn p0_set_omc_pc src view uchar * to ulong |
| 156 | for i ulong len src bound 4096 |
| 157 | put cb_pc i get src i |
| 158 | end |
| 159 | ret len src |
| 160 | end |
| 161 | |
| 162 | fn p0_compile_pair s1 view uchar * s2 view uchar * dst_suf view uchar * to bool |
| 163 | cb_wb_clr |
| 164 | cb_pa_set s1 |
| 165 | if not cb_append_pa_to_wb |
| 166 | ret false |
| 167 | end |
| 168 | cb_pa_set s2 |
| 169 | if not cb_append_pa_to_wb |
| 170 | ret false |
| 171 | end |
| 172 | p0_sp p0_p_src |
| 173 | if not cb_write_wb_pa 420 |
| 174 | ret false |
| 175 | end |
| 176 | ol = p0_set_omc_pc p0_omc |
| 177 | p0_spb dst_suf |
| 178 | ret eq cb_run_omc ol 493 -1 0 |
| 179 | end |
| 180 | |
| 181 | fn p0_find_lean to bool |
| 182 | if cb_getenv p0_env_lean |
| 183 | if gt get cb_n 4 0 |
| 184 | for i ulong get cb_n 4 bound 4096 |
| 185 | put p0_lean i get cb_pb i |
| 186 | end |
| 187 | put p0_leanl 0 get cb_n 4 |
| 188 | ret true |
| 189 | end |
| 190 | end |
| 191 | if cb_getenv p0_env_home |
| 192 | if gt get cb_n 4 0 |
| 193 | cb_pa_clr |
| 194 | for i ulong get cb_n 4 bound 4096 |
| 195 | cb_pa_ch get cb_pb i |
| 196 | end |
| 197 | cb_pa_tx p0_elan_suf |
| 198 | if ge cb_file_size_pa 0 |
| 199 | for i ulong get cb_n 3 bound 4096 |
| 200 | put p0_lean i get cb_pa i |
| 201 | end |
| 202 | put p0_leanl 0 get cb_n 3 |
| 203 | ret true |
| 204 | end |
| 205 | end |
| 206 | end |
| 207 | cb_pa_set p0_usr_lean |
| 208 | if ge cb_file_size_pa 0 |
| 209 | for i ulong get cb_n 3 bound 4096 |
| 210 | put p0_lean i get cb_pa i |
| 211 | end |
| 212 | put p0_leanl 0 get cb_n 3 |
| 213 | ret true |
| 214 | end |
| 215 | ret false |
| 216 | end |
| 217 | |
| 218 | note Lexicographically compare cb_dent[ns..ns+nl) > p0_best[0..p0_bestl) |
| 219 | fn p0_name_gt ns ulong nl ulong to bool |
| 220 | bl = get p0_bestl 0 |
| 221 | if eq bl 0 |
| 222 | ret true |
| 223 | end |
| 224 | ml = nl |
| 225 | if lt bl ml |
| 226 | ml = bl |
| 227 | end |
| 228 | for i ulong ml bound 256 |
| 229 | a = get cb_dent add ns i |
| 230 | b = get p0_best i |
| 231 | if gt a b |
| 232 | ret true |
| 233 | end |
| 234 | if lt a b |
| 235 | ret false |
| 236 | end |
| 237 | end |
| 238 | ret gt nl bl |
| 239 | end |
| 240 | |
| 241 | fn p0_name_ends_csv ns ulong nl ulong to bool |
| 242 | if lt nl 5 |
| 243 | ret false |
| 244 | end |
| 245 | base = sub nl 4 |
| 246 | for i ulong 4 |
| 247 | if ne get cb_dent add ns add base i get p0_csv_ext i |
| 248 | ret false |
| 249 | end |
| 250 | end |
| 251 | ret true |
| 252 | end |
| 253 | |
| 254 | fn p0_scan_sens_buf unr ulong to void |
| 255 | pos = ulong 0 |
| 256 | while lt pos unr bound 32768 |
| 257 | b0 = ulong get cb_dent add pos 16 |
| 258 | b1 = ulong get cb_dent add pos 17 |
| 259 | reclen = add b0 mul 256 b1 |
| 260 | if eq reclen 0 |
| 261 | break |
| 262 | end |
| 263 | ns = add pos 19 |
| 264 | nl = cb_dent_nlen ns add pos reclen |
| 265 | if p0_name_ends_csv ns nl |
| 266 | if p0_name_gt ns nl |
| 267 | if le nl 256 |
| 268 | for j ulong nl bound 256 |
| 269 | put p0_best j get cb_dent add ns j |
| 270 | end |
| 271 | put p0_bestl 0 nl |
| 272 | end |
| 273 | end |
| 274 | end |
| 275 | pos = add pos reclen |
| 276 | end |
| 277 | end |
| 278 | |
| 279 | fn p0_parse_nvrm_last to ulong |
| 280 | n = get cb_n 0 |
| 281 | if eq n 0 |
| 282 | ret 0 |
| 283 | end |
| 284 | endp = n |
| 285 | while gt endp 0 |
| 286 | if ne get cb_rb sub endp 1 10 |
| 287 | break |
| 288 | end |
| 289 | endp = sub endp 1 |
| 290 | end |
| 291 | if eq endp 0 |
| 292 | ret 0 |
| 293 | end |
| 294 | st = endp |
| 295 | while gt st 0 |
| 296 | if eq get cb_rb sub st 1 10 |
| 297 | break |
| 298 | end |
| 299 | st = sub st 1 |
| 300 | end |
| 301 | commas = ulong 0 |
| 302 | val = ulong 0 |
| 303 | i = st |
| 304 | while lt i endp |
| 305 | c = get cb_rb i |
| 306 | if eq c 44 |
| 307 | commas = add commas 1 |
| 308 | else |
| 309 | if eq commas 8 |
| 310 | if and ge c 48 le c 57 |
| 311 | val = add mul val 10 sub ulong c 48 |
| 312 | end |
| 313 | end |
| 314 | end |
| 315 | i = add i 1 |
| 316 | end |
| 317 | ret val |
| 318 | end |
| 319 | |
| 320 | note Read last line col 9 (NVRM error counter) from latest $HOME/yardsticks/sensors/*.csv; returns 0 if unavailable |
| 321 | fn p0_read_nvrm_errors to ulong |
| 322 | if not cb_getenv p0_env_home |
| 323 | ret 0 |
| 324 | end |
| 325 | if eq get cb_n 4 0 |
| 326 | ret 0 |
| 327 | end |
| 328 | cb_pa_clr |
| 329 | for i ulong get cb_n 4 bound 4096 |
| 330 | cb_pa_ch get cb_pb i |
| 331 | end |
| 332 | cb_pa_tx p0_sens_suf |
| 333 | fd = fopen cb_pa 0 get cb_n 3 540672 0 |
| 334 | if lt fd 0 |
| 335 | ret 0 |
| 336 | end |
| 337 | put p0_bestl 0 0 |
| 338 | while true bound 65536 |
| 339 | nr = getdnts int fd cb_dent 0 32768 |
| 340 | if le nr 0 |
| 341 | break |
| 342 | end |
| 343 | p0_scan_sens_buf ulong nr |
| 344 | end |
| 345 | z0 = fclose int fd |
| 346 | if eq get p0_bestl 0 0 |
| 347 | ret 0 |
| 348 | end |
| 349 | cb_pa_ch 47 |
| 350 | for j ulong get p0_bestl 0 bound 256 |
| 351 | cb_pa_ch get p0_best j |
| 352 | end |
| 353 | if not cb_read_pa |
| 354 | ret 0 |
| 355 | end |
| 356 | ret p0_parse_nvrm_last |
| 357 | end |
| 358 | |
| 359 | fn p0_step_self_regen to bool |
| 360 | cb_pa_set p0_omcsha |
| 361 | if not cb_read_pa |
| 362 | ret false |
| 363 | end |
| 364 | if lt get cb_n 0 64 |
| 365 | ret false |
| 366 | end |
| 367 | for i ulong 64 |
| 368 | put p0_pin i get cb_rb i |
| 369 | end |
| 370 | cb_pa_set p0_omc |
| 371 | if not cb_sha_file_pa |
| 372 | ret false |
| 373 | end |
| 374 | if not p0_hex_eq_pin |
| 375 | ret false |
| 376 | end |
| 377 | note Regen 1: A1 = seed/out/omc < seed/omc/omc.om |
| 378 | ol = p0_set_omc_pc p0_omc |
| 379 | cb_pa_set p0_omcsrc |
| 380 | p0_spb p0_p_r1 |
| 381 | if ne cb_run_omc ol 493 -1 0 |
| 382 | ret false |
| 383 | end |
| 384 | p0_sp p0_p_r1 |
| 385 | if not cb_sha_file_pa |
| 386 | ret false |
| 387 | end |
| 388 | if not p0_hex_eq_pin |
| 389 | ret false |
| 390 | end |
| 391 | note Regen 2: A2 = A1 < seed/omc/omc.om |
| 392 | p0_sp p0_p_r1 |
| 393 | ol2 = get cb_n 3 |
| 394 | for i ulong ol2 bound 4096 |
| 395 | put cb_pc i get cb_pa i |
| 396 | end |
| 397 | cb_pa_set p0_omcsrc |
| 398 | p0_spb p0_p_r2 |
| 399 | if ne cb_run_omc ol2 493 -1 0 |
| 400 | ret false |
| 401 | end |
| 402 | p0_sp p0_p_r2 |
| 403 | if not cb_sha_file_pa |
| 404 | ret false |
| 405 | end |
| 406 | if not p0_hex_eq_pin |
| 407 | ret false |
| 408 | end |
| 409 | cb_out p0_m_ok_rg |
| 410 | cb_wbuf_hex 1 |
| 411 | cb_out cb_nl |
| 412 | ret true |
| 413 | end |
| 414 | |
| 415 | fn p0_step_uor_lean to bool |
| 416 | cb_pa_set p0_lean_f |
| 417 | if not cb_sha_file_pa |
| 418 | ret false |
| 419 | end |
| 420 | if not p0_hex_eq_tx p0_lean_pin |
| 421 | ret false |
| 422 | end |
| 423 | if not p0_find_lean |
| 424 | ret false |
| 425 | end |
| 426 | cb_av_clr |
| 427 | cb_pa_clr |
| 428 | for i ulong get p0_leanl 0 bound 4096 |
| 429 | cb_pa_ch get p0_lean i |
| 430 | end |
| 431 | cb_av_push_pa |
| 432 | cb_av_push_tx p0_lean_f |
| 433 | p0_sp p0_p_leano |
| 434 | z0 = unlink cb_pa 0 get cb_n 3 |
| 435 | fo = fopen cb_pa 0 get cb_n 3 524865 420 |
| 436 | if lt fo 0 |
| 437 | ret false |
| 438 | end |
| 439 | rc = cb_spawn_fds -1 int fo int fo false |
| 440 | if ne rc 0 |
| 441 | ret false |
| 442 | end |
| 443 | p0_sp p0_p_leano |
| 444 | if cb_file_contains_pa p0_bad_s1 |
| 445 | ret false |
| 446 | end |
| 447 | if cb_file_contains_pa p0_bad_s2 |
| 448 | ret false |
| 449 | end |
| 450 | if cb_file_contains_pa p0_bad_s3 |
| 451 | ret false |
| 452 | end |
| 453 | if cb_file_contains_pa p0_bad_s4 |
| 454 | ret false |
| 455 | end |
| 456 | if cb_file_contains_pa p0_bad_s5 |
| 457 | ret false |
| 458 | end |
| 459 | cb_out p0_m_ok_ln |
| 460 | cb_out p0_lean_pin |
| 461 | cb_out cb_nl |
| 462 | ret true |
| 463 | end |
| 464 | |
| 465 | fn p0_app_unit t view uchar * to bool |
| 466 | cb_pa_set t |
| 467 | if not cb_append_pa_to_wb |
| 468 | ret false |
| 469 | end |
| 470 | cb_wb_ch 10 |
| 471 | ret true |
| 472 | end |
| 473 | |
| 474 | fn p0_step_uor_gate to bool |
| 475 | cb_wb_clr |
| 476 | if not p0_app_unit p0_om2 |
| 477 | ret false |
| 478 | end |
| 479 | if not p0_app_unit p0_u_sha2 |
| 480 | ret false |
| 481 | end |
| 482 | if not p0_app_unit p0_u_b3 |
| 483 | ret false |
| 484 | end |
| 485 | if not p0_app_unit p0_u_s512 |
| 486 | ret false |
| 487 | end |
| 488 | if not p0_app_unit p0_u_ed |
| 489 | ret false |
| 490 | end |
| 491 | if not p0_app_unit p0_u_can |
| 492 | ret false |
| 493 | end |
| 494 | if not p0_app_unit p0_u_pvm |
| 495 | ret false |
| 496 | end |
| 497 | if not p0_app_unit p0_u_ver |
| 498 | ret false |
| 499 | end |
| 500 | if not p0_app_unit p0_u_gat |
| 501 | ret false |
| 502 | end |
| 503 | if not p0_app_unit p0_u_em |
| 504 | ret false |
| 505 | end |
| 506 | if not p0_app_unit p0_u_eds |
| 507 | ret false |
| 508 | end |
| 509 | if not p0_app_unit p0_u_ug |
| 510 | ret false |
| 511 | end |
| 512 | p0_sp p0_p_src |
| 513 | if not cb_write_wb_pa 420 |
| 514 | ret false |
| 515 | end |
| 516 | ol = p0_set_omc_pc p0_omc |
| 517 | p0_spb p0_p_ug |
| 518 | if ne cb_run_omc ol 493 -1 0 |
| 519 | ret false |
| 520 | end |
| 521 | cb_av_clr |
| 522 | p0_sp p0_p_ug |
| 523 | cb_av_push_pa |
| 524 | if ne cb_spawn_fds -1 -1 -1 false 0 |
| 525 | ret false |
| 526 | end |
| 527 | cb_out p0_m_ok_ug |
| 528 | ret true |
| 529 | end |
| 530 | |
| 531 | fn p0_run_gpucoord cmd view uchar * out_suf view uchar * to bool |
| 532 | cb_av_clr |
| 533 | p0_sp p0_p_gpu |
| 534 | cb_av_push_pa |
| 535 | cb_av_push_tx cmd |
| 536 | p0_sp out_suf |
| 537 | cb_av_push_pa |
| 538 | ret eq cb_spawn_fds -1 -1 -1 false 0 |
| 539 | end |
| 540 | |
| 541 | fn p0_run_bin bin_suf view uchar * to bool |
| 542 | cb_av_clr |
| 543 | p0_sp bin_suf |
| 544 | cb_av_push_pa |
| 545 | ret eq cb_spawn_fds -1 -1 -1 false 0 |
| 546 | end |
| 547 | |
| 548 | fn p0_run_bin_arg bin_suf view uchar * arg view uchar * to bool |
| 549 | cb_av_clr |
| 550 | p0_sp bin_suf |
| 551 | cb_av_push_pa |
| 552 | cb_av_push_tx arg |
| 553 | ret eq cb_spawn_fds -1 -1 -1 false 0 |
| 554 | end |
| 555 | |
| 556 | fn main to int |
| 557 | ac = argcnt |
| 558 | put p0_host 0 0 |
| 559 | scr_idx = ulong 0 |
| 560 | if gt ac 1 |
| 561 | if not cb_pa_arg 1 |
| 562 | cb_err p0_usage |
| 563 | ret 2 |
| 564 | end |
| 565 | if cb_pa_eq p0_fhost |
| 566 | put p0_host 0 1 |
| 567 | if gt ac 2 |
| 568 | scr_idx = 2 |
| 569 | end |
| 570 | else |
| 571 | scr_idx = 1 |
| 572 | end |
| 573 | end |
| 574 | if gt scr_idx 0 |
| 575 | if not cb_pa_arg scr_idx |
| 576 | cb_err p0_usage |
| 577 | ret 2 |
| 578 | end |
| 579 | else |
| 580 | cb_pa_set p0_defscr |
| 581 | end |
| 582 | for i ulong get cb_n 3 bound 4096 |
| 583 | put p0_scr i get cb_pa i |
| 584 | end |
| 585 | put p0_scrl 0 get cb_n 3 |
| 586 | if not cb_mkdir_p_pa |
| 587 | cb_err p0_usage |
| 588 | ret 2 |
| 589 | end |
| 590 | |
| 591 | note 1. Strict self-regeneration (c(sA, A) == A twice) |
| 592 | if not p0_step_self_regen |
| 593 | ret p0_fail p0_e_r1 |
| 594 | end |
| 595 | |
| 596 | note 2. Full 4-rung birth + pure-OM-2 coordinator gate |
| 597 | if not p0_compile_pair p0_com p0_s_bir p0_p_bir |
| 598 | ret p0_fail p0_e_bir |
| 599 | end |
| 600 | cb_av_clr |
| 601 | p0_sp p0_p_bir |
| 602 | cb_av_push_pa |
| 603 | cb_av_push_tx p0_fver |
| 604 | p0_sp p0_p_bw |
| 605 | cb_av_push_pa |
| 606 | if ne cb_spawn_fds -1 -1 -1 false 0 |
| 607 | ret p0_fail p0_e_bir |
| 608 | end |
| 609 | if not p0_compile_pair p0_com p0_s_gat p0_p_gat |
| 610 | ret p0_fail p0_e_gat |
| 611 | end |
| 612 | cb_av_clr |
| 613 | p0_sp p0_p_gat |
| 614 | cb_av_push_pa |
| 615 | p0_sp p0_p_gw |
| 616 | cb_av_push_pa |
| 617 | if ne cb_spawn_fds -1 -1 -1 false 0 |
| 618 | ret p0_fail p0_e_gat |
| 619 | end |
| 620 | cb_out p0_m_ok_bc |
| 621 | |
| 622 | note 3. 78-theorem uor-gpu Lean 4 proof + uor-gpu-gate |
| 623 | if not p0_step_uor_lean |
| 624 | ret p0_fail p0_e_lrun |
| 625 | end |
| 626 | if not p0_step_uor_gate |
| 627 | ret p0_fail p0_e_ug |
| 628 | end |
| 629 | |
| 630 | note 4. Pure-OM-2 GPU packages + host gates |
| 631 | if not p0_compile_pair p0_com p0_s_gpu p0_p_gpu |
| 632 | ret p0_fail p0_e_gp |
| 633 | end |
| 634 | if not p0_run_gpucoord p0_bq36 p0_p_q36 |
| 635 | ret p0_fail p0_e_gp |
| 636 | end |
| 637 | if not p0_run_gpucoord p0_bink p0_p_ink |
| 638 | ret p0_fail p0_e_gp |
| 639 | end |
| 640 | if not p0_run_gpucoord p0_bdsv p0_p_dsv |
| 641 | ret p0_fail p0_e_gp |
| 642 | end |
| 643 | if not p0_run_bin p0_p_inka |
| 644 | ret p0_fail p0_e_gp |
| 645 | end |
| 646 | if not p0_run_bin p0_p_inkc |
| 647 | ret p0_fail p0_e_gp |
| 648 | end |
| 649 | if not p0_run_bin p0_p_dsvs |
| 650 | ret p0_fail p0_e_gp |
| 651 | end |
| 652 | cb_out p0_m_ok_gp |
| 653 | |
| 654 | note 5. Live silicon checks (unless --host-only) |
| 655 | note Wait 10s between GPU processes so NVIDIA RM finishes freeing UVM slabs (prevents NV_ERR_NO_MEMORY). |
| 656 | if eq get p0_host 0 0 |
| 657 | e0 = p0_read_nvrm_errors |
| 658 | if not p0_run_bin_arg p0_p_q36s p0_fsel |
| 659 | ret p0_fail p0_e_q36 |
| 660 | end |
| 661 | z_s1 = sleepns 10000000000 |
| 662 | if not p0_run_bin_arg p0_p_inks p0_fsel |
| 663 | ret p0_fail p0_e_inks |
| 664 | end |
| 665 | z_s2 = sleepns 10000000000 |
| 666 | if not p0_run_bin p0_p_inkm |
| 667 | ret p0_fail p0_e_inkm |
| 668 | end |
| 669 | z_s3 = sleepns 10000000000 |
| 670 | cb_pa_set p0_dsv_t |
| 671 | if ge cb_file_size_pa 0 |
| 672 | cb_pa_set p0_dsv_s1 |
| 673 | if ge cb_file_size_pa 0 |
| 674 | if cb_getenv p0_env_home |
| 675 | cb_av_clr |
| 676 | p0_sp p0_p_dsvd |
| 677 | cb_av_push_pa |
| 678 | cb_av_push_tx p0_dsv_l0 |
| 679 | cb_av_push_tx p0_dsv_t |
| 680 | cb_av_push_tx p0_dsv_map |
| 681 | cb_av_push_tx p0_dsv_s |
| 682 | cb_pa_clr |
| 683 | for i ulong get cb_n 4 bound 4096 |
| 684 | cb_pa_ch get cb_pb i |
| 685 | end |
| 686 | cb_pa_tx p0_dsv_msuf |
| 687 | cb_av_push_pa |
| 688 | cb_av_push_tx p0_dsv_tok |
| 689 | p0_sp p0_p_dsvo |
| 690 | cb_av_push_pa |
| 691 | if ne cb_spawn_fds -1 -1 -1 false 0 |
| 692 | ret p0_fail p0_e_dsv |
| 693 | end |
| 694 | end |
| 695 | end |
| 696 | end |
| 697 | z_s4 = sleepns 3000000000 |
| 698 | e1 = p0_read_nvrm_errors |
| 699 | if ne e1 e0 |
| 700 | ret p0_fail p0_e_nvrm |
| 701 | end |
| 702 | cb_out p0_m_ok_si |
| 703 | end |
| 704 | |
| 705 | cb_out p0_m_sum1 |
| 706 | for i ulong 64 |
| 707 | put cb_shex i get p0_pin i |
| 708 | end |
| 709 | cb_wbuf_hex 1 |
| 710 | cb_out p0_m_sum2 |
| 711 | cb_out p0_lean_pin |
| 712 | if eq get p0_host 0 0 |
| 713 | cb_out p0_m_sum3 |
| 714 | else |
| 715 | cb_out p0_m_sumh |
| 716 | end |
| 717 | ret 0 |
| 718 | end |