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/yang/blob/main/src/ufbi_obs_synth_w3.om # yang This project has not described itself yet. 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 `yang / src / ufbi_obs_synth_w3.om` 1136 lines ยท 22733 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note src/ufbi_obs_synth_w3.om: Pure Seeded-OM-2 Wave-3 Pole-Free CentralObs Synthesizer 3 note (4D SU(2), L=6, 16-Snapshot Ensemble across beta=2.30 & beta=2.50, cold vs twist). 4 note 5 note Upgrades over Wave-2 (src/ufbi_obs_synth_w2.om): 6 note 1. 16-lane per-snapshot evaluation (4 independent snapshots x 4 arms: 7 note cold_b230, twist_b230, cold_b250, twist_b250) capturing strong-coupling 8 note per-configuration fluctuations where chi1(ADJ_PLAQ_S0) crosses zero. 9 note 2. INV-4 Pole-Free Denominator Guard: rejects any ratio(A, B) unless denominator B 10 note is strictly sign-definite across ALL 16 snapshots with margin tau=0.15 11 note (either min_i B_i > 0.15 or max_i B_i < -0.15) AND condition ratio <= 4.0. 12 note Explicitly tracks inv4_pole_killed (killing chi1(ADJ_PLAQ_S0) denominators!). 13 note 3. Dimensionless bulk-fluctuation normalization: computes within-arm bulk std sigma_bulk 14 note and reports dimensionless collar leakage delta_twist / sigma_bulk alongside uv_score. 15 note 4. Retains INV-1 (BFS barriers), INV-2 (65536-slot table, MAX_PROBES=32, 70% cap), 16 note INV-3 (bounded output), Physics Operator Prior (ratio > sub > mul > add), 17 note Wake-Sleep Depth-2 mining, and exact local SU(2) gauge-invariance gate (<= 1e-4). 18 note 19 note Composed after: src/ufbi_math.om 20 21 const W3_SLOT_F ulong 20736 22 const W3_HT_SZ ulong 65536 23 const W3_HT_MASK ulong 65535 24 const W3_HT_MAX_OCC ulong 45875 25 const W3_MAX_PROBES ulong 32 26 const W3_MAX_NODES ulong 16384 27 const W3_LANES ulong 16 28 29 global osBuf f32 103680 30 global osG f32 5184 31 note 2 (orig/gauge) x 15 prims x 16 lanes = 480 f64 32 global osPrim f64 480 33 global osAcc f64 16 34 35 note AST node pool (up to 16,384 distinct pole-free gauge-invariant CentralObs ASTs) 36 note op: 0=PRIM, 1=CHI1, 2=SQ, 3=SUB, 4=ADD, 5=MUL, 6=RATIO 37 global osOp uchar 16384 38 global osL ulong 16384 39 global osR ulong 16384 40 global osDep uchar 16384 41 note 16384 nodes x 16 lanes = 262144 f64 each 42 global osVec f64 262144 43 global osGVec f64 262144 44 note Per-node min/max across all 16 snapshots for O(1) INV-4 pole-free check 45 global osMinV f64 16384 46 global osMaxV f64 16384 47 48 global osCandV f64 16 49 global osCandG f64 16 50 global osHtH ulong 65536 51 global osHtN ulong 65536 52 note osSt: 0=nodes, 1=ht_occ, 2=gauge_killed, 3=equiv_pruned, 4=inv4_pole_killed, 5=max_probes, 6=inv3_oob 53 global osSt ulong 16 54 global osLvlS ulong 8 55 global osLvlE ulong 8 56 global osOpOrder ulong 4 57 global osTopIds ulong 32 58 global osTopScores f64 32 59 60 text tW3Hdr "=== UFBI CENTRALOBS SYNTHESIZER WAVE-3: INV-4 POLE-FREE + BULK-SIGMA NORMALIZED (PURE OM-2) ===\n" 61 text tW3Prior "PHYSICS_PRIOR_OP_ORDER: " 62 text tW3Stat "OBS_SYNTH_W3_STATS nodes=" 63 text tW3GRej " gauge_killed=" 64 text tW3EPrun " equiv_pruned=" 65 text tW3Pole " inv4_pole_killed=" 66 text tW3Occ " ht_occ=" 67 text tW3MPr " max_probes=" 68 text tW3Wave1 " wave1_nodes=" 69 text tW3Wave2 " wave2_nodes=" 70 text tW3Col "rank\tid\tdepth\texpr\tgauge_err\tmin_val\tmax_val\tcold_b23\ttwist_b23\tcold_b25\ttwist_b25\tsig_bulk\tdTw_over_sig\tuv_score\n" 71 text tW3Tab "\t" 72 text tW3Sp " " 73 text tW3Nl "\n" 74 text tW3Pass "OBS_SYNTH_W3_DONE status=PASS gauge_controls_killed=2/2 inv4_pole_guard_active=1\n" 75 76 text tP0 "RAW_LINK_0" 77 text tP1 "RAW_LINK_SUM" 78 text tP2 "PLAQ1x1_S0" 79 text tP3 "PLAQ1x1_S1" 80 text tP4 "PLAQ1x1_S2" 81 text tP5 "PLAQ1x1_S4" 82 text tP6 "RECT1x2_S0" 83 text tP7 "RECT1x2_S2" 84 text tP8 "RECT2x2_S2" 85 text tP9 "CHAIR6_S2" 86 text tP10 "ADJ_PLAQ_S0" 87 text tP11 "ADJ_PLAQ_S2" 88 text tP12 "ADJ_RECT_S2" 89 text tP13 "CLOVER_S2" 90 text tP14 "PLAQ1x1_S0_T" 91 92 text tOpChi "chi1(" 93 text tOpSq "sq(" 94 text tOpSub "sub(" 95 text tOpAdd "add(" 96 text tOpMul "mul(" 97 text tOpDiv "ratio(" 98 text tComma "," 99 text tRp ")" 100 text tNSub "sub" 101 text tNAdd "add" 102 text tNMul "mul" 103 text tNDiv "ratio" 104 105 fn qOff slot ulong site ulong mu ulong to ulong 106 ret add mul slot W3_SLOT_F mul add mul site 4 mu 4 107 end 108 109 fn qLoad slot ulong site ulong mu ulong dst edit f32 4 to void 110 b = qOff slot site mu 111 put dst 0 get osBuf b 112 put dst 1 get osBuf add b 1 113 put dst 2 get osBuf add b 2 114 put dst 3 get osBuf add b 3 115 end 116 117 fn qStore slot ulong site ulong mu ulong src view f32 4 to void 118 b = qOff slot site mu 119 put osBuf b get src 0 120 put osBuf add b 1 get src 1 121 put osBuf add b 2 get src 2 122 put osBuf add b 3 get src 3 123 end 124 125 fn qConj q edit f32 4 to void 126 put q 1 neg get q 1 127 put q 2 neg get q 2 128 put q 3 neg get q 3 129 end 130 131 fn qMul a view f32 4 b view f32 4 o edit f32 4 to void 132 v = mul get a 0 get b 0 133 v = sub v mul get a 1 get b 1 134 v = sub v mul get a 2 get b 2 135 v = sub v mul get a 3 get b 3 136 put o 0 v 137 v = mul get a 0 get b 1 138 v = add v mul get a 1 get b 0 139 v = add v mul get a 2 get b 3 140 v = sub v mul get a 3 get b 2 141 put o 1 v 142 v = mul get a 0 get b 2 143 v = sub v mul get a 1 get b 3 144 v = add v mul get a 2 get b 0 145 v = add v mul get a 3 get b 1 146 put o 2 v 147 v = mul get a 0 get b 3 148 v = add v mul get a 1 get b 2 149 v = sub v mul get a 2 get b 1 150 v = add v mul get a 3 get b 0 151 put o 3 v 152 end 153 154 fn qDot4 a view f32 4 b view f32 4 to f32 155 d = mul get a 0 get b 0 156 d = add d mul get a 1 get b 1 157 d = add d mul get a 2 get b 2 158 ret add d mul get a 3 get b 3 159 end 160 161 fn qNorm q edit f32 4 to void 162 n2 = mul get q 0 get q 0 163 n2 = add n2 mul get q 1 get q 1 164 n2 = add n2 mul get q 2 get q 2 165 n2 = add n2 mul get q 3 get q 3 166 if le n2 0.`0000000001f32` 167 put q 0 1.0f32 168 put q 1 0.0f32 169 put q 2 0.0f32 170 put q 3 0.0f32 171 ret 172 end 173 inv = f32 div 1.0f64 uSqrt64 f64 n2 174 for c ulong 4 175 put q c mul get q c inv 176 end 177 end 178 179 fn qRand dst edit f32 4 to void 180 put dst 0 f32 uRngNorm64 181 put dst 1 f32 uRngNorm64 182 put dst 2 f32 uRngNorm64 183 put dst 3 f32 uRngNorm64 184 qNorm dst 185 end 186 187 fn nb6 site ulong dir ulong delta ulong to ulong 188 c3 = rem site 6 189 c2 = rem div site 6 6 190 c1 = rem div site 36 6 191 c0 = div site 216 192 if eq dir 0 193 c0 = rem add c0 delta 6 194 end 195 if eq dir 1 196 c1 = rem add c1 delta 6 197 end 198 if eq dir 2 199 c2 = rem add c2 delta 6 200 end 201 if eq dir 3 202 c3 = rem add c3 delta 6 203 end 204 r = add mul c0 6 c1 205 r = add mul r 6 c2 206 ret add mul r 6 c3 207 end 208 209 fn isBdry6 site ulong to bool 210 c3 = rem site 6 211 c2 = rem div site 6 6 212 c1 = rem div site 36 6 213 c0 = div site 216 214 if or eq c0 0 eq c0 5 215 ret true 216 end 217 if or eq c1 0 eq c1 5 218 ret true 219 end 220 if or eq c2 0 eq c2 5 221 ret true 222 end 223 if or eq c3 0 eq c3 5 224 ret true 225 end 226 ret false 227 end 228 229 fn isInt6 site ulong to bool 230 c3 = rem site 6 231 c2 = rem div site 6 6 232 c1 = rem div site 36 6 233 c0 = div site 216 234 if or lt c0 2 gt c0 3 235 ret false 236 end 237 if or lt c1 2 gt c1 3 238 ret false 239 end 240 if or lt c2 2 gt c2 3 241 ret false 242 end 243 if or lt c3 2 gt c3 3 244 ret false 245 end 246 ret true 247 end 248 249 fn stapleAddOne slot ulong site ulong mu ulong nu ulong isBack bool dst edit f32 4 to void 250 t1 = new f32 4 0.0f32 251 t2 = new f32 4 0.0f32 252 t3 = new f32 4 0.0f32 253 p1 = new f32 4 0.0f32 254 p2 = new f32 4 0.0f32 255 xp = nb6 site mu 1 256 if not isBack 257 qLoad slot site nu t1 258 qLoad slot nb6 site nu 1 mu t2 259 qLoad slot xp nu t3 260 qConj t3 261 else 262 xm = nb6 site nu 5 263 qLoad slot xm nu t1 264 qConj t1 265 qLoad slot xm mu t2 266 qLoad slot nb6 xp nu 5 nu t3 267 end 268 qMul t1 t2 p1 269 qMul p1 t3 p2 270 for c ulong 4 271 put dst c add get dst c get p2 c 272 end 273 end 274 275 fn stapleSum6 slot ulong site ulong mu ulong dst edit f32 4 to void 276 for c ulong 4 277 put dst c 0.0f32 278 end 279 for nu ulong 4 280 if ne nu mu 281 stapleAddOne slot site mu nu false dst 282 stapleAddOne slot site mu nu true dst 283 end 284 end 285 end 286 287 fn apeSmear6 srcSlot ulong dstSlot ulong alpha f32 to void 288 st = new f32 4 0.0f32 289 u = new f32 4 0.0f32 290 w0 = sub 1.0f32 alpha 291 w1 = div alpha 6.0f32 292 for site ulong 1296 293 for mu ulong 4 294 stapleSum6 srcSlot site mu st 295 qLoad srcSlot site mu u 296 for c ulong 4 297 put u c add mul w0 get u c mul w1 get st c 298 end 299 qNorm u 300 qStore dstSlot site mu u 301 end 302 end 303 end 304 305 fn applyGaugeLink srcSlot ulong dstSlot ulong site ulong mu ulong g view f32 4 to void 306 u = new f32 4 0.0f32 307 g2 = new f32 4 0.0f32 308 t1 = new f32 4 0.0f32 309 t2 = new f32 4 0.0f32 310 qLoad srcSlot site mu u 311 xp = nb6 site mu 1 312 b2 = mul xp 4 313 for c ulong 4 314 put g2 c get osG add b2 c 315 end 316 qConj g2 317 qMul g u t1 318 qMul t1 g2 t2 319 qNorm t2 320 qStore dstSlot site mu t2 321 end 322 323 fn applyGaugeTransform srcSlot ulong dstSlot ulong to void 324 g = new f32 4 0.0f32 325 for site ulong 1296 326 qRand g 327 b = mul site 4 328 for c ulong 4 329 put osG add b c get g c 330 end 331 end 332 for site ulong 1296 333 b = mul site 4 334 for c ulong 4 335 put g c get osG add b c 336 end 337 for mu ulong 4 338 applyGaugeLink srcSlot dstSlot site mu g 339 end 340 end 341 end 342 343 fn sweepLink6 site ulong mu ulong beta f64 to void 344 st = new f32 4 0.0f32 345 u = new f32 4 0.0f32 346 cand = new f32 4 0.0f32 347 stapleSum6 0 site mu st 348 qLoad 0 site mu u 349 for hit ulong 3 350 for c ulong 4 351 put cand c add get u c mul 0.35f32 f32 uRngNorm64 352 end 353 qNorm cand 354 dS = mul beta f64 sub qDot4 cand st qDot4 u st 355 if or ge dS 0.0f64 lt uRngUnit64 uExp64 dS 356 for c ulong 4 357 put u c get cand c 358 end 359 end 360 end 361 qNorm st 362 dot = qDot4 u st 363 for c ulong 4 364 put u c sub mul mul 2.0f32 dot get st c get u c 365 end 366 qNorm u 367 qStore 0 site mu u 368 end 369 370 fn sweepSu2 beta f64 nSweeps ulong to void 371 for sw ulong nSweeps bound 128 372 for site ulong 1296 373 if not isBdry6 site 374 for mu ulong 4 375 sweepLink6 site mu beta 376 end 377 end 378 end 379 end 380 end 381 382 fn plaq1x1 slot ulong site ulong mu ulong nu ulong to f64 383 a = new f32 4 0.0f32 384 b = new f32 4 0.0f32 385 p = new f32 4 0.0f32 386 q = new f32 4 0.0f32 387 qLoad slot site mu a 388 qLoad slot nb6 site mu 1 nu b 389 qMul a b p 390 qLoad slot nb6 site nu 1 mu a 391 qConj a 392 qMul p a q 393 qLoad slot site nu b 394 qConj b 395 qMul q b p 396 ret f64 get p 0 397 end 398 399 fn rect1x2 slot ulong site ulong mu ulong nu ulong to f64 400 a = new f32 4 0.0f32 401 b = new f32 4 0.0f32 402 p = new f32 4 0.0f32 403 q = new f32 4 0.0f32 404 s1 = nb6 site mu 1 405 s2 = nb6 s1 mu 1 406 qLoad slot site mu a 407 qLoad slot s1 mu b 408 qMul a b p 409 qLoad slot s2 nu a 410 qMul p a q 411 qLoad slot nb6 s1 nu 1 mu a 412 qConj a 413 qMul q a p 414 qLoad slot nb6 site nu 1 mu a 415 qConj a 416 qMul p a q 417 qLoad slot site nu b 418 qConj b 419 qMul q b p 420 ret f64 get p 0 421 end 422 423 fn rect2x2 slot ulong site ulong mu ulong nu ulong to f64 424 a = new f32 4 0.0f32 425 p = new f32 4 0.0f32 426 q = new f32 4 0.0f32 427 cur = site 428 qLoad slot cur mu p 429 cur = nb6 cur mu 1 430 qLoad slot cur mu a 431 qMul p a q 432 cur = nb6 cur mu 1 433 qLoad slot cur nu a 434 qMul q a p 435 cur = nb6 cur nu 1 436 qLoad slot cur nu a 437 qMul p a q 438 cur = nb6 cur nu 1 439 cur = nb6 cur mu 5 440 qLoad slot cur mu a 441 qConj a 442 qMul q a p 443 cur = nb6 cur mu 5 444 qLoad slot cur mu a 445 qConj a 446 qMul p a q 447 cur = nb6 cur nu 5 448 qLoad slot cur nu a 449 qConj a 450 qMul q a p 451 cur = nb6 cur nu 5 452 qLoad slot cur nu a 453 qConj a 454 qMul p a q 455 ret f64 get q 0 456 end 457 458 fn chair6 slot ulong site ulong d0 ulong d1 ulong d2 ulong to f64 459 a = new f32 4 0.0f32 460 p = new f32 4 0.0f32 461 q = new f32 4 0.0f32 462 cur = site 463 qLoad slot cur d0 p 464 cur = nb6 cur d0 1 465 qLoad slot cur d1 a 466 qMul p a q 467 cur = nb6 cur d1 1 468 qLoad slot cur d2 a 469 qMul q a p 470 cur = nb6 cur d2 1 471 cur = nb6 cur d0 5 472 qLoad slot cur d0 a 473 qConj a 474 qMul p a q 475 cur = nb6 cur d1 5 476 qLoad slot cur d1 a 477 qConj a 478 qMul q a p 479 cur = nb6 cur d2 5 480 qLoad slot cur d2 a 481 qConj a 482 qMul p a q 483 ret f64 get q 0 484 end 485 486 fn putPrim isG ulong p ulong lane ulong val f64 to void 487 idx = add mul isG 240 add mul p W3_LANES lane 488 put osPrim idx val 489 end 490 491 fn getPrim isG ulong p ulong lane ulong to f64 492 idx = add mul isG 240 add mul p W3_LANES lane 493 ret get osPrim idx 494 end 495 496 fn evalSitePlane srcSlot ulong site ulong mu ulong nu ulong to void 497 vp0 = plaq1x1 srcSlot site mu nu 498 put osAcc 0 add get osAcc 0 vp0 499 put osAcc 8 add get osAcc 8 sub mul 4.0f64 mul vp0 vp0 1.0f64 500 if eq mu 0 501 put osAcc 11 add get osAcc 11 vp0 502 end 503 vp1 = plaq1x1 2 site mu nu 504 put osAcc 1 add get osAcc 1 vp1 505 vp2 = plaq1x1 3 site mu nu 506 put osAcc 2 add get osAcc 2 vp2 507 put osAcc 9 add get osAcc 9 sub mul 4.0f64 mul vp2 vp2 1.0f64 508 put osAcc 3 add get osAcc 3 plaq1x1 4 site mu nu 509 put osAcc 4 add get osAcc 4 rect1x2 srcSlot site mu nu 510 vr2 = rect1x2 3 site mu nu 511 put osAcc 5 add get osAcc 5 vr2 512 put osAcc 10 add get osAcc 10 sub mul 4.0f64 mul vr2 vr2 1.0f64 513 put osAcc 6 add get osAcc 6 rect2x2 3 site mu nu 514 end 515 516 fn evalPrims srcSlot ulong lane ulong isG ulong to void 517 apeSmear6 srcSlot 2 0.5f32 518 apeSmear6 2 3 0.5f32 519 apeSmear6 3 4 0.5f32 520 apeSmear6 4 4 0.5f32 521 u = new f32 4 0.0f32 522 qLoad srcSlot 555 0 u 523 putPrim isG 0 lane f64 get u 0 524 lsum = f64 0.0f64 525 for mu ulong 4 526 qLoad srcSlot 555 mu u 527 lsum = add lsum f64 get u 0 528 end 529 putPrim isG 1 lane div lsum 4.0f64 530 for k ulong 16 531 put osAcc k 0.0f64 532 end 533 for site ulong 1296 534 if isInt6 site 535 for mu ulong 4 536 for nu ulong 4 537 if lt mu nu 538 evalSitePlane srcSlot site mu nu 539 end 540 end 541 end 542 put osAcc 7 add get osAcc 7 chair6 3 site 0 1 2 543 end 544 end 545 putPrim isG 2 lane div get osAcc 0 96.0f64 546 putPrim isG 3 lane div get osAcc 1 96.0f64 547 putPrim isG 4 lane div get osAcc 2 96.0f64 548 putPrim isG 5 lane div get osAcc 3 96.0f64 549 putPrim isG 6 lane div get osAcc 4 96.0f64 550 putPrim isG 7 lane div get osAcc 5 96.0f64 551 putPrim isG 8 lane div get osAcc 6 96.0f64 552 putPrim isG 9 lane div get osAcc 7 16.0f64 553 putPrim isG 10 lane div get osAcc 8 96.0f64 554 putPrim isG 11 lane div get osAcc 9 96.0f64 555 putPrim isG 12 lane div get osAcc 10 96.0f64 556 putPrim isG 13 lane mul 0.5f64 add sub 1.0f64 div get osAcc 2 96.0f64 sub 1.0f64 div get osAcc 5 96.0f64 557 putPrim isG 14 lane div get osAcc 11 48.0f64 558 end 559 560 note 4 arms x 4 snapshots = 16 lanes: 561 note arm 0 (lanes 0..3): cold beta=2.30 (strong coupling -> catches chi1 pole!) 562 note arm 1 (lanes 4..7): twist beta=2.30 563 note arm 2 (lanes 8..11): cold beta=2.50 (non-perturbative 2x scaling target) 564 note arm 3 (lanes 12..15): twist beta=2.50 565 fn buildArmSnapshots armIdx ulong to void 566 uRngSeed add 0x333356789abcdef0 mul armIdx 19991 567 q = new f32 4 0.0f32 568 beta = f64 2.30f64 569 if ge armIdx 2 570 beta = f64 2.50f64 571 end 572 isTwist = eq and armIdx 1 1 573 for site ulong 1296 574 c0 = div site 216 575 c1 = rem div site 36 6 576 for mu ulong 4 577 if isBdry6 site 578 if isTwist 579 put q 0 1.0f32 580 put q 1 0.0f32 581 put q 2 0.0f32 582 put q 3 0.0f32 583 if and eq mu 0 and ge c1 3 eq c0 0 584 put q 0 neg 1.0f32 585 end 586 if eq and add c0 c1 1 1 587 put q 1 mul 0.45f32 f32 uRngNorm64 588 put q 2 mul 0.45f32 f32 uRngNorm64 589 put q 3 mul 0.45f32 f32 uRngNorm64 590 qNorm q 591 end 592 else 593 put q 0 1.0f32 594 put q 1 0.0f32 595 put q 2 0.0f32 596 put q 3 0.0f32 597 end 598 else 599 put q 0 0.8f32 600 put q 1 mul 0.3f32 f32 uRngNorm64 601 put q 2 mul 0.3f32 f32 uRngNorm64 602 put q 3 mul 0.3f32 f32 uRngNorm64 603 qNorm q 604 end 605 qStore 0 site mu q 606 end 607 end 608 sweepSu2 beta 32 609 for s ulong 4 610 sweepSu2 beta 10 611 lane = add mul armIdx 4 s 612 evalPrims 0 lane 0 613 applyGaugeTransform 0 1 614 evalPrims 1 lane 1 615 end 616 end 617 618 fn ufbiPriorRank to void 619 put osOpOrder 0 6 620 put osOpOrder 1 3 621 put osOpOrder 2 5 622 put osOpOrder 3 4 623 end 624 625 fn printOpName op ulong to void 626 if eq op 3 627 uPrint tNSub 628 end 629 if eq op 4 630 uPrint tNAdd 631 end 632 if eq op 5 633 uPrint tNMul 634 end 635 if eq op 6 636 uPrint tNDiv 637 end 638 end 639 640 fn quantHashCand to ulong 641 h = ulong 0xcbf29ce484222325 642 for i ulong W3_LANES 643 x = get osCandV i 644 q = long 0 645 if ge x 0.0f64 646 q = long add mul x 256.0f64 0.5f64 647 else 648 q = long sub mul x 256.0f64 0.5f64 649 end 650 h = mul xor h bitcast ulong q 0x100000001b3 651 end 652 if eq h 0 653 h = ulong 1 654 end 655 ret h 656 end 657 658 fn vecCloseCand nid ulong to bool 659 base = mul nid W3_LANES 660 for i ulong W3_LANES 661 if gt uAbs64 sub get osVec add base i get osCandV i 0.004f64 662 ret false 663 end 664 end 665 ret true 666 end 667 668 fn admitVec nNodes ulong to void 669 base = mul nNodes W3_LANES 670 mn = get osCandV 0 671 mx = mn 672 for i ulong W3_LANES 673 v = get osCandV i 674 put osVec add base i v 675 put osGVec add base i get osCandG i 676 if lt v mn 677 mn = v 678 end 679 if gt v mx 680 mx = v 681 end 682 end 683 put osMinV nNodes mn 684 put osMaxV nNodes mx 685 end 686 687 fn admitStore slot ulong h ulong op uchar l ulong r ulong dep uchar to void 688 nNodes = get osSt 0 689 put osHtH slot h 690 put osHtN slot nNodes 691 put osSt 1 add get osSt 1 1 692 put osOp nNodes op 693 put osL nNodes l 694 put osR nNodes r 695 put osDep nNodes dep 696 admitVec nNodes 697 put osSt 0 add nNodes 1 698 end 699 700 fn tryAdmit op uchar l ulong r ulong dep uchar to bool 701 for i ulong W3_LANES 702 if gt uAbs64 sub get osCandV i get osCandG i 0.`0001f64` 703 put osSt 2 add get osSt 2 1 704 ret false 705 end 706 if gt uAbs64 get osCandV i 500.0f64 707 put osSt 6 add get osSt 6 1 708 ret false 709 end 710 end 711 if ge get osSt 1 W3_HT_MAX_OCC 712 ret false 713 end 714 if ge get osSt 0 W3_MAX_NODES 715 ret false 716 end 717 h = quantHashCand 718 slot = and h W3_HT_MASK 719 for pr ulong W3_MAX_PROBES bound 32 720 if gt add pr 1 get osSt 5 721 put osSt 5 add pr 1 722 end 723 cur = get osHtH slot 724 if eq cur 0 725 admitStore slot h op l r dep 726 ret true 727 end 728 if eq cur h 729 if vecCloseCand get osHtN slot 730 put osSt 3 add get osSt 3 1 731 ret false 732 end 733 end 734 slot = and add slot 1 W3_HT_MASK 735 end 736 ret false 737 end 738 739 note INV-4 Pole-Free Denominator Check: 740 note Requires denominator nid to be strictly sign-definite across ALL 16 snapshots 741 note with margin tau=0.15 AND condition ratio max|D|/min|D| <= 4.0. 742 fn isPoleFreeDenom nid ulong to bool 743 mn = get osMinV nid 744 mx = get osMaxV nid 745 if gt mn 0.15f64 746 ret le div mx mn 4.0f64 747 end 748 if lt mx neg 0.15f64 749 ret le div neg mn neg mx 4.0f64 750 end 751 ret false 752 end 753 754 fn armMean nid ulong arm ulong to f64 755 base = add mul nid W3_LANES mul arm 4 756 s = f64 0.0f64 757 for k ulong 4 758 s = add s get osVec add base k 759 end 760 ret mul 0.25f64 s 761 end 762 763 fn armVarSum nid ulong arm ulong mu f64 to f64 764 base = add mul nid W3_LANES mul arm 4 765 s = f64 0.0f64 766 for k ulong 4 767 d = sub get osVec add base k mu 768 s = add s mul d d 769 end 770 ret s 771 end 772 773 fn nodeBulkSigma nid ulong to f64 774 vs = armVarSum nid 0 armMean nid 0 775 vs = add vs armVarSum nid 1 armMean nid 1 776 vs = add vs armVarSum nid 2 armMean nid 2 777 vs = add vs armVarSum nid 3 armMean nid 3 778 ret uSqrt64 div vs 12.0f64 779 end 780 781 note Dimensionless bulk-fluctuation normalized score: 782 note bulk_snr = |cold_b25 - cold_b23| / sigma_bulk 783 note dTw_norm = (|twist_b23 - cold_b23| + |twist_b25 - cold_b25|) / (2 * sigma_bulk) 784 note uv_score = bulk_snr / (dTw_norm + 0.05) (requires bulk_snr >= 1.5 and sigma_bulk >= 1e-4) 785 fn nodeUvScore nid ulong to f64 786 sig = nodeBulkSigma nid 787 if lt sig 0.`0001f64` 788 ret 0.0f64 789 end 790 bulkSnr = div uAbs64 sub armMean nid 2 armMean nid 0 sig 791 if lt bulkSnr 1.5f64 792 ret 0.0f64 793 end 794 dTw = add uAbs64 sub armMean nid 1 armMean nid 0 uAbs64 sub armMean nid 3 armMean nid 2 795 ret div bulkSnr add div mul 0.5f64 dTw sig 0.05f64 796 end 797 798 fn printPrimName p ulong to void 799 if eq p 0 800 uPrint tP0 801 end 802 if eq p 1 803 uPrint tP1 804 end 805 if eq p 2 806 uPrint tP2 807 end 808 if eq p 3 809 uPrint tP3 810 end 811 if eq p 4 812 uPrint tP4 813 end 814 if eq p 5 815 uPrint tP5 816 end 817 if eq p 6 818 uPrint tP6 819 end 820 if eq p 7 821 uPrint tP7 822 end 823 if eq p 8 824 uPrint tP8 825 end 826 if eq p 9 827 uPrint tP9 828 end 829 if eq p 10 830 uPrint tP10 831 end 832 if eq p 11 833 uPrint tP11 834 end 835 if eq p 12 836 uPrint tP12 837 end 838 if eq p 13 839 uPrint tP13 840 end 841 if eq p 14 842 uPrint tP14 843 end 844 end 845 846 fn printExpr nid ulong to void 847 op = get osOp nid 848 if eq op 0 849 printPrimName get osL nid 850 ret 851 end 852 if eq op 1 853 uPrint tOpChi 854 printExpr get osL nid 855 uPrint tRp 856 ret 857 end 858 if eq op 2 859 uPrint tOpSq 860 printExpr get osL nid 861 uPrint tRp 862 ret 863 end 864 if eq op 3 865 uPrint tOpSub 866 end 867 if eq op 4 868 uPrint tOpAdd 869 end 870 if eq op 5 871 uPrint tOpMul 872 end 873 if eq op 6 874 uPrint tOpDiv 875 end 876 printExpr get osL nid 877 uPrint tComma 878 printExpr get osR nid 879 uPrint tRp 880 end 881 882 fn runBfsDepth0 to void 883 put osLvlS 0 0 884 for p ulong 15 885 for i ulong W3_LANES 886 put osCandV i getPrim 0 p i 887 put osCandG i getPrim 1 p i 888 end 889 ok = tryAdmit 0 p 0 0 890 end 891 put osLvlE 0 get osSt 0 892 end 893 894 fn evalBinCand a ulong b ulong op uchar dep uchar to void 895 ba = mul a W3_LANES 896 bb = mul b W3_LANES 897 if eq op 6 898 if not isPoleFreeDenom b 899 put osSt 4 add get osSt 4 1 900 ret 901 end 902 end 903 for i ulong W3_LANES 904 va = get osVec add ba i 905 vb = get osVec add bb i 906 ga = get osGVec add ba i 907 gb = get osGVec add bb i 908 if eq op 3 909 put osCandV i sub va vb 910 put osCandG i sub ga gb 911 end 912 if eq op 4 913 put osCandV i add va vb 914 put osCandG i add ga gb 915 end 916 if eq op 5 917 put osCandV i mul va vb 918 put osCandG i mul ga gb 919 end 920 if eq op 6 921 put osCandV i div va vb 922 put osCandG i div ga gb 923 end 924 end 925 ok = tryAdmit op a b dep 926 end 927 928 fn runBfsDepth1 to void 929 e0 = get osLvlE 0 930 put osLvlS 1 e0 931 for a ulong e0 bound 32 932 ba = mul a W3_LANES 933 for i ulong W3_LANES 934 xa = get osVec add ba i 935 xg = get osGVec add ba i 936 put osCandV i sub mul 4.0f64 mul xa xa 1.0f64 937 put osCandG i sub mul 4.0f64 mul xg xg 1.0f64 938 end 939 ok = tryAdmit 1 a 0 1 940 for i ulong W3_LANES 941 xa = get osVec add ba i 942 xg = get osGVec add ba i 943 put osCandV i mul xa xa 944 put osCandG i mul xg xg 945 end 946 ok = tryAdmit 2 a 0 1 947 end 948 for k ulong 4 949 op = uchar get osOpOrder k 950 for a ulong e0 bound 32 951 for b ulong e0 bound 32 952 evalBinCand a b op 1 953 end 954 end 955 end 956 put osLvlE 1 get osSt 0 957 end 958 959 fn selectTopNodes kMax ulong lim ulong to ulong 960 cnt = ulong 0 961 for i ulong kMax bound 32 962 put osTopIds i 0 963 put osTopScores i 0.0f64 964 end 965 for nid ulong lim bound 16384 966 sc = nodeUvScore nid 967 if gt sc 0.0f64 968 if lt cnt kMax 969 put osTopIds cnt nid 970 put osTopScores cnt sc 971 cnt = add cnt 1 972 else 973 wIdx = ulong 0 974 wSc = get osTopScores 0 975 for j ulong kMax bound 32 976 if lt get osTopScores j wSc 977 wSc = get osTopScores j 978 wIdx = j 979 end 980 end 981 if gt sc wSc 982 put osTopIds wIdx nid 983 put osTopScores wIdx sc 984 end 985 end 986 end 987 end 988 for i ulong cnt bound 32 989 best = i 990 j = add i 1 991 while lt j cnt bound 32 992 if gt get osTopScores j get osTopScores best 993 best = j 994 end 995 j = add j 1 996 end 997 ti = get osTopIds i 998 ts = get osTopScores i 999 put osTopIds i get osTopIds best 1000 put osTopScores i get osTopScores best 1001 put osTopIds best ti 1002 put osTopScores best ts 1003 end 1004 ret cnt 1005 end 1006 1007 fn runBfsWave2 nMined ulong to void 1008 e0 = get osLvlE 0 1009 e1 = get osLvlE 1 1010 put osLvlS 2 e1 1011 for k ulong 4 1012 op = uchar get osOpOrder k 1013 for ti ulong nMined bound 32 1014 a = get osTopIds ti 1015 for b ulong e0 bound 32 1016 evalBinCand a b op 2 1017 evalBinCand b a op 2 1018 end 1019 end 1020 end 1021 for k ulong 4 1022 op = uchar get osOpOrder k 1023 for ti ulong nMined bound 32 1024 a = get osTopIds ti 1025 for tj ulong nMined bound 32 1026 b = get osTopIds tj 1027 evalBinCand a b op 2 1028 end 1029 end 1030 end 1031 for a ulong e1 bound 1024 1032 if eq get osOp a 5 1033 for b ulong e1 bound 1024 1034 if eq get osOp b 2 1035 evalBinCand a b 6 2 1036 end 1037 end 1038 end 1039 end 1040 put osLvlE 2 get osSt 0 1041 end 1042 1043 fn nodeGaugeErr nid ulong to f64 1044 base = mul nid W3_LANES 1045 gerr = f64 0.0f64 1046 for i ulong W3_LANES 1047 e = uAbs64 sub get osVec add base i get osGVec add base i 1048 if gt e gerr 1049 gerr = e 1050 end 1051 end 1052 ret gerr 1053 end 1054 1055 fn printRankedRow rk ulong nid ulong to void 1056 sig = nodeBulkSigma nid 1057 dTw = mul 0.5f64 add uAbs64 sub armMean nid 1 armMean nid 0 uAbs64 sub armMean nid 3 armMean nid 2 1058 uPrintU rk 1059 uPrint tW3Tab 1060 uPrintU nid 1061 uPrint tW3Tab 1062 uPrintU ulong get osDep nid 1063 uPrint tW3Tab 1064 printExpr nid 1065 uPrint tW3Tab 1066 uPrintF64 nodeGaugeErr nid 1067 uPrint tW3Tab 1068 uPrintF64 get osMinV nid 1069 uPrint tW3Tab 1070 uPrintF64 get osMaxV nid 1071 uPrint tW3Tab 1072 uPrintF64 armMean nid 0 1073 uPrint tW3Tab 1074 uPrintF64 armMean nid 1 1075 uPrint tW3Tab 1076 uPrintF64 armMean nid 2 1077 uPrint tW3Tab 1078 uPrintF64 armMean nid 3 1079 uPrint tW3Tab 1080 uPrintF64 sig 1081 uPrint tW3Tab 1082 uPrintF64 div dTw sig 1083 uPrint tW3Tab 1084 uPrintF64 nodeUvScore nid 1085 uPrint tW3Nl 1086 end 1087 1088 fn main to int 1089 uPrint tW3Hdr 1090 for arm ulong 4 1091 buildArmSnapshots arm 1092 end 1093 ufbiPriorRank 1094 uPrint tW3Prior 1095 for k ulong 4 1096 printOpName get osOpOrder k 1097 uPrint tW3Sp 1098 end 1099 uPrint tW3Nl 1100 runBfsDepth0 1101 runBfsDepth1 1102 w1Cnt = get osSt 0 1103 nMined = selectTopNodes 24 w1Cnt 1104 runBfsWave2 nMined 1105 w2Cnt = get osSt 0 1106 uPrint tW3Stat 1107 uPrintU w2Cnt 1108 uPrint tW3GRej 1109 uPrintU get osSt 2 1110 uPrint tW3EPrun 1111 uPrintU get osSt 3 1112 uPrint tW3Pole 1113 uPrintU get osSt 4 1114 uPrint tW3Occ 1115 uPrintU get osSt 1 1116 uPrint tW3MPr 1117 uPrintU get osSt 5 1118 uPrint tW3Wave1 1119 uPrintU w1Cnt 1120 uPrint tW3Wave2 1121 uPrintU sub w2Cnt w1Cnt 1122 uPrint tW3Nl 1123 uPrint tW3Col 1124 nTop = selectTopNodes 20 w2Cnt 1125 for r ulong nTop bound 20 1126 printRankedRow add r 1 get osTopIds r 1127 end 1128 if lt get osSt 2 2 1129 ret 1 1130 end 1131 if eq get osSt 4 0 1132 ret 2 1133 end 1134 uPrint tW3Pass 1135 ret 0 1136 end