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 / ng / live / gate_live.om

537 lines · 10543 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0
2note seed/ng/live/gate_live.om: End-to-end verification gate for Live Arboris Specialization & Self-Healing Controller.
3note Program-mode gate (no om2 line; links with target_desc.om, isel.om, sm121_pe.om, fabric.om, crystallize.om, arboris_spec.om).
4
5global glDig uchar 24
6global glChk ulong 1
7global glNeg ulong 1
8
9text glMsgHdr "=== OMEGA NG LIVE ARBORIS SPECIALIZATION & SELF-HEALING GATE ===\n"
10text glMsgTel "TELEMETRY dispatches="
11text glMsgSpec " spec_hits="
12text glMsgCoact " coact_hits="
13text glMsgRef " refusals="
14text glMsgSaved " saved_ns="
15text glMsgPass "NG-LIVE-ARBORIS-GATE PASS checks="
16text glMsgSwaps " swaps="
17text glMsgRb " rollbacks="
18text glMsgNeg " neg_controls="
19text glMsgSlash "/4\n"
20text glMsgNl "\n"
21text glMsgFail "NG-LIVE-ARBORIS-GATE FAIL at check="
22
23fn glSay id ulong to void
24if eq id 0
25w = write 1 glMsgHdr 0 len glMsgHdr
26ret
27end
28if eq id 1
29w = write 1 glMsgTel 0 len glMsgTel
30ret
31end
32if eq id 2
33w = write 1 glMsgSpec 0 len glMsgSpec
34ret
35end
36if eq id 3
37w = write 1 glMsgCoact 0 len glMsgCoact
38ret
39end
40if eq id 4
41w = write 1 glMsgRef 0 len glMsgRef
42ret
43end
44if eq id 5
45w = write 1 glMsgSaved 0 len glMsgSaved
46ret
47end
48if eq id 6
49w = write 1 glMsgPass 0 len glMsgPass
50ret
51end
52if eq id 7
53w = write 1 glMsgSwaps 0 len glMsgSwaps
54ret
55end
56if eq id 8
57w = write 1 glMsgRb 0 len glMsgRb
58ret
59end
60if eq id 9
61w = write 1 glMsgNeg 0 len glMsgNeg
62ret
63end
64if eq id 10
65w = write 1 glMsgSlash 0 len glMsgSlash
66ret
67end
68if eq id 11
69w = write 1 glMsgNl 0 len glMsgNl
70ret
71end
72w = write 1 glMsgFail 0 len glMsgFail
73end
74
75fn glNum v ulong to void
76x = v
77p = ulong 24
78for i ulong 21
79p = sub p 1
80put glDig p uchar add 48 rem x 10
81x = div x 10
82if eq x 0
83w = write 1 glDig p sub 24 p
84ret
85end
86end
87end
88
89fn glFail id ulong to int
90glSay 12
91glNum id
92glSay 11
93ret int id
94end
95
96fn glAddChk n ulong to void
97put glChk 0 add get glChk 0 n
98end
99
100fn glAddNeg n ulong to void
101put glNeg 0 add get glNeg 0 n
102end
103
104note Phase 1: Cold baseline execution on slot 0 (GPU GEMM M=4, K=4096, N=4096) and slot 1 (neural 15,000,000 ns)
105fn glPhase1ColdBaseline to int
106if not as_register_baseline 0 1001 4096 TID_SM121 FAB_MODE_NEURAL AS_KIND_GPU_GEMM
107ret glFail 1
108end
109if not as_register_baseline 1 2002 8192 TID_SM121 FAB_MODE_NEURAL AS_KIND_CRYSTALLIZE
110ret glFail 2
111end
112if ne get fabVer 0 1
113ret glFail 3
114end
115if ne get fabCostNs 0 15000000
116ret glFail 4
117end
118if ne get fabVer 1 1
119ret glFail 5
120end
121if ne get fabMode 1 FAB_MODE_NEURAL
122ret glFail 6
123end
124if ne get fabCostNs 1 15000000
125ret glFail 7
126end
127y0 = as_dispatch_checked 0 4 4096
128if ne y0 16384
129ret glFail 8
130end
131if ne get as_last_status 0 AS_DISP_BASELINE
132ret glFail 9
133end
134h0 = as_observe 0 1001 4 4096 4096
135if ne h0 1
136ret glFail 10
137end
138y1 = as_dispatch_checked 1 2 3
139if ne y1 15
140ret glFail 11
141end
142if ne get as_last_status 0 AS_DISP_BASELINE
143ret glFail 12
144end
145if ne as_pending_jobs 0
146ret glFail 13
147end
148glAddChk 13
149ret 0
150end
151
152note Phase 2: Live Arboris co-activation learning (slot 0 -> slot 1, 100% hit rate after warmup) + hot-shape threshold
153fn glPhase2CoactAndObserve to int
154note Complete warmup edge (slot 1 -> slot 0); slot 0 -> slot 1 was already observed in Phase 1
155y = as_dispatch_checked 0 4 4096
156if ne y 16384
157ret glFail 20
158end
159h = as_observe 0 1001 4 4096 4096
160if ne h 2
161ret glFail 21
162end
163note Post-warmup alternating calls: every transition MUST be predicted with 100% hit rate!
164if ne as_coact_predict 1001 2002
165ret glFail 22
166end
167y = as_dispatch_checked 1 4 1
168if ne y 15
169ret glFail 23
170end
171y = as_dispatch_checked 0 4 4096
172if ne y 16384
173ret glFail 24
174end
175h = as_observe 0 1001 4 4096 4096
176if ne h 3
177ret glFail 25
178end
179if ne as_pending_jobs 0
180ret glFail 26
181end
182y = as_dispatch_checked 1 7 5
183if ne y 36
184ret glFail 27
185end
186y = as_dispatch_checked 0 4 4096
187if ne y 16384
188ret glFail 28
189end
190note 4th observation crosses threshold (>= 4) -> schedules TID_A725 background job!
191h = as_observe 0 1001 4 4096 4096
192if ne h 4
193ret glFail 29
194end
195y = as_dispatch_checked 1 10 2
196if ne y 36
197ret glFail 30
198end
199note Verify 100% co-activation hit rate after warmup (5 predictions, 5 hits, 0 misses)
200if ne get as_coact_preds 0 5
201ret glFail 31
202end
203if ne get as_coact_hits 0 5
204ret glFail 32
205end
206if ne get as_coact_misses 0 0
207ret glFail 33
208end
209if lt as_coact_weight 1001 2002 4
210ret glFail 34
211end
212if eq get as_prefetch_cues 0 0
213ret glFail 35
214end
215note Verify slot 0 hot-shape scheduled exactly 1 background job routed to TID_A725!
216if ne as_pending_jobs 1
217ret glFail 36
218end
219if ne get as_job_exec_tid 0 TID_A725
220ret glFail 37
221end
222if ne get crObsCnt 0 4
223ret glFail 38
224end
225glAddChk 19
226ret 0
227end
228
229note Phase 3: Negative Controls 1..3 (all MUST fail closed with fabVer unchanged and as_refusals incremented!)
230fn glPhase3NegControlsProofs to int
231v0Before = get fabVer 0
232v1Before = get fabVer 1
233refBefore = get as_refusals 0
234note Negative Control 1: missing EGP3 bit (proofMask = 5) -> REFUSED, fabVer unchanged!
235rc1 = as_specialize_slot 0 AS_KIND_GPU_GEMM 4 4096 4096 5
236if ne rc1 AS_ERR_PROOF_EGP3
237ret glFail 40
238end
239if ne get fabVer 0 v0Before
240ret glFail 41
241end
242if ne get fabMode 0 FAB_MODE_NEURAL
243ret glFail 42
244end
245if ne get as_refusals 0 add refBefore 1
246ret glFail 43
247end
248glAddNeg 1
249note Negative Control 2: missing Antibody bit (proofMask = 3) -> REFUSED, fabVer unchanged!
250rc2 = as_specialize_slot 1 AS_KIND_CRYSTALLIZE 0 0 0 3
251if ne rc2 AS_ERR_PROOF_ANTIBODY
252ret glFail 44
253end
254if ne get fabVer 1 v1Before
255ret glFail 45
256end
257if ne get fabMode 1 FAB_MODE_NEURAL
258ret glFail 46
259end
260if ne get as_refusals 0 add refBefore 2
261ret glFail 47
262end
263glAddNeg 1
264note Negative Control 3: violated TargetDesc SMEM contract (M=8, K=4096 -> 131072 B > SM121 101376 B) -> REFUSED!
265rc3 = as_specialize_slot 0 AS_KIND_GPU_GEMM 8 4096 4096 7
266if ne rc3 AS_ERR_CONTRACT_SMEM
267ret glFail 48
268end
269if ne get as_last_contract_err 0 TDK_ERR_SMEM
270ret glFail 49
271end
272if ne get fabVer 0 v0Before
273ret glFail 50
274end
275if ne get as_refusals 0 add refBefore 3
276ret glFail 51
277end
278glAddNeg 1
279glAddChk 12
280ret 0
281end
282
283note Phase 4: Hot-shape TID_A725 background specialization + crystallization (proofMask=7) + specialized dispatch!
284fn glPhase4SpecializeAndRun to int
285note Observe neural skill slot 1 until threshold (>= 4) to queue its TID_A725 crystallization job too
286for i ulong 4
287hn = as_observe 1 2002 1 2 1
288end
289if ne as_pending_jobs 2
290ret glFail 60
291end
292if ne get as_job_exec_tid 1 TID_A725
293ret glFail 61
294end
295note Drain TID_A725 queue with full 3-bit proof gate (proofMask = 7)
296sw = as_run_bg_queue 7
297if ne sw 2
298ret glFail 62
299end
300if ne as_pending_jobs 0
301ret glFail 63
302end
303if ne get as_swaps 0 2
304ret glFail 64
305end
306note Verify Slot 0 GPU GEMM promotion: REG_TILE_M, fabVer 1->2, Antibody #14 stall >= 6 verified!
307if ne get fabVer 0 2
308ret glFail 65
309end
310if ne get fabMode 0 FAB_MODE_GPU_NATIVE
311ret glFail 66
312end
313if ne get fabCostNs 0 20000
314ret glFail 67
315end
316if ne get peOut 0 PE_REGIME_REG_TILE_M
317ret glFail 68
318end
319if ne get peOut 1 65536
320ret glFail 69
321end
322if not as_verify_antibodies
323ret glFail 70
324end
325note Bonus Antibody #14 sensitivity check: corrupt stall=2 -> must reject, then restore valid SASS!
326put isBuf 8 2
327if as_verify_antibodies
328ret glFail 71
329end
330if not isCompileTestFn TID_SM121
331ret glFail 72
332end
333if not as_verify_antibodies
334ret glFail 73
335end
336note Verify Slot 1 crystallization promotion: fabVer 1->2, cost 15,000,000 ns -> 500 ns!
337if ne get fabVer 1 2
338ret glFail 74
339end
340if ne get fabMode 1 FAB_MODE_CRYSTALLIZED
341ret glFail 75
342end
343if ne get fabCostNs 1 500
344ret glFail 76
345end
346if ne get crOp1 0 OIR_ADD
347ret glFail 77
348end
349if ne get crOp2 0 OIR_MUL
350ret glFail 78
351end
352if ne get crConstC 0 3
353ret glFail 79
354end
355note Run specialized in-domain dispatches on Slot 0 & Slot 1 and verify latency saved + 100% coact hits!
356rv = as_dispatch_checked 0 4 4096
357if ne rv 16384
358ret glFail 80
359end
360if ne get as_last_status 0 AS_DISP_SPECIALIZED
361ret glFail 81
362end
363rv = as_dispatch_checked 1 7 5
364if ne rv 36
365ret glFail 82
366end
367if ne get as_last_status 0 AS_DISP_SPECIALIZED
368ret glFail 83
369end
370rv = as_dispatch_checked 0 4 4096
371if ne rv 16384
372ret glFail 84
373end
374if ne get as_last_status 0 AS_DISP_SPECIALIZED
375ret glFail 85
376end
377rv = as_dispatch_checked 1 12 8
378if ne rv 60
379ret glFail 86
380end
381if ne get as_last_status 0 AS_DISP_SPECIALIZED
382ret glFail 87
383end
384if ne get as_spec_hits 0 4
385ret glFail 88
386end
387if ne get as_coact_hits 0 get as_coact_preds 0
388ret glFail 89
389end
390if ne get as_latency_saved_ns 0 59959000
391ret glFail 90
392end
393glAddChk 31
394ret 0
395end
396
397note Phase 5: Negative Control 4 (Out-of-domain input on crystallized slot 1 -> ORACLE alarm + atomic rollback!)
398fn glPhase5OracleRollback to int
399yOod = as_dispatch_checked 1 200 1
400if ne yOod 603
401ret glFail 91
402end
403if ne get as_last_status 0 AS_DISP_ROLLBACK
404ret glFail 92
405end
406if ne get as_alarms 0 1
407ret glFail 93
408end
409if ne get as_alarm_slot 0 1
410ret glFail 94
411end
412if ne get as_alarm_x0 0 200
413ret glFail 95
414end
415if ne get as_alarm_code 0 AS_ALARM_OOD
416ret glFail 96
417end
418if ne get fabMode 1 FAB_MODE_NEURAL
419ret glFail 97
420end
421if ne get fabPtr 1 8192
422ret glFail 98
423end
424if ne get fabCostNs 1 15000000
425ret glFail 99
426end
427if ne get fabVer 1 3
428ret glFail 100
429end
430if ne get as_rollbacks 0 1
431ret glFail 101
432end
433note Post-rollback continuity: subsequent dispatch on slot 1 runs cleanly on safe baseline!
434ySafe = as_dispatch_checked 1 7 5
435if ne ySafe 36
436ret glFail 102
437end
438if ne get as_last_status 0 AS_DISP_BASELINE
439ret glFail 103
440end
441if ne get as_rollbacks 0 1
442ret glFail 104
443end
444glAddNeg 1
445glAddChk 14
446ret 0
447end
448
449note Phase 6: Telemetry consistency checks
450fn glPhase6Telemetry to int
451if ne as_telemetry_get 0 14
452ret glFail 110
453end
454if ne as_telemetry_get 1 4
455ret glFail 111
456end
457if lt as_telemetry_get 2 9
458ret glFail 112
459end
460if ne as_telemetry_get 3 3
461ret glFail 113
462end
463if ne as_telemetry_get 4 1
464ret glFail 114
465end
466if ne as_telemetry_get 5 59959000
467ret glFail 115
468end
469if ne as_telemetry_get 6 2
470ret glFail 116
471end
472if ne as_telemetry_get 7 1
473ret glFail 117
474end
475if ne as_telemetry_get 10 2
476ret glFail 118
477end
478glAddChk 9
479ret 0
480end
481
482fn main to int
483tdInitAll
484isInitRules
485tdCacheInit
486fabInit
487crInit
488as_init
489put glChk 0 0
490put glNeg 0 0
491glSay 0
492r = glPhase1ColdBaseline
493if ne r 0
494ret r
495end
496r = glPhase2CoactAndObserve
497if ne r 0
498ret r
499end
500r = glPhase3NegControlsProofs
501if ne r 0
502ret r
503end
504r = glPhase4SpecializeAndRun
505if ne r 0
506ret r
507end
508r = glPhase5OracleRollback
509if ne r 0
510ret r
511end
512r = glPhase6Telemetry
513if ne r 0
514ret r
515end
516glSay 1
517glNum as_telemetry_get 0
518glSay 2
519glNum as_telemetry_get 1
520glSay 3
521glNum as_telemetry_get 2
522glSay 4
523glNum as_telemetry_get 3
524glSay 5
525glNum as_telemetry_get 5
526glSay 11
527glSay 6
528glNum get glChk 0
529glSay 7
530glNum get as_swaps 0
531glSay 8
532glNum get as_rollbacks 0
533glSay 9
534glNum get glNeg 0
535glSay 10
536ret 0
537end