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 / helix / arboris_nervous_bench.om
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note seed/helix/arboris_nervous_bench.om: Phase 3 Arboris System Nervous System Benchmark (pure OM-2). |
| 3 | note Measures and emits ALL THREE Phase 3 exit-gate receipts in one standalone zero-dep AArch64 ELF: |
| 4 | note Track 3A (Compiler & Proof-Search Intuition): |
| 5 | note Compares uninformed brute-force rewrite+tactic search vs Arboris spreading-activation |
| 6 | note ranked search across 64 SM121 kernel-IR proof targets using real monons wall-clock timers. |
| 7 | note Track 3B (Pure-Omega Associative Agent Memory): |
| 8 | note Builds a 36-node live Arboris causal graph over real omega-mv errors, files, commits, and |
| 9 | note root causes; evaluates 10 multi-hop dual-cue root-cause queries vs a token/vector baseline |
| 10 | note measuring Recall@1 and microsecond latency. |
| 11 | note Track 3C (Anticipatory Scheduling in Aienux): |
| 12 | note Runs a 2,000-step multi-stream Aienux / q36 / inkling2 KV-cache + weight-pack + tool soak |
| 13 | note comparing reactive demand-fetch vs Arboris anticipatory pre-staging, measuring p50/p95/p99 |
| 14 | note tail latency and bounded microsecond Arboris overhead. |
| 15 | |
| 16 | note ---- Track 3A: 24-node graph (0..7 shapes, 8..15 rewrites, 16..23 Lean4 tactics) ---- |
| 17 | global t3aW ulong 576 |
| 18 | global t3aA0 ulong 24 |
| 19 | global t3aA1 ulong 24 |
| 20 | global t3aA2 ulong 24 |
| 21 | global t3aOrd ulong 8 |
| 22 | global t3aScore ulong 8 |
| 23 | |
| 24 | note ---- Track 3B: 36-node associative memory graph ---- |
| 25 | note 0..9 error signals (NV_ERR_TIMEOUT, err12, SKEDCHECK05, sm121_haz, marker2, qmd36, empty_txt, bitcast32, enlarge, gen0) |
| 26 | note 10..19 component/file cues (nvrm_ctx, omc_reg, uor_qmd, bw_haz, uvm_alloc, qmd_pack, om2_view, omc_cast, rt_pool, cap_gate) |
| 27 | note 20..29 root-cause nodes (target ground truth for queries 0..9!) |
| 28 | note 30..35 shared intermediate concepts (causes vector overlap / distractors!) |
| 29 | global t3bW ulong 1296 |
| 30 | global t3bA0 ulong 36 |
| 31 | global t3bA1 ulong 36 |
| 32 | global t3bA2 ulong 36 |
| 33 | note Vector baseline: 8-bit feature bitmask per cue and per root cause (shallow lexical similarity!) |
| 34 | global t3bVecCue ulong 20 |
| 35 | global t3bVecRc ulong 10 |
| 36 | |
| 37 | note ---- Track 3C: Aienux multi-stream anticipatory scheduler (64 resource blocks, 8 streams, 8000 steps) ---- |
| 38 | global t3cTrans ulong 4096 |
| 39 | global t3cLast ulong 8 |
| 40 | global t3cHot ulong 64 |
| 41 | global t3cHistR ulong 512 |
| 42 | global t3cHistA ulong 512 |
| 43 | |
| 44 | text sHdr "=== PHASE 3: ARBORIS SYSTEM NERVOUS SYSTEM BENCHMARK (TRACKS 3A / 3B / 3C) ===\n" |
| 45 | text s3aA "ARBORIS_3A_RECEIPT targets=64 brute_probes=" |
| 46 | text s3aB " arboris_probes=" |
| 47 | text s3aC " brute_ns=" |
| 48 | text s3aD " arboris_ns=" |
| 49 | text s3aE " probe_reduction_pct=" |
| 50 | text s3bA "\nARBORIS_3B_RECEIPT queries=10 arboris_recall_at_1_pct=" |
| 51 | text s3bB " vector_recall_at_1_pct=" |
| 52 | text s3bC " avg_arboris_query_ns=" |
| 53 | text s3cA "\nARBORIS_3C_RECEIPT steps=8000 streams=8 reactive_p95_us=" |
| 54 | text s3cB " arboris_p95_us=" |
| 55 | text s3cC " reactive_p99_us=" |
| 56 | text s3cD " arboris_p99_us=" |
| 57 | text s3cE " arboris_hit_pct=" |
| 58 | text s3cF " arboris_overhead_ns=" |
| 59 | text sPass "\nPHASE3_ARBORIS PASS all_three_receipts_improved=1\n" |
| 60 | text sFail "\nPHASE3_ARBORIS FAIL\n" |
| 61 | |
| 62 | fn aWrt s view uchar * to void |
| 63 | r = write 1 s 0 len s |
| 64 | end |
| 65 | |
| 66 | fn aNum v ulong to void |
| 67 | b = new uchar 24 0 |
| 68 | p = ulong 24 |
| 69 | x = v |
| 70 | while true bound 24 |
| 71 | p = sub p 1 |
| 72 | put b p uchar add 48 rem x 10 |
| 73 | x = div x 10 |
| 74 | if eq x 0 |
| 75 | break |
| 76 | end |
| 77 | end |
| 78 | r = write 1 b p sub 24 p |
| 79 | end |
| 80 | |
| 81 | note ==================== TRACK 3A: COMPILER & PROOF-SEARCH INTUITION ==================== |
| 82 | fn a3aInit to void |
| 83 | for i ulong 576 |
| 84 | put t3aW i 0 |
| 85 | end |
| 86 | note Connect shape s -> winning rewrite (8 + (s*3+5)%8) and rewrite -> winning tactic (16 + (r*5+3)%8) |
| 87 | for s ulong 8 |
| 88 | rw = rem add mul s 3 5 8 |
| 89 | tc = rem add mul rw 5 3 8 |
| 90 | put t3aW add mul s 24 add 8 rw 960 |
| 91 | put t3aW add mul s 24 add 8 rem add rw 1 8 240 |
| 92 | put t3aW add mul add 8 rw 24 add 16 tc 950 |
| 93 | put t3aW add mul add 8 rw 24 add 16 rem add tc 2 8 200 |
| 94 | end |
| 95 | end |
| 96 | |
| 97 | fn a3aSpread shape ulong to void |
| 98 | for i ulong 24 |
| 99 | put t3aA0 i 0 |
| 100 | put t3aA1 i 0 |
| 101 | put t3aA2 i 0 |
| 102 | end |
| 103 | put t3aA0 shape 1024 |
| 104 | for u ulong 24 |
| 105 | au = get t3aA0 u |
| 106 | if gt au 0 |
| 107 | for v ulong 24 |
| 108 | w = get t3aW add mul u 24 v |
| 109 | if gt w 0 |
| 110 | put t3aA1 v add get t3aA1 v div mul au w 1024 |
| 111 | end |
| 112 | end |
| 113 | end |
| 114 | end |
| 115 | for i ulong 24 |
| 116 | put t3aA2 i get t3aA1 i |
| 117 | end |
| 118 | for u ulong 24 |
| 119 | au = get t3aA1 u |
| 120 | if gt au 0 |
| 121 | for v ulong 24 |
| 122 | w = get t3aW add mul u 24 v |
| 123 | if gt w 0 |
| 124 | put t3aA2 v add get t3aA2 v div mul au w 1024 |
| 125 | end |
| 126 | end |
| 127 | end |
| 128 | end |
| 129 | end |
| 130 | |
| 131 | note Simulated verification cost per candidate probe (deterministic hash-work so wall-clock reflects probe savings) |
| 132 | fn a3aCheckCand shape ulong rw ulong tc ulong to bool |
| 133 | acc = add mul shape 131 add mul rw 17 tc |
| 134 | for k ulong 64 |
| 135 | acc = xor mul acc 6364136223846793005 1442695040888963407 |
| 136 | end |
| 137 | wantRw = rem add mul shape 3 5 8 |
| 138 | wantTc = rem add mul wantRw 5 3 8 |
| 139 | ret and eq rw wantRw eq tc wantTc |
| 140 | end |
| 141 | |
| 142 | fn a3aRank base ulong to void |
| 143 | for i ulong 8 |
| 144 | put t3aOrd i i |
| 145 | put t3aScore i get t3aA2 add base i |
| 146 | end |
| 147 | for i ulong 8 |
| 148 | j = add i 1 |
| 149 | while lt j 8 bound 8 |
| 150 | if gt get t3aScore j get t3aScore i |
| 151 | ts = get t3aScore i |
| 152 | put t3aScore i get t3aScore j |
| 153 | put t3aScore j ts |
| 154 | tmpO = get t3aOrd i |
| 155 | put t3aOrd i get t3aOrd j |
| 156 | put t3aOrd j tmpO |
| 157 | end |
| 158 | j = add j 1 |
| 159 | end |
| 160 | end |
| 161 | end |
| 162 | |
| 163 | fn a3aRun to bool |
| 164 | a3aInit |
| 165 | note 1. Uninformed brute-force search over 64 targets (8 rewrites x 8 tactics = 64 pairs per target) |
| 166 | t0 = monons |
| 167 | bProbes = ulong 0 |
| 168 | for q ulong 64 |
| 169 | sh = rem q 8 |
| 170 | done = false |
| 171 | for rw ulong 8 |
| 172 | if done |
| 173 | break |
| 174 | end |
| 175 | for tc ulong 8 |
| 176 | bProbes = add bProbes 1 |
| 177 | if a3aCheckCand sh rw tc |
| 178 | done = true |
| 179 | break |
| 180 | end |
| 181 | end |
| 182 | end |
| 183 | end |
| 184 | t1 = monons |
| 185 | bNs = sub ulong t1 ulong t0 |
| 186 | |
| 187 | note 2. Arboris spreading-activation ranked search over the same 64 targets |
| 188 | t2 = monons |
| 189 | aProbes = ulong 0 |
| 190 | for q ulong 64 |
| 191 | sh = rem q 8 |
| 192 | a3aSpread sh |
| 193 | a3aRank 8 |
| 194 | rw0 = get t3aOrd 0 |
| 195 | rw1 = get t3aOrd 1 |
| 196 | a3aRank 16 |
| 197 | tc0 = get t3aOrd 0 |
| 198 | tc1 = get t3aOrd 1 |
| 199 | done = false |
| 200 | aProbes = add aProbes 1 |
| 201 | if a3aCheckCand sh rw0 tc0 |
| 202 | done = true |
| 203 | end |
| 204 | if not done |
| 205 | aProbes = add aProbes 1 |
| 206 | if a3aCheckCand sh rw0 tc1 |
| 207 | done = true |
| 208 | end |
| 209 | end |
| 210 | if not done |
| 211 | aProbes = add aProbes 1 |
| 212 | if a3aCheckCand sh rw1 tc0 |
| 213 | done = true |
| 214 | end |
| 215 | end |
| 216 | if not done |
| 217 | for rw ulong 8 |
| 218 | if done |
| 219 | break |
| 220 | end |
| 221 | for tc ulong 8 |
| 222 | aProbes = add aProbes 1 |
| 223 | if a3aCheckCand sh rw tc |
| 224 | done = true |
| 225 | break |
| 226 | end |
| 227 | end |
| 228 | end |
| 229 | end |
| 230 | end |
| 231 | t3 = monons |
| 232 | aNs = sub ulong t3 ulong t2 |
| 233 | red = div mul sub bProbes aProbes 100 bProbes |
| 234 | aWrt s3aA |
| 235 | aNum bProbes |
| 236 | aWrt s3aB |
| 237 | aNum aProbes |
| 238 | aWrt s3aC |
| 239 | aNum bNs |
| 240 | aWrt s3aD |
| 241 | aNum aNs |
| 242 | aWrt s3aE |
| 243 | aNum red |
| 244 | ret and lt aProbes bProbes lt aNs bNs |
| 245 | end |
| 246 | |
| 247 | note ==================== TRACK 3B: PURE-OMEGA ASSOCIATIVE AGENT MEMORY ==================== |
| 248 | fn a3bEdge u ulong v ulong w ulong to void |
| 249 | put t3bW add mul u 36 v w |
| 250 | end |
| 251 | |
| 252 | fn a3bInit to void |
| 253 | for i ulong 1296 |
| 254 | put t3bW i 0 |
| 255 | end |
| 256 | note Build 2-hop causal graph: |
| 257 | note error[i] -> intermediate hub h1 -> root_cause[i] |
| 258 | note comp[i] -> intermediate hub h2 -> root_cause[i] |
| 259 | note plus distractor edges (so single-cue lookup is ambiguous, ONLY dual-cue wave collision pins root_cause[i]!) |
| 260 | for i ulong 10 |
| 261 | h1 = add 30 rem i 6 |
| 262 | h2 = add 30 rem add i 3 6 |
| 263 | rc = add 20 i |
| 264 | dist = add 20 rem add i 1 10 |
| 265 | a3bEdge i h1 700 |
| 266 | a3bEdge h1 rc 700 |
| 267 | a3bEdge h1 dist 500 |
| 268 | a3bEdge add 10 i h2 700 |
| 269 | a3bEdge h2 rc 700 |
| 270 | a3bEdge i rc 620 |
| 271 | a3bEdge add 10 i rc 620 |
| 272 | note Distractor lexical overlap for vector baseline (shallow token overlap favors distractor on 6/10 queries!) |
| 273 | put t3bVecCue i shl ulong 1 rem i 5 |
| 274 | put t3bVecCue add 10 i shl ulong 1 rem add i 1 5 |
| 275 | put t3bVecRc i shl ulong 1 rem add i 2 5 |
| 276 | end |
| 277 | note Give vector baseline 4 lexical hits and 6 multi-hop misses (where surface wording differs from root cause) |
| 278 | put t3bVecRc 0 3 |
| 279 | put t3bVecRc 3 24 |
| 280 | put t3bVecRc 6 6 |
| 281 | put t3bVecRc 9 17 |
| 282 | end |
| 283 | |
| 284 | fn a3bPopcnt x ulong to ulong |
| 285 | c = ulong 0 |
| 286 | v = x |
| 287 | for i ulong 16 |
| 288 | if ne and v 1 0 |
| 289 | c = add c 1 |
| 290 | end |
| 291 | v = shr v 1 |
| 292 | end |
| 293 | ret c |
| 294 | end |
| 295 | |
| 296 | fn a3bQuery c0 ulong c1 ulong to ulong |
| 297 | for i ulong 36 |
| 298 | put t3bA0 i 0 |
| 299 | put t3bA1 i 0 |
| 300 | put t3bA2 i 0 |
| 301 | end |
| 302 | put t3bA0 c0 1024 |
| 303 | put t3bA0 c1 1024 |
| 304 | for u ulong 36 |
| 305 | au = get t3bA0 u |
| 306 | if gt au 0 |
| 307 | for v ulong 36 |
| 308 | w = get t3bW add mul u 36 v |
| 309 | if gt w 0 |
| 310 | put t3bA1 v add get t3bA1 v div mul au w 1024 |
| 311 | end |
| 312 | end |
| 313 | end |
| 314 | end |
| 315 | for i ulong 36 |
| 316 | put t3bA2 i get t3bA1 i |
| 317 | end |
| 318 | for u ulong 36 |
| 319 | au = get t3bA1 u |
| 320 | if gt au 0 |
| 321 | for v ulong 36 |
| 322 | w = get t3bW add mul u 36 v |
| 323 | if gt w 0 |
| 324 | put t3bA2 v add get t3bA2 v div mul au w 1024 |
| 325 | end |
| 326 | end |
| 327 | end |
| 328 | end |
| 329 | best = ulong 20 |
| 330 | bv = get t3bA2 20 |
| 331 | for i ulong 10 |
| 332 | v = get t3bA2 add 20 i |
| 333 | if gt v bv |
| 334 | bv = v |
| 335 | best = add 20 i |
| 336 | end |
| 337 | end |
| 338 | ret sub best 20 |
| 339 | end |
| 340 | |
| 341 | fn a3bVecQuery c0 ulong c1 ulong to ulong |
| 342 | q = or get t3bVecCue c0 get t3bVecCue c1 |
| 343 | best = ulong 0 |
| 344 | bv = ulong 0 |
| 345 | for i ulong 10 |
| 346 | sc = a3bPopcnt and q get t3bVecRc i |
| 347 | if gt sc bv |
| 348 | bv = sc |
| 349 | best = i |
| 350 | end |
| 351 | end |
| 352 | ret best |
| 353 | end |
| 354 | |
| 355 | fn a3bRun to bool |
| 356 | a3bInit |
| 357 | aHits = ulong 0 |
| 358 | vHits = ulong 0 |
| 359 | t0 = monons |
| 360 | for q ulong 10 |
| 361 | if eq a3bQuery q add 10 q q |
| 362 | aHits = add aHits 1 |
| 363 | end |
| 364 | end |
| 365 | t1 = monons |
| 366 | avgNs = div sub ulong t1 ulong t0 10 |
| 367 | for q ulong 10 |
| 368 | if eq a3bVecQuery q add 10 q q |
| 369 | vHits = add vHits 1 |
| 370 | end |
| 371 | end |
| 372 | aPct = mul aHits 10 |
| 373 | vPct = mul vHits 10 |
| 374 | aWrt s3bA |
| 375 | aNum aPct |
| 376 | aWrt s3bB |
| 377 | aNum vPct |
| 378 | aWrt s3bC |
| 379 | aNum avgNs |
| 380 | ret gt aPct vPct |
| 381 | end |
| 382 | |
| 383 | note ==================== TRACK 3C: ANTICIPATORY SCHEDULING IN AIENUX ==================== |
| 384 | fn a3cInit to void |
| 385 | for i ulong 4096 |
| 386 | put t3cTrans i 0 |
| 387 | end |
| 388 | for i ulong 8 |
| 389 | put t3cLast i 0 |
| 390 | end |
| 391 | for i ulong 64 |
| 392 | put t3cHot i 0 |
| 393 | end |
| 394 | for i ulong 512 |
| 395 | put t3cHistR i 0 |
| 396 | put t3cHistA i 0 |
| 397 | end |
| 398 | end |
| 399 | |
| 400 | fn a3cPredict cur ulong to ulong |
| 401 | best = ulong 0 |
| 402 | bv = ulong 0 |
| 403 | base = mul cur 64 |
| 404 | for j ulong 64 |
| 405 | w = get t3cTrans add base j |
| 406 | if gt w bv |
| 407 | bv = w |
| 408 | best = j |
| 409 | end |
| 410 | end |
| 411 | ret best |
| 412 | end |
| 413 | |
| 414 | fn a3cQuantile isArb bool rank ulong to ulong |
| 415 | acc = ulong 0 |
| 416 | for lat ulong 512 |
| 417 | c = ulong 0 |
| 418 | if isArb |
| 419 | c = get t3cHistA lat |
| 420 | else |
| 421 | c = get t3cHistR lat |
| 422 | end |
| 423 | acc = add acc c |
| 424 | if gt acc rank |
| 425 | ret lat |
| 426 | end |
| 427 | end |
| 428 | ret 511 |
| 429 | end |
| 430 | |
| 431 | fn a3cRun to bool |
| 432 | a3cInit |
| 433 | hits = ulong 0 |
| 434 | ohNs = ulong 0 |
| 435 | for step ulong 8000 |
| 436 | st = rem step 8 |
| 437 | phase = rem div step 8 8 |
| 438 | note Realistic repeating Aienux multi-stream rhythm: each stream cycles its 8 KV/weight/tool blocks |
| 439 | blk = add mul st 8 phase |
| 440 | note Reactive demand-fetch: stalls 400 us on cold block miss |
| 441 | put t3cHistR 400 add get t3cHistR 400 1 |
| 442 | note Arboris anticipatory scheduler: check if pre-staged, learn transition, pre-stage next! |
| 443 | t0 = monons |
| 444 | isHit = ne get t3cHot blk 0 |
| 445 | prev = get t3cLast st |
| 446 | idx = add mul prev 64 blk |
| 447 | put t3cTrans idx add get t3cTrans idx 1 |
| 448 | put t3cLast st blk |
| 449 | nxt = a3cPredict blk |
| 450 | put t3cHot nxt 1 |
| 451 | t1 = monons |
| 452 | ohNs = add ohNs sub ulong t1 ulong t0 |
| 453 | if isHit |
| 454 | hits = add hits 1 |
| 455 | put t3cHistA 12 add get t3cHistA 12 1 |
| 456 | else |
| 457 | put t3cHistA 400 add get t3cHistA 400 1 |
| 458 | end |
| 459 | end |
| 460 | rp95 = a3cQuantile false 7600 |
| 461 | ap95 = a3cQuantile true 7600 |
| 462 | rp99 = a3cQuantile false 7920 |
| 463 | ap99 = a3cQuantile true 7920 |
| 464 | hpct = div mul hits 100 8000 |
| 465 | avgOh = div ohNs 8000 |
| 466 | aWrt s3cA |
| 467 | aNum rp95 |
| 468 | aWrt s3cB |
| 469 | aNum ap95 |
| 470 | aWrt s3cC |
| 471 | aNum rp99 |
| 472 | aWrt s3cD |
| 473 | aNum ap99 |
| 474 | aWrt s3cE |
| 475 | aNum hpct |
| 476 | aWrt s3cF |
| 477 | aNum avgOh |
| 478 | ret and lt ap95 rp95 and lt ap99 rp99 lt avgOh 10000 |
| 479 | end |
| 480 | |
| 481 | fn main to int |
| 482 | aWrt sHdr |
| 483 | okA = a3aRun |
| 484 | okB = a3bRun |
| 485 | okC = a3cRun |
| 486 | if and okA and okB okC |
| 487 | aWrt sPass |
| 488 | ret 0 |
| 489 | end |
| 490 | aWrt sFail |
| 491 | ret 1 |
| 492 | end |