interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / seed / build / phase0.om

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