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_check6_gb10.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_check6_gb10.om` 1274 lines ยท 26498 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note src/ufbi_check6_gb10.om: Pure Seeded-OM-2 Zero-CUDA GB10 Runner for UFBI Check #6 3 note (High-Statistics 512-Sweep 3-Point Physically-Scaled SU(2) Continuum Ladder L in {8, 12, 16} 4 note + Beta=6.0 Gapless Control + Out-of-Sample Scaled Wave-3 Symanzik-Like Observable Test). 5 note 6 note Upgrades over Check #5 (src/ufbi_check5_gb10.om): 7 note 1. 3-Point Non-Perturbative a*sqrt(sigma) Matched Ladder (l*sqrt(sigma) ~ 2.95..2.98): 8 note L=8, beta=2.300: r_mode=0 (1x1, area=1), n_s=1 (alpha=0.50 -> sqrt(1)*a8 = 1.00 a8) 9 note L=12, beta=2.426: r_mode=1 (1x2, area=2), n_s=2 (alpha=0.50 -> sqrt(2)*a12 = 0.94 a8) 10 note L=16, beta=2.500: r_mode=2 (2x2, area=4), n_s=4 (alpha=0.50 -> sqrt(4)*a16 = 1.00 a8) 11 note 2. 3.2x-4x higher statistics: 512 measurement sweeps (16-block jackknife = 32 sweeps/block), 12 note 2 GPU sweeps between measurements (1024 sweeps/arm), using halo-only link downloads 13 note for fast turnaround on GB10. 14 note 3. Out-of-sample scaled Wave-3 Symanzik-like observable test: 15 note O2 = W3_sym_scaled = P(t1) - (R1x2(0) - Chair6(t2)) with EXACT physical APE flow-time 16 note matching t_flow = (alpha/6)*n_s*a^2 held constant across all 3 spacings: 17 note L=8: alpha_w3=0.25000, (n1=1, n2=2) -> t1=(1/24)*a8^2, t2=(2/24)*a8^2 18 note L=12: alpha_w3=0.28125, (n1=2, n2=4) -> t1=(1/24)*a8^2, t2=(2/24)*a8^2 19 note L=16: alpha_w3=0.50000, (n1=2, n2=4) -> t1=(1/24)*a8^2, t2=(2/24)*a8^2 20 note O3 = W3_sym_fixed (unscaled lattice-unit control: alpha=0.50, n1=1, n2=2) to directly 21 note distinguish continuum stability from finite-a cancellation! 22 note 4. Runtime ZERO_CONTACT_ASSERT verifies max_direct_err == 0.000000 across ALL 5 observables 23 note on ALL 6 geometries before running MC. 24 note 25 note Composed after: 26 note gpu/nvidia/native/nvrm/context.om 27 note gpu/nvidia/native/blackwell/vector.om 28 note gpu/nvidia/native/blackwell/launch.om 29 note gpu/nvidia/native/blackwell/batch.om 30 note om/encoder/bw_enc_sm121.om 31 note src/ufbi_math.om 32 note src/ufbi_check3_kernels.om 33 34 global uCodePos ulong 1 35 global uEntry ulong 8 36 global uCodeMap long 1 37 global uCodeFail uint 1 38 global uBind uint 32 39 global uBindN ulong 1 40 global uDirty uint 1 41 42 global dLinks long 1 43 global dStaples long 1 44 global dFlags long 1 45 global dNbSite long 1 46 global dRng long 1 47 48 note Host link buffers (L<=16 -> 65536 sites x 16 f32 = `1048576` f32 each) 49 global hLinks f32 `1048576` 50 global hSm1 f32 `1048576` 51 global hSm2 f32 `1048576` 52 global hNb uint 524288 53 global hStage uchar 65536 54 55 note 5 observables x 512 sweeps = 2560 f64 56 global tsData f64 2560 57 global baseMean f64 5 58 global baseErr f64 5 59 global baseSig f64 5 60 global curMean f64 5 61 global curErr f64 5 62 global curSig f64 5 63 global curDelta f64 5 64 global curZ f64 5 65 global curRBulk f64 5 66 global mcAcc f64 8 67 global mcCnt ulong 2 68 global armBeta f32 1 69 global armSeed ulong 1 70 global armC1 ulong 1 71 global armC2 ulong 1 72 global armRMode ulong 1 73 global armNSmear ulong 1 74 global apeAlpha f32 1 75 76 text tC6Hdr "=== UFBI CHECK #6: HIGH-STATS 512-SWEEP 3-POINT SCALED CONTINUUM LADDER & WAVE-3 TEST (PURE OM-2 GB10) ===\n" 77 text tC6Err "FAIL: GB10 native NVRM/kernel error stage=" 78 text tC6ZcFail "FAIL: ZERO_CONTACT_ASSERT violated! err=" 79 text tC6ZcOk "ZERO_CONTACT_ASSERT L=" 80 text tC6ZcR " r_mode=" 81 text tC6ZcN " n_smear=" 82 text tC6ZcE " max_direct_err=" 83 text tC6ZcP " status=PASS\n" 84 text tC6Cols "exp\tL\tbeta\tr_mode\tn_s\tcollar\tsweeps\tO0_d\tO0_Z\tO0_Rbulk\tO1_d\tO1_Z\tO1_Rbulk\tO2_d\tO2_Z\tO2_Rbulk\tO3_d\tO3_Z\tO3_Rbulk\tO4_d\tO4_Z\tO4_Rbulk\tO0_m\tO0_sig\tO2_m\tO2_sig\tus\n" 85 text tTab "\t" 86 text tNl "\n" 87 text tE6B "phys_scaled_su2" 88 text tE6C "gapless_ctrl_b6" 89 text tK0 "C0_cold" 90 text tK3 "C3_hot_haar" 91 text tK6 "C6_trick_vort" 92 text tC6Done "CHECK6_GB10_DONE status=PASS zero_contact_verified=1\n" 93 94 fn uCodeWrite w view ulong 4 to void 95 p = get uCodePos 0 96 b = new uchar 16 0 97 if gt get uCodeMap 0 0 98 for i ulong 16 99 put b i uchar and shr get w div i 4 mul rem i 4 8 255 100 end 101 if ne mapwrite get uCodeMap 0 p b 0 16 16 102 put uCodeFail 0 1 103 end 104 end 105 put uCodePos 0 add p 16 106 end 107 108 fn uEmitAllKernels to void 109 put uCodePos 0 0 110 for id ulong 3 111 p = mul div add get uCodePos 0 255 256 256 112 put uEntry id p 113 put uCodePos 0 p 114 put uPc 0 0 115 put uGuard 0 0 116 ok = false 117 if eq id 0 118 ok = uEmitSu2Staple 119 end 120 if eq id 1 121 ok = uEmitSu2Overrelax 122 end 123 if eq id 2 124 ok = uEmitSu2Heatbath 125 end 126 if not ok 127 exit 4 128 end 129 uDone 130 end 131 end 132 133 fn uArg u uint to void 134 i = get uBindN 0 135 put uBind i u 136 put uBindN 0 add i 1 137 end 138 139 fn uPtr va ulong to void 140 uArg gblo va 141 uArg gbhi va 142 end 143 144 fn uRecord id ulong gx uint bx uint to bool 145 gbqmd 1 146 a = add mapaddr get uCodeMap 0 get uEntry id 147 put gbq1 32 gblo shr a 4 148 put gbq1 33 or uint and shr a 36 `2097151` `20971520` 149 put gbq1 59 gblo shr a 8 150 put gbq1 34 or uint 65536 bx 151 put gbq1 35 or uint 131073 shl uint 64 8 152 put gbq1 36 `78923784` 153 put gbq1 37 0 154 put gbq1 39 gx 155 put gbq1 40 1 156 put gbq1 41 1 157 put gbcb 216 bx 158 put gbcb 220 gx 159 put gbcb 221 1 160 put gbcb 222 1 161 cb = mapaddr get gbmem 1 162 words = get uBindN 0 163 endva = add cb add 896 mul words 4 164 put gbcb 212 gbhi endva 165 put gbcb 213 gblo endva 166 put gbused 0 0 167 gbsetup 168 if ne get uDirty 0 0 169 gbmth 0 40 4 170 gbemit 0 171 gbemit 0 172 gbemit 0 173 gbemit `2281701376` 174 put uDirty 0 0 175 end 176 gbdma cb 224 177 for j ulong 224 178 gbemit get gbcb j 179 end 180 gbdma add cb 896 uint words 181 for j ulong words bound 32 182 gbemit get uBind j 183 end 184 q = mapaddr get gbmem 2 185 gbinline q false 186 gbdma add q 8192 1 187 gbemit 1 188 gbinline add q 4096 true 189 gbrel add mapaddr get gbmem 3 32 6 190 put uBindN 0 0 191 ret gbappend id get gbst 1 192 end 193 194 fn uRunKernel id ulong gx uint bx uint to bool 195 put uDirty 0 1 196 if not gbbegin 1 197 ret false 198 end 199 if not uRecord id gx bx 200 ret false 201 end 202 ret gbbsubmit `2000000000` 203 end 204 205 fn stageU32 k ulong v uint to void 206 b = mul k 4 207 put hStage b uchar and v 255 208 put hStage add b 1 uchar and shr v 8 255 209 put hStage add b 2 uchar and shr v 16 255 210 put hStage add b 3 uchar and shr v 24 255 211 end 212 213 fn stageF32 k ulong v f32 to void 214 stageU32 k bitcast uint v 215 end 216 217 fn flushStage m long offBytes ulong nWords ulong to bool 218 nb = mul nWords 4 219 ret eq mapwrite m offBytes hStage 0 nb long nb 220 end 221 222 fn uploadLinks N ulong to bool 223 totalF = mul N 16 224 off = ulong 0 225 while lt off totalF bound 128 226 cnt = sub totalF off 227 if gt cnt 16384 228 cnt = ulong 16384 229 end 230 for k ulong cnt bound 16384 231 stageF32 k get hLinks add off k 232 end 233 if not flushStage get dLinks 0 mul off 4 cnt 234 ret false 235 end 236 off = add off cnt 237 end 238 ret true 239 end 240 241 fn coordIdx c0 ulong c1 ulong c2 ulong c3 ulong L ulong to ulong 242 r = add mul c0 L c1 243 r = add mul r L c2 244 ret add mul r L c3 245 end 246 247 fn buildNbTable L ulong to bool 248 N = mul mul L L mul L L 249 for s ulong N bound 65536 250 c3 = rem s L 251 t = div s L 252 c2 = rem t L 253 t = div t L 254 c1 = rem t L 255 c0 = div t L 256 b = mul s 8 257 put hNb b uint coordIdx rem add c0 1 L c1 c2 c3 L 258 put hNb add b 1 uint coordIdx rem add c0 sub L 1 L c1 c2 c3 L 259 put hNb add b 2 uint coordIdx c0 rem add c1 1 L c2 c3 L 260 put hNb add b 3 uint coordIdx c0 rem add c1 sub L 1 L c2 c3 L 261 put hNb add b 4 uint coordIdx c0 c1 rem add c2 1 L c3 L 262 put hNb add b 5 uint coordIdx c0 c1 rem add c2 sub L 1 L c3 L 263 put hNb add b 6 uint coordIdx c0 c1 c2 rem add c3 1 L L 264 put hNb add b 7 uint coordIdx c0 c1 c2 rem add c3 sub L 1 L L 265 end 266 totalW = mul N 8 267 off = ulong 0 268 while lt off totalW bound 64 269 cnt = sub totalW off 270 if gt cnt 16384 271 cnt = ulong 16384 272 end 273 for k ulong cnt bound 16384 274 stageU32 k get hNb add off k 275 end 276 if not flushStage get dNbSite 0 mul off 4 cnt 277 ret false 278 end 279 off = add off cnt 280 end 281 ret true 282 end 283 284 fn isBdryL s ulong L ulong to bool 285 c3 = rem s L 286 t = div s L 287 c2 = rem t L 288 t = div t L 289 c1 = rem t L 290 c0 = div t L 291 lm1 = sub L 1 292 if or eq c0 0 eq c0 lm1 293 ret true 294 end 295 if or eq c1 0 eq c1 lm1 296 ret true 297 end 298 if or eq c2 0 eq c2 lm1 299 ret true 300 end 301 if or eq c3 0 eq c3 lm1 302 ret true 303 end 304 ret false 305 end 306 307 fn isBox4 s ulong L ulong lo ulong hi ulong to bool 308 c3 = rem s L 309 t = div s L 310 c2 = rem t L 311 t = div t L 312 c1 = rem t L 313 c0 = div t L 314 if or lt c0 lo ge c0 hi 315 ret false 316 end 317 if or lt c1 lo ge c1 hi 318 ret false 319 end 320 if or lt c2 lo ge c2 hi 321 ret false 322 end 323 if or lt c3 lo ge c3 hi 324 ret false 325 end 326 ret true 327 end 328 329 note Fast halo-only link download from GPU dLinks into host hLinks for sites in [lo, hi)^4 330 fn downloadHalo L ulong lo ulong hi ulong to void 331 N = mul mul L L mul L L 332 lm = get dLinks 0 333 for s ulong N bound 65536 334 if isBox4 s L lo hi 335 base = mul s 16 336 for k ulong 16 337 put hLinks add base k bitcast f32 uint mapget lm mul add base k 4 4 338 end 339 end 340 end 341 end 342 343 fn siteFlag s ulong L ulong freezeCollar bool to uint 344 if and freezeCollar isBdryL s L 345 ret uint 2 346 end 347 c3 = rem s L 348 t = div s L 349 c2 = rem t L 350 t = div t L 351 c1 = rem t L 352 c0 = div t L 353 ret uint and add add c0 c1 add c2 c3 1 354 end 355 356 fn buildFlags L ulong freezeCollar bool to bool 357 N = mul mul L L mul L L 358 totalW = mul N 4 359 off = ulong 0 360 while lt off totalW bound 32 361 cnt = sub totalW off 362 if gt cnt 16384 363 cnt = ulong 16384 364 end 365 for k ulong cnt bound 16384 366 stageU32 k siteFlag div add off k 4 L freezeCollar 367 end 368 if not flushStage get dFlags 0 mul off 4 cnt 369 ret false 370 end 371 off = add off cnt 372 end 373 ret true 374 end 375 376 fn seedGpuRng N ulong seed ulong to bool 377 uRngSeed seed 378 off = ulong 0 379 while lt off N bound 16 380 cnt = sub N off 381 if gt cnt 16384 382 cnt = ulong 16384 383 end 384 for k ulong cnt bound 16384 385 r = uint and uRngNext 0xffffffff 386 if eq r 0 387 r = uint 0x9e3779b9 388 end 389 stageU32 k r 390 end 391 if not flushStage get dRng 0 mul off 4 cnt 392 ret false 393 end 394 off = add off cnt 395 end 396 ret true 397 end 398 399 fn qNormHost base ulong to void 400 a0 = get hLinks base 401 a1 = get hLinks add base 1 402 a2 = get hLinks add base 2 403 a3 = get hLinks add base 3 404 n2 = add add mul a0 a0 mul a1 a1 add mul a2 a2 mul a3 a3 405 if le n2 0.`0000000001f32` 406 put hLinks base 1.0f32 407 put hLinks add base 1 0.0f32 408 put hLinks add base 2 0.0f32 409 put hLinks add base 3 0.0f32 410 ret 411 end 412 inv = f32 div 1.0f64 uSqrt64 f64 n2 413 put hLinks base mul a0 inv 414 put hLinks add base 1 mul a1 inv 415 put hLinks add base 2 mul a2 inv 416 put hLinks add base 3 mul a3 inv 417 end 418 419 fn setCollarLink s ulong mu ulong L ulong cid ulong to void 420 base = mul add mul s 4 mu 4 421 put hLinks base 1.0f32 422 put hLinks add base 1 0.0f32 423 put hLinks add base 2 0.0f32 424 put hLinks add base 3 0.0f32 425 if eq cid 0 426 ret 427 end 428 if eq cid 3 429 put hLinks base f32 uRngNorm64 430 put hLinks add base 1 f32 uRngNorm64 431 put hLinks add base 2 f32 uRngNorm64 432 put hLinks add base 3 f32 uRngNorm64 433 qNormHost base 434 ret 435 end 436 c3 = rem s L 437 c2 = rem div s L L 438 c1 = rem div s mul L L L 439 c0 = div s mul mul L L L 440 if eq cid 6 441 if eq and add c0 c1 1 1 442 put hLinks base neg 0.5f32 443 put hLinks add base 1 0.5f32 444 put hLinks add base 2 neg 0.5f32 445 put hLinks add base 3 0.5f32 446 else 447 put hLinks base 0.0f32 448 put hLinks add base 1 neg 0.`70710678f32` 449 put hLinks add base 2 0.`70710678f32` 450 put hLinks add base 3 0.0f32 451 end 452 end 453 end 454 455 fn initLatticeHost L ulong cid ulong freezeCollar bool seed ulong to void 456 N = mul mul L L mul L L 457 uRngSeed seed 458 for s ulong N bound 65536 459 isB = and freezeCollar isBdryL s L 460 for mu ulong 4 461 if isB 462 setCollarLink s mu L cid 463 else 464 base = mul add mul s 4 mu 4 465 put hLinks base 0.85f32 466 put hLinks add base 1 mul 0.25f32 f32 uRngNorm64 467 put hLinks add base 2 mul 0.25f32 f32 uRngNorm64 468 put hLinks add base 3 mul 0.25f32 f32 uRngNorm64 469 qNormHost base 470 end 471 end 472 end 473 end 474 475 fn initLattice L ulong cid ulong freezeCollar bool seed ulong to bool 476 N = mul mul L L mul L L 477 initLatticeHost L cid freezeCollar seed 478 ret uploadLinks N 479 end 480 481 fn gpuRunStaple N ulong mu ulong par ulong to bool 482 gx = uint div add N 255 256 483 nu0 = ulong 0 484 nu1 = ulong 1 485 nu2 = ulong 2 486 if eq mu 0 487 nu0 = ulong 1 488 nu1 = ulong 2 489 nu2 = ulong 3 490 end 491 if eq mu 1 492 nu0 = ulong 0 493 nu1 = ulong 2 494 nu2 = ulong 3 495 end 496 if eq mu 2 497 nu0 = ulong 0 498 nu1 = ulong 1 499 nu2 = ulong 3 500 end 501 uPtr mapaddr get dLinks 0 502 uPtr mapaddr get dStaples 0 503 uPtr mapaddr get dFlags 0 504 uPtr mapaddr get dNbSite 0 505 uArg uint N 506 uArg uint mu 507 uArg uint par 508 uArg uint nu0 509 uArg uint nu1 510 uArg uint nu2 511 ret uRunKernel 0 gx 256 512 end 513 514 fn gpuRunOverrelax N ulong mu ulong par ulong to bool 515 gx = uint div add N 255 256 516 uPtr mapaddr get dLinks 0 517 uPtr mapaddr get dStaples 0 518 uPtr mapaddr get dFlags 0 519 uArg uint N 520 uArg uint mu 521 uArg uint par 522 ret uRunKernel 1 gx 256 523 end 524 525 fn gpuRunHeatbath N ulong mu ulong par ulong beta f32 to bool 526 gx = uint div add N 255 256 527 uPtr mapaddr get dLinks 0 528 uPtr mapaddr get dStaples 0 529 uPtr mapaddr get dFlags 0 530 uPtr mapaddr get dRng 0 531 uArg uint N 532 uArg uint mu 533 uArg uint par 534 uArg bitcast uint beta 535 ret uRunKernel 2 gx 256 536 end 537 538 fn gpuSweep N ulong beta f32 nOr ulong to bool 539 for mu ulong 4 540 for par ulong 2 541 if not gpuRunStaple N mu par 542 ret false 543 end 544 if not gpuRunHeatbath N mu par beta 545 ret false 546 end 547 for r ulong nOr bound 8 548 if not gpuRunStaple N mu par 549 ret false 550 end 551 if not gpuRunOverrelax N mu par 552 ret false 553 end 554 end 555 end 556 end 557 ret true 558 end 559 560 note ========================================================================= 561 note Host Quaternion Helpers + Parameterized-Alpha Exact-Box APE Smearing 562 note ========================================================================= 563 fn hQMul a view f32 4 b view f32 4 o edit f32 4 to void 564 v = mul get a 0 get b 0 565 v = sub v mul get a 1 get b 1 566 v = sub v mul get a 2 get b 2 567 v = sub v mul get a 3 get b 3 568 put o 0 v 569 v = mul get a 0 get b 1 570 v = add v mul get a 1 get b 0 571 v = add v mul get a 2 get b 3 572 v = sub v mul get a 3 get b 2 573 put o 1 v 574 v = mul get a 0 get b 2 575 v = sub v mul get a 1 get b 3 576 v = add v mul get a 2 get b 0 577 v = add v mul get a 3 get b 1 578 put o 2 v 579 v = mul get a 0 get b 3 580 v = add v mul get a 1 get b 2 581 v = sub v mul get a 2 get b 1 582 v = add v mul get a 3 get b 0 583 put o 3 v 584 end 585 586 fn hQConj q edit f32 4 to void 587 put q 1 neg get q 1 588 put q 2 neg get q 2 589 put q 3 neg get q 3 590 end 591 592 fn hQNorm q edit f32 4 to void 593 n2 = mul get q 0 get q 0 594 n2 = add n2 mul get q 1 get q 1 595 n2 = add n2 mul get q 2 get q 2 596 n2 = add n2 mul get q 3 get q 3 597 if le n2 0.`0000000001f32` 598 put q 0 1.0f32 599 put q 1 0.0f32 600 put q 2 0.0f32 601 put q 3 0.0f32 602 ret 603 end 604 inv = f32 div 1.0f64 uSqrt64 f64 n2 605 for c ulong 4 606 put q c mul get q c inv 607 end 608 end 609 610 fn hLoadS slot ulong s ulong mu ulong dst edit f32 4 to void 611 b = mul add mul s 4 mu 4 612 if eq slot 0 613 put dst 0 get hLinks b 614 put dst 1 get hLinks add b 1 615 put dst 2 get hLinks add b 2 616 put dst 3 get hLinks add b 3 617 ret 618 end 619 if eq slot 1 620 put dst 0 get hSm1 b 621 put dst 1 get hSm1 add b 1 622 put dst 2 get hSm1 add b 2 623 put dst 3 get hSm1 add b 3 624 ret 625 end 626 put dst 0 get hSm2 b 627 put dst 1 get hSm2 add b 1 628 put dst 2 get hSm2 add b 2 629 put dst 3 get hSm2 add b 3 630 end 631 632 fn hStoreS slot ulong s ulong mu ulong src view f32 4 to void 633 b = mul add mul s 4 mu 4 634 if eq slot 1 635 put hSm1 b get src 0 636 put hSm1 add b 1 get src 1 637 put hSm1 add b 2 get src 2 638 put hSm1 add b 3 get src 3 639 ret 640 end 641 put hSm2 b get src 0 642 put hSm2 add b 1 get src 1 643 put hSm2 add b 2 get src 2 644 put hSm2 add b 3 get src 3 645 end 646 647 fn getNb s ulong dir ulong isMinus ulong to ulong 648 ret ulong get hNb add mul s 8 add mul dir 2 isMinus 649 end 650 651 fn hStapleAdd slot ulong s ulong mu ulong nu ulong isBack bool dst edit f32 4 to void 652 t1 = new f32 4 0.0f32 653 t2 = new f32 4 0.0f32 654 t3 = new f32 4 0.0f32 655 p1 = new f32 4 0.0f32 656 p2 = new f32 4 0.0f32 657 xp = getNb s mu 0 658 if not isBack 659 hLoadS slot s nu t1 660 hLoadS slot getNb s nu 0 mu t2 661 hLoadS slot xp nu t3 662 hQConj t3 663 else 664 xm = getNb s nu 1 665 hLoadS slot xm nu t1 666 hQConj t1 667 hLoadS slot xm mu t2 668 hLoadS slot getNb xp nu 1 nu t3 669 end 670 hQMul t1 t2 p1 671 hQMul p1 t3 p2 672 for c ulong 4 673 put dst c add get dst c get p2 c 674 end 675 end 676 677 fn hApeLink srcSlot ulong dstSlot ulong s ulong mu ulong to void 678 st = new f32 4 0.0f32 679 u = new f32 4 0.0f32 680 al = get apeAlpha 0 681 w0 = sub 1.0f32 al 682 w1 = div al 6.0f32 683 for nu ulong 4 684 if ne nu mu 685 hStapleAdd srcSlot s mu nu false st 686 hStapleAdd srcSlot s mu nu true st 687 end 688 end 689 hLoadS srcSlot s mu u 690 for c ulong 4 691 put u c add mul w0 get u c mul w1 get st c 692 end 693 hQNorm u 694 hStoreS dstSlot s mu u 695 end 696 697 fn hApeBox L ulong srcSlot ulong dstSlot ulong lo ulong hi ulong to void 698 N = mul mul L L mul L L 699 for s ulong N bound 65536 700 if isBox4 s L lo hi 701 for mu ulong 4 702 hApeLink srcSlot dstSlot s mu 703 end 704 end 705 end 706 end 707 708 fn runApeChain L ulong nSmear ulong needLo ulong needHi ulong to ulong 709 if eq nSmear 0 710 ret ulong 0 711 end 712 src = ulong 0 713 dst = ulong 1 714 for step ulong nSmear bound 8 715 remSteps = sub sub nSmear 1 step 716 lo = sub needLo remSteps 717 hi = add needHi remSteps 718 hApeBox L src dst lo hi 719 src = dst 720 if eq dst 1 721 dst = ulong 2 722 else 723 dst = ulong 1 724 end 725 end 726 ret src 727 end 728 729 fn hPlaqS slot ulong s ulong mu ulong nu ulong to f64 730 a = new f32 4 0.0f32 731 b = new f32 4 0.0f32 732 p = new f32 4 0.0f32 733 q = new f32 4 0.0f32 734 hLoadS slot s mu a 735 hLoadS slot getNb s mu 0 nu b 736 hQMul a b p 737 hLoadS slot getNb s nu 0 mu a 738 hQConj a 739 hQMul p a q 740 hLoadS slot s nu b 741 hQConj b 742 hQMul q b p 743 ret f64 get p 0 744 end 745 746 fn hRect1x2S slot ulong s ulong mu ulong nu ulong to f64 747 a = new f32 4 0.0f32 748 b = new f32 4 0.0f32 749 p = new f32 4 0.0f32 750 q = new f32 4 0.0f32 751 s1 = getNb s mu 0 752 s2 = getNb s1 mu 0 753 hLoadS slot s mu a 754 hLoadS slot s1 mu b 755 hQMul a b p 756 hLoadS slot s2 nu a 757 hQMul p a q 758 hLoadS slot getNb s1 nu 0 mu a 759 hQConj a 760 hQMul q a p 761 hLoadS slot getNb s nu 0 mu a 762 hQConj a 763 hQMul p a q 764 hLoadS slot s nu b 765 hQConj b 766 hQMul q b p 767 ret f64 get p 0 768 end 769 770 fn hRect2x2S slot ulong s ulong mu ulong nu ulong to f64 771 a = new f32 4 0.0f32 772 p = new f32 4 0.0f32 773 q = new f32 4 0.0f32 774 cur = s 775 hLoadS slot cur mu p 776 cur = getNb cur mu 0 777 hLoadS slot cur mu a 778 hQMul p a q 779 cur = getNb cur mu 0 780 hLoadS slot cur nu a 781 hQMul q a p 782 cur = getNb cur nu 0 783 hLoadS slot cur nu a 784 hQMul p a q 785 cur = getNb cur nu 0 786 cur = getNb cur mu 1 787 hLoadS slot cur mu a 788 hQConj a 789 hQMul q a p 790 cur = getNb cur mu 1 791 hLoadS slot cur mu a 792 hQConj a 793 hQMul p a q 794 cur = getNb cur nu 1 795 hLoadS slot cur nu a 796 hQConj a 797 hQMul q a p 798 cur = getNb cur nu 1 799 hLoadS slot cur nu a 800 hQConj a 801 hQMul p a q 802 ret f64 get q 0 803 end 804 805 fn hChair6S slot ulong s ulong d0 ulong d1 ulong d2 ulong to f64 806 a = new f32 4 0.0f32 807 p = new f32 4 0.0f32 808 q = new f32 4 0.0f32 809 cur = s 810 hLoadS slot cur d0 p 811 cur = getNb cur d0 0 812 hLoadS slot cur d1 a 813 hQMul p a q 814 cur = getNb cur d1 0 815 hLoadS slot cur d2 a 816 hQMul q a p 817 cur = getNb cur d2 0 818 cur = getNb cur d0 1 819 hLoadS slot cur d0 a 820 hQConj a 821 hQMul p a q 822 cur = getNb cur d1 1 823 hLoadS slot cur d1 a 824 hQConj a 825 hQMul q a p 826 cur = getNb cur d2 1 827 hLoadS slot cur d2 a 828 hQConj a 829 hQMul p a q 830 ret f64 get q 0 831 end 832 833 note ========================================================================= 834 note Measurement Engine for Check #6: 835 note O0: W_phys (scaled smeared loop: L=8 1x1 n=1; L=12 1x2 n=2; L=16 2x2 n=4) 836 note O1: Adj_phys (4*W_phys^2 - 1) 837 note O2: W3_sym_scaled (Wave-3 Symanzik-like P(t1) - (R1x2(0) - Chair6(t2)), flow-time matched!) 838 note O3: W3_sym_fixed (Wave-3 Symanzik-like at fixed lattice steps alpha=0.50, n1=1, n2=2) 839 note O4: W_bare_phys (unsmeared scaled loop: L=8 1x1; L=12 1x2; L=16 2x2) 840 note ========================================================================= 841 fn accumMainSite s ulong sl ulong rMode ulong to void 842 for mu ulong 4 843 for nu ulong 4 844 if lt mu nu 845 vs = f64 0.0f64 846 vb = f64 0.0f64 847 if eq rMode 0 848 vs = hPlaqS sl s mu nu 849 vb = hPlaqS 0 s mu nu 850 end 851 if eq rMode 1 852 vs = hRect1x2S sl s mu nu 853 vb = hRect1x2S 0 s mu nu 854 end 855 if eq rMode 2 856 vs = hRect2x2S sl s mu nu 857 vb = hRect2x2S 0 s mu nu 858 end 859 put mcAcc 0 add get mcAcc 0 vs 860 put mcAcc 1 add get mcAcc 1 sub mul 4.0f64 mul vs vs 1.0f64 861 put mcAcc 2 add get mcAcc 2 vb 862 put mcCnt 0 add get mcCnt 0 1 863 end 864 end 865 end 866 end 867 868 fn evalCtrPlaq sl ulong ctrSite ulong to f64 869 s = f64 0.0f64 870 for mu ulong 4 871 for nu ulong 4 872 if lt mu nu 873 s = add s hPlaqS sl ctrSite mu nu 874 end 875 end 876 end 877 ret div s 6.0f64 878 end 879 880 fn evalCtrRect0 ctrSite ulong to f64 881 s = f64 0.0f64 882 for mu ulong 4 883 for nu ulong 4 884 if lt mu nu 885 s = add s hRect1x2S 0 ctrSite mu nu 886 end 887 end 888 end 889 ret div s 6.0f64 890 end 891 892 fn evalCtrChair sl ulong ctrSite ulong to f64 893 c = hChair6S sl ctrSite 0 1 2 894 c = add c hChair6S sl ctrSite 0 1 3 895 c = add c hChair6S sl ctrSite 0 2 3 896 c = add c hChair6S sl ctrSite 1 2 3 897 ret mul 0.25f64 c 898 end 899 900 note Evaluate Wave-3 Symanzik-like P(n1) - (R1x2(0) - Chair6(n2)) at exact center site lo 901 fn evalWave3Sym L ulong lo ulong al f32 n1 ulong n2 ulong to f64 902 ctrSite = coordIdx lo lo lo lo L 903 r0 = evalCtrRect0 ctrSite 904 put apeAlpha 0 al 905 sl1 = runApeChain L n1 lo add lo 2 906 p1 = evalCtrPlaq sl1 ctrSite 907 sl2 = runApeChain L n2 lo add lo 2 908 ch2 = evalCtrChair sl2 ctrSite 909 ret sub p1 sub r0 ch2 910 end 911 912 fn evalHost6Main L ulong rMode ulong nSmear ulong res edit f64 5 to void 913 lo = ulong 3 914 hi = ulong 5 915 needHi = ulong 6 916 if eq L 12 917 lo = ulong 5 918 hi = ulong 7 919 needHi = ulong 9 920 end 921 if eq L 16 922 lo = ulong 6 923 hi = ulong 8 924 needHi = ulong 10 925 end 926 put apeAlpha 0 0.50f32 927 sl = runApeChain L nSmear lo needHi 928 put mcAcc 0 0.0f64 929 put mcAcc 1 0.0f64 930 put mcAcc 2 0.0f64 931 put mcCnt 0 0 932 N = mul mul L L mul L L 933 for s ulong N bound 65536 934 if isBox4 s L lo hi 935 accumMainSite s sl rMode 936 end 937 end 938 fc = f64 get mcCnt 0 939 put res 0 div get mcAcc 0 fc 940 put res 1 div get mcAcc 1 fc 941 put res 4 div get mcAcc 2 fc 942 end 943 944 fn evalHost6W3 L ulong res edit f64 5 to void 945 ctrLo = ulong 3 946 w3Al = f32 0.25f32 947 w3N1 = ulong 1 948 w3N2 = ulong 2 949 if eq L 12 950 ctrLo = ulong 5 951 w3Al = f32 0.`28125f32` 952 w3N1 = ulong 2 953 w3N2 = ulong 4 954 end 955 if eq L 16 956 ctrLo = ulong 7 957 w3Al = f32 0.50f32 958 w3N1 = ulong 2 959 w3N2 = ulong 4 960 end 961 put res 2 evalWave3Sym L ctrLo w3Al w3N1 w3N2 962 put res 3 evalWave3Sym L ctrLo 0.50f32 1 2 963 end 964 965 fn evalHost6 L ulong rMode ulong nSmear ulong res edit f64 5 to void 966 evalHost6Main L rMode nSmear res 967 evalHost6W3 L res 968 end 969 970 fn assertZeroContact6 L ulong rMode ulong nSmear ulong to void 971 N = mul mul L L mul L L 972 initLatticeHost L 0 true 0x77771234 973 v0 = new f64 5 0.0f64 974 v1 = new f64 5 0.0f64 975 evalHost6 L rMode nSmear v0 976 uRngSeed 0x99995678 977 for s ulong N bound 65536 978 if isBdryL s L 979 for mu ulong 4 980 setCollarLink s mu L 3 981 end 982 end 983 end 984 evalHost6 L rMode nSmear v1 985 maxE = f64 0.0f64 986 for o ulong 5 987 e = uAbs64 sub get v1 o get v0 o 988 if gt e maxE 989 maxE = e 990 end 991 end 992 if gt maxE 0.`000000000001f64` 993 uPrint tC6ZcFail 994 uPrintF64 maxE 995 uPrint tNl 996 exit 99 997 end 998 uPrint tC6ZcOk 999 uPrintU L 1000 uPrint tC6ZcR 1001 uPrintU rMode 1002 uPrint tC6ZcN 1003 uPrintU nSmear 1004 uPrint tC6ZcE 1005 uPrintF64 maxE 1006 uPrint tC6ZcP 1007 end 1008 1009 fn storeMeas6 L ulong rMode ulong nSmear ulong k ulong to void 1010 downloadHalo L 1 sub L 1 1011 v = new f64 5 0.0f64 1012 evalHost6 L rMode nSmear v 1013 b = mul k 5 1014 for o ulong 5 1015 put tsData add b o get v o 1016 end 1017 end 1018 1019 fn sumBlk6 o ulong st ulong blkSz ulong to f64 1020 s = f64 0.0f64 1021 for j ulong blkSz bound 64 1022 s = add s get tsData add mul add st j 5 o 1023 end 1024 ret s 1025 end 1026 1027 note 16-block jackknife over 512 sweeps (32 sweeps per block) + within-arm sweep std 1028 fn summarizeOne6 o ulong nMeas ulong to void 1029 blkSz = div nMeas 16 1030 tot = f64 0.0f64 1031 for k ulong nMeas bound 512 1032 tot = add tot get tsData add mul k 5 o 1033 end 1034 mean = div tot f64 nMeas 1035 put curMean o mean 1036 vSum = f64 0.0f64 1037 for k ulong nMeas bound 512 1038 dv = sub get tsData add mul k 5 o mean 1039 vSum = add vSum mul dv dv 1040 end 1041 put curSig o uSqrt64 div vSum f64 sub nMeas 1 1042 jkSum = f64 0.0f64 1043 for b ulong 16 1044 bs = sumBlk6 o mul b blkSz blkSz 1045 d = sub div sub tot bs f64 sub nMeas blkSz mean 1046 jkSum = add jkSum mul d d 1047 end 1048 put curErr o uSqrt64 mul 0.`9375f64` jkSum 1049 end 1050 1051 fn summarizeTs6 nMeas ulong to void 1052 for o ulong 5 1053 summarizeOne6 o nMeas 1054 end 1055 end 1056 1057 fn computeDiffZR6 cid ulong to void 1058 if eq cid 0 1059 for o ulong 5 1060 put baseMean o get curMean o 1061 put baseErr o get curErr o 1062 put baseSig o get curSig o 1063 put curDelta o 0.0f64 1064 put curZ o 0.0f64 1065 put curRBulk o 0.0f64 1066 end 1067 ret 1068 end 1069 for o ulong 5 1070 diff = uAbs64 sub get curMean o get baseMean o 1071 se = uSqrt64 add mul get curErr o get curErr o mul get baseErr o get baseErr o 1072 z = f64 0.0f64 1073 if gt se 0.`0000001f64` 1074 z = div diff se 1075 end 1076 rBulk = f64 0.0f64 1077 sb = get baseSig o 1078 if gt sb 0.`0000001f64` 1079 rBulk = div diff sb 1080 end 1081 put curDelta o diff 1082 put curZ o z 1083 put curRBulk o rBulk 1084 end 1085 end 1086 1087 fn printRow6 expId ulong L ulong cid ulong nMeas ulong us ulong to void 1088 if eq expId 1 1089 uPrint tE6B 1090 else 1091 uPrint tE6C 1092 end 1093 uPrint tTab 1094 uPrintU L 1095 uPrint tTab 1096 uPrintF64 f64 get armBeta 0 1097 uPrint tTab 1098 uPrintU get armRMode 0 1099 uPrint tTab 1100 uPrintU get armNSmear 0 1101 uPrint tTab 1102 if eq cid 0 1103 uPrint tK0 1104 end 1105 if eq cid 3 1106 uPrint tK3 1107 end 1108 if eq cid 6 1109 uPrint tK6 1110 end 1111 uPrint tTab 1112 uPrintU nMeas 1113 for o ulong 5 1114 uPrint tTab 1115 uPrintF64 get curDelta o 1116 uPrint tTab 1117 uPrintF64 get curZ o 1118 uPrint tTab 1119 uPrintF64 get curRBulk o 1120 end 1121 uPrint tTab 1122 uPrintF64 get curMean 0 1123 uPrint tTab 1124 uPrintF64 get curSig 0 1125 uPrint tTab 1126 uPrintF64 get curMean 2 1127 uPrint tTab 1128 uPrintF64 get curSig 2 1129 uPrint tTab 1130 uPrintU us 1131 uPrint tNl 1132 end 1133 1134 fn runArm6 expId ulong L ulong beta f32 cid ulong nTherm ulong nMeas ulong to void 1135 t0 = monons 1136 put armBeta 0 beta 1137 seed = get armSeed 0 1138 N = mul mul L L mul L L 1139 if not seedGpuRng N add seed mul cid 7919 1140 exit 31 1141 end 1142 if not initLattice L cid true add seed mul cid 104729 1143 exit 32 1144 end 1145 for sw ulong nTherm bound 128 1146 if not gpuSweep N beta 3 1147 exit 33 1148 end 1149 end 1150 rm = get armRMode 0 1151 ns = get armNSmear 0 1152 for k ulong nMeas bound 512 1153 if not gpuSweep N beta 2 1154 exit 34 1155 end 1156 if not gpuSweep N beta 2 1157 exit 35 1158 end 1159 storeMeas6 L rm ns k 1160 end 1161 summarizeTs6 nMeas 1162 computeDiffZR6 cid 1163 us = div ulong sub monons t0 1000 1164 printRow6 expId L cid nMeas us 1165 end 1166 1167 fn runBox6 expId ulong L ulong beta f32 nTh ulong nMs ulong to bool 1168 if not buildNbTable L 1169 ret false 1170 end 1171 if not buildFlags L true 1172 ret false 1173 end 1174 assertZeroContact6 L get armRMode 0 get armNSmear 0 1175 runArm6 expId L beta 0 nTh nMs 1176 runArm6 expId L beta get armC1 0 nTh nMs 1177 runArm6 expId L beta get armC2 0 nTh nMs 1178 ret true 1179 end 1180 1181 fn allocBuf bytes ulong cached bool to long 1182 m = nvalloc bytes cached 1183 if le m 0 1184 uPrint tC6Err 1185 uPrintU ulong get nvstage 0 1186 uPrint tNl 1187 exit 6 1188 end 1189 ret m 1190 end 1191 1192 fn main to int 1193 uPrint tC6Hdr 1194 if not gbopen 1 1195 uPrint tC6Err 1196 uPrintU ulong get nvstage 0 1197 uPrint tNl 1198 ret 2 1199 end 1200 if not gbbopen 1201 ret 3 1202 end 1203 put uCodeMap 0 0 1204 uEmitAllKernels 1205 csize = mul div add get uCodePos 0 4095 4096 4096 1206 cm = nvalloc csize false 1207 if le cm 0 1208 ret 4 1209 end 1210 put uCodeMap 0 cm 1211 put uCodeFail 0 0 1212 uEmitAllKernels 1213 if ne get uCodeFail 0 0 1214 ret 5 1215 end 1216 1217 put dLinks 0 allocBuf `4194304` true 1218 put dStaples 0 allocBuf `4194304` true 1219 put dFlags 0 allocBuf `1048576` true 1220 put dNbSite 0 allocBuf `2097152` true 1221 put dRng 0 allocBuf 262144 true 1222 1223 uPrint tC6Cols 1224 1225 note Experiment 6B: High-Stats 512-Sweep 3-Point Confining SU(2) Continuum Ladder (l*sqrt(sigma) ~ 2.95) 1226 put armSeed 0 0x6b6b0001 1227 put armC1 0 3 1228 put armC2 0 6 1229 put armRMode 0 0 1230 put armNSmear 0 1 1231 if not runBox6 1 8 2.300f32 80 512 1232 rc = nvmclose 1233 ret 15 1234 end 1235 put armRMode 0 1 1236 put armNSmear 0 2 1237 if not runBox6 1 12 2.426f32 80 512 1238 rc = nvmclose 1239 ret 16 1240 end 1241 put armRMode 0 2 1242 put armNSmear 0 4 1243 if not runBox6 1 16 2.500f32 80 512 1244 rc = nvmclose 1245 ret 17 1246 end 1247 1248 note Experiment 6C: High-Stats 512-Sweep 3-Point Weak-Coupling Negative Control (beta=6.00, xi >> L) 1249 put armSeed 0 0x6c6c0001 1250 put armC1 0 3 1251 put armC2 0 6 1252 put armRMode 0 0 1253 put armNSmear 0 1 1254 if not runBox6 2 8 6.000f32 80 512 1255 rc = nvmclose 1256 ret 18 1257 end 1258 put armRMode 0 1 1259 put armNSmear 0 2 1260 if not runBox6 2 12 6.000f32 80 512 1261 rc = nvmclose 1262 ret 19 1263 end 1264 put armRMode 0 2 1265 put armNSmear 0 4 1266 if not runBox6 2 16 6.000f32 80 512 1267 rc = nvmclose 1268 ret 20 1269 end 1270 1271 uPrint tC6Done 1272 rc = nvmclose 1273 ret 0 1274 end