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_check9_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_check9_gb10.om` 1118 lines · 23386 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note src/ufbi_check9_gb10.om: Pure Seeded-OM-2 Zero-CUDA GB10 Runner for UFBI Check #9 3 note (Phase II Blocked-Action Tomography + Extended 12-Point Calibration beta=0.10..10.0 4 note + k=3 Deep RG Blocking 32^4 -> 16^4 -> 8^4 -> 4^4 at beta=2.00, 2.30). 5 note 6 note Directly answers all three Check #8 referee questions on live GB10 silicon: 7 note 1. Extended 12-point periodic 8^4 bulk calibration (beta in {0.10, 0.25, 0.50, 1.00, 8 note 1.50, 2.00, 2.30, 2.50, 3.00, 4.00, 6.00, 10.00}) measuring P_bulk, Adj_bulk, 9 note R1x2_bulk, and W2x2_bulk — removing Check #8's beta=6.0 upper clamp AND providing 10 note exact pure-Wilson multi-loop reference curves. 11 note 2. Blocked-Action Tomography (16^4 -> 8^4 -> 4^4 at beta in {1.50, 2.00, 2.30, 2.50, 6.00}): 12 note Measures P^(k), Adj^(k), R1x2^(k), W2x2^(k) at k=0, 1, 2 and computes exact 13 note non-plaquette coupling leakage relative to a pure Wilson action at matched beta_eff(k): 14 note dAdj^(k) = Adj^(k) - Adj_Wilson(beta_eff(k)) 15 note dR1x2^(k) = R1x2^(k) - R1x2_Wilson(beta_eff(k)) 16 note dW2x2^(k) = W2x2^(k) - W2x2_Wilson(beta_eff(k)) 17 note 3. k=3 Deep RG Blocking on 32^4 (N=1,048,576 sites on GB10 GPU -> 16^4 -> 8^4 -> 4^4) 18 note at beta=2.00 and beta=2.30, testing whether beta_eff(k=3) crosses directly inside 19 note the unconditionally Lean-certified 4D SU(2) Dobrushin basin (< 0.111 / < 0.0556)! 20 note 21 note Composed after: 22 note gpu/nvidia/native/nvrm/context.om 23 note gpu/nvidia/native/blackwell/vector.om 24 note gpu/nvidia/native/blackwell/launch.om 25 note gpu/nvidia/native/blackwell/batch.om 26 note om/encoder/bw_enc_sm121.om 27 note src/ufbi_math.om 28 note src/ufbi_check3_kernels.om 29 30 global uCodePos ulong 1 31 global uEntry ulong 8 32 global uCodeMap long 1 33 global uCodeFail uint 1 34 global uBind uint 32 35 global uBindN ulong 1 36 global uDirty uint 1 37 38 global dLinks long 1 39 global dStaples long 1 40 global dFlags long 1 41 global dNbSite long 1 42 global dRng long 1 43 44 note Host link levels (max 16^4 = 1,048,576 f32; 32^4 reads directly from GPU cached dLinks!) 45 note lvl 0 = hL1 (16^4, 65536 sites), lvl 1 = hL2 (8^4, 4096 sites), lvl 2 = hL3 (4^4, 256 sites) 46 note lvl 3 = direct GPU dLinks read for 32^4! 47 global hL1 f32 `1048576` 48 global hL2 f32 65536 49 global hL3 f32 4096 50 global hStage uchar 65536 51 52 note 12-point extended bulk calibration tables (beta, P, Adj, R1x2, W2x2) 53 global calBeta f64 12 54 global calP f64 12 55 global calAdj f64 12 56 global calR12 f64 12 57 global calW22 f64 12 58 59 note Tomography accumulators: 4 scales x 4 obs (P, Adj, R12, W22) = 16 f64 60 global tomAcc f64 16 61 global tomCur f64 4 62 global tomCnt ulong 1 63 global rgSrcLvl ulong 1 64 global rgDstLvl ulong 1 65 global rgLf ulong 1 66 67 text tC9Hdr "=== UFBI CHECK #9: PHASE-II BLOCKED-ACTION TOMOGRAPHY & k=3 32^4 RG FLOW (PURE OM-2 GB10) ===\n" 68 text tC9Err "FAIL: GB10 native NVRM/kernel error stage=" 69 text tC9CalHdr "=== EXTENDED 12-POINT PERIODIC 8^4 SU(2) PURE-WILSON MULTI-LOOP CALIBRATION ===\n" 70 text tC9CalCols "cal_beta\tP_bulk\tAdj_bulk\tR1x2_bulk\tW2x2_bulk\n" 71 text tC9TomHdr "=== BLOCKED-ACTION TOMOGRAPHY (16^4 -> 8^4 -> 4^4, PERIODIC BULK, 64 MEAS) ===\n" 72 text tC9TomCols "L_base\tbeta\tk\tP_k\tbeta_eff\tAdj_k\tdAdj_nonW\tR1x2_k\tdR1x2_nonW\tW2x2_k\tdW2x2_nonW\tus\n" 73 text tC9K3Hdr "=== DEEP k=3 BLOCK-SPIN RG FLOW ON 32^4 (1,048,576 SITES: 32^4 -> 16^4 -> 8^4 -> 4^4) ===\n" 74 text tTab "\t" 75 text tNl "\n" 76 text tC9Done "CHECK9_GB10_DONE status=PASS\n" 77 78 fn uCodeWrite w view ulong 4 to void 79 p = get uCodePos 0 80 b = new uchar 16 0 81 if gt get uCodeMap 0 0 82 for i ulong 16 83 put b i uchar and shr get w div i 4 mul rem i 4 8 255 84 end 85 if ne mapwrite get uCodeMap 0 p b 0 16 16 86 put uCodeFail 0 1 87 end 88 end 89 put uCodePos 0 add p 16 90 end 91 92 fn uEmitAllKernels to void 93 put uCodePos 0 0 94 for id ulong 3 95 p = mul div add get uCodePos 0 255 256 256 96 put uEntry id p 97 put uCodePos 0 p 98 put uPc 0 0 99 put uGuard 0 0 100 ok = false 101 if eq id 0 102 ok = uEmitSu2Staple 103 end 104 if eq id 1 105 ok = uEmitSu2Overrelax 106 end 107 if eq id 2 108 ok = uEmitSu2Heatbath 109 end 110 if not ok 111 exit 4 112 end 113 uDone 114 end 115 end 116 117 fn uArg u uint to void 118 i = get uBindN 0 119 put uBind i u 120 put uBindN 0 add i 1 121 end 122 123 fn uPtr va ulong to void 124 uArg gblo va 125 uArg gbhi va 126 end 127 128 fn uRecord id ulong gx uint bx uint to bool 129 gbqmd 1 130 a = add mapaddr get uCodeMap 0 get uEntry id 131 put gbq1 32 gblo shr a 4 132 put gbq1 33 or uint and shr a 36 `2097151` `20971520` 133 put gbq1 59 gblo shr a 8 134 put gbq1 34 or uint 65536 bx 135 put gbq1 35 or uint 131073 shl uint 64 8 136 put gbq1 36 `78923784` 137 put gbq1 37 0 138 put gbq1 39 gx 139 put gbq1 40 1 140 put gbq1 41 1 141 put gbcb 216 bx 142 put gbcb 220 gx 143 put gbcb 221 1 144 put gbcb 222 1 145 cb = mapaddr get gbmem 1 146 words = get uBindN 0 147 endva = add cb add 896 mul words 4 148 put gbcb 212 gbhi endva 149 put gbcb 213 gblo endva 150 put gbused 0 0 151 gbsetup 152 if ne get uDirty 0 0 153 gbmth 0 40 4 154 gbemit 0 155 gbemit 0 156 gbemit 0 157 gbemit `2281701376` 158 put uDirty 0 0 159 end 160 gbdma cb 224 161 for j ulong 224 162 gbemit get gbcb j 163 end 164 gbdma add cb 896 uint words 165 for j ulong words bound 32 166 gbemit get uBind j 167 end 168 q = mapaddr get gbmem 2 169 gbinline q false 170 gbdma add q 8192 1 171 gbemit 1 172 gbinline add q 4096 true 173 gbrel add mapaddr get gbmem 3 32 6 174 put uBindN 0 0 175 ret gbappend id get gbst 1 176 end 177 178 fn uRunKernel id ulong gx uint bx uint to bool 179 put uDirty 0 1 180 if not gbbegin 1 181 ret false 182 end 183 if not uRecord id gx bx 184 ret false 185 end 186 ret gbbsubmit `2000000000` 187 end 188 189 fn stageU32 k ulong v uint to void 190 b = mul k 4 191 put hStage b uchar and v 255 192 put hStage add b 1 uchar and shr v 8 255 193 put hStage add b 2 uchar and shr v 16 255 194 put hStage add b 3 uchar and shr v 24 255 195 end 196 197 fn stageF32 k ulong v f32 to void 198 stageU32 k bitcast uint v 199 end 200 201 fn flushStage m long offBytes ulong nWords ulong to bool 202 nb = mul nWords 4 203 ret eq mapwrite m offBytes hStage 0 nb long nb 204 end 205 206 fn coordIdx c0 ulong c1 ulong c2 ulong c3 ulong L ulong to ulong 207 r = add mul c0 L c1 208 r = add mul r L c2 209 ret add mul r L c3 210 end 211 212 fn stepCoord s ulong L ulong dir ulong delta ulong to ulong 213 c3 = rem s L 214 t = div s L 215 c2 = rem t L 216 t = div t L 217 c1 = rem t L 218 c0 = div t L 219 if eq dir 0 220 c0 = rem add c0 delta L 221 end 222 if eq dir 1 223 c1 = rem add c1 delta L 224 end 225 if eq dir 2 226 c2 = rem add c2 delta L 227 end 228 if eq dir 3 229 c3 = rem add c3 delta L 230 end 231 ret coordIdx c0 c1 c2 c3 L 232 end 233 234 fn isBox4 s ulong L ulong lo ulong hi ulong to bool 235 c3 = rem s L 236 t = div s L 237 c2 = rem t L 238 t = div t L 239 c1 = rem t L 240 c0 = div t L 241 if or lt c0 lo ge c0 hi 242 ret false 243 end 244 if or lt c1 lo ge c1 hi 245 ret false 246 end 247 if or lt c2 lo ge c2 hi 248 ret false 249 end 250 if or lt c3 lo ge c3 hi 251 ret false 252 end 253 ret true 254 end 255 256 note Streaming neighbor-table builder (supports up to L=32 -> 1,048,576 sites x 8 = 8,388,608 u32!) 257 fn stageSiteNb kSite ulong s ulong L ulong to void 258 c3 = rem s L 259 t = div s L 260 c2 = rem t L 261 t = div t L 262 c1 = rem t L 263 c0 = div t L 264 b = mul kSite 8 265 stageU32 b uint coordIdx rem add c0 1 L c1 c2 c3 L 266 stageU32 add b 1 uint coordIdx rem add c0 sub L 1 L c1 c2 c3 L 267 stageU32 add b 2 uint coordIdx c0 rem add c1 1 L c2 c3 L 268 stageU32 add b 3 uint coordIdx c0 rem add c1 sub L 1 L c2 c3 L 269 stageU32 add b 4 uint coordIdx c0 c1 rem add c2 1 L c3 L 270 stageU32 add b 5 uint coordIdx c0 c1 rem add c2 sub L 1 L c3 L 271 stageU32 add b 6 uint coordIdx c0 c1 c2 rem add c3 1 L L 272 stageU32 add b 7 uint coordIdx c0 c1 c2 rem add c3 sub L 1 L L 273 end 274 275 fn buildNbTableStream L ulong to bool 276 N = mul mul L L mul L L 277 off = ulong 0 278 while lt off N bound 512 279 cnt = sub N off 280 if gt cnt 2048 281 cnt = ulong 2048 282 end 283 for k ulong cnt bound 2048 284 stageSiteNb k add off k L 285 end 286 if not flushStage get dNbSite 0 mul off 32 mul cnt 8 287 ret false 288 end 289 off = add off cnt 290 end 291 ret true 292 end 293 294 fn siteParity s ulong L ulong to uint 295 c3 = rem s L 296 t = div s L 297 c2 = rem t L 298 t = div t L 299 c1 = rem t L 300 c0 = div t L 301 ret uint and add add c0 c1 add c2 c3 1 302 end 303 304 fn buildFlagsStream L ulong to bool 305 N = mul mul L L mul L L 306 totalW = mul N 4 307 off = ulong 0 308 while lt off totalW bound 256 309 cnt = sub totalW off 310 if gt cnt 16384 311 cnt = ulong 16384 312 end 313 for k ulong cnt bound 16384 314 stageU32 k siteParity div add off k 4 L 315 end 316 if not flushStage get dFlags 0 mul off 4 cnt 317 ret false 318 end 319 off = add off cnt 320 end 321 ret true 322 end 323 324 fn seedGpuRngStream N ulong seed ulong to bool 325 uRngSeed seed 326 off = ulong 0 327 while lt off N bound 64 328 cnt = sub N off 329 if gt cnt 16384 330 cnt = ulong 16384 331 end 332 for k ulong cnt bound 16384 333 r = uint and uRngNext 0xffffffff 334 if eq r 0 335 r = uint 0x9e3779b9 336 end 337 stageU32 k r 338 end 339 if not flushStage get dRng 0 mul off 4 cnt 340 ret false 341 end 342 off = add off cnt 343 end 344 ret true 345 end 346 347 note Streaming cold-perturbed SU(2) lattice initializer on GPU (supports L up to 32!) 348 fn stageRandLink kLink ulong to void 349 a0 = f32 0.85f32 350 a1 = mul 0.25f32 f32 uRngNorm64 351 a2 = mul 0.25f32 f32 uRngNorm64 352 a3 = mul 0.25f32 f32 uRngNorm64 353 n2 = add add mul a0 a0 mul a1 a1 add mul a2 a2 mul a3 a3 354 inv = f32 div 1.0f64 uSqrt64 f64 n2 355 b = mul kLink 4 356 stageF32 b mul a0 inv 357 stageF32 add b 1 mul a1 inv 358 stageF32 add b 2 mul a2 inv 359 stageF32 add b 3 mul a3 inv 360 end 361 362 fn initLatticeStream L ulong seed ulong to bool 363 N = mul mul L L mul L L 364 uRngSeed seed 365 totalLinks = mul N 4 366 off = ulong 0 367 while lt off totalLinks bound 1024 368 cnt = sub totalLinks off 369 if gt cnt 4096 370 cnt = ulong 4096 371 end 372 for k ulong cnt bound 4096 373 stageRandLink k 374 end 375 if not flushStage get dLinks 0 mul off 16 mul cnt 4 376 ret false 377 end 378 off = add off cnt 379 end 380 ret true 381 end 382 383 fn downloadAllToL1 N ulong to void 384 totalF = mul N 16 385 lm = get dLinks 0 386 for i ulong totalF bound `1048576` 387 put hL1 i bitcast f32 uint mapget lm mul i 4 4 388 end 389 end 390 391 fn gpuRunStaple N ulong mu ulong par ulong to bool 392 gx = uint div add N 255 256 393 nu0 = ulong 0 394 nu1 = ulong 1 395 nu2 = ulong 2 396 if eq mu 0 397 nu0 = ulong 1 398 nu1 = ulong 2 399 nu2 = ulong 3 400 end 401 if eq mu 1 402 nu0 = ulong 0 403 nu1 = ulong 2 404 nu2 = ulong 3 405 end 406 if eq mu 2 407 nu0 = ulong 0 408 nu1 = ulong 1 409 nu2 = ulong 3 410 end 411 uPtr mapaddr get dLinks 0 412 uPtr mapaddr get dStaples 0 413 uPtr mapaddr get dFlags 0 414 uPtr mapaddr get dNbSite 0 415 uArg uint N 416 uArg uint mu 417 uArg uint par 418 uArg uint nu0 419 uArg uint nu1 420 uArg uint nu2 421 ret uRunKernel 0 gx 256 422 end 423 424 fn gpuRunOverrelax N ulong mu ulong par ulong to bool 425 gx = uint div add N 255 256 426 uPtr mapaddr get dLinks 0 427 uPtr mapaddr get dStaples 0 428 uPtr mapaddr get dFlags 0 429 uArg uint N 430 uArg uint mu 431 uArg uint par 432 ret uRunKernel 1 gx 256 433 end 434 435 fn gpuRunHeatbath N ulong mu ulong par ulong beta f32 to bool 436 gx = uint div add N 255 256 437 uPtr mapaddr get dLinks 0 438 uPtr mapaddr get dStaples 0 439 uPtr mapaddr get dFlags 0 440 uPtr mapaddr get dRng 0 441 uArg uint N 442 uArg uint mu 443 uArg uint par 444 uArg bitcast uint beta 445 ret uRunKernel 2 gx 256 446 end 447 448 fn gpuSweep N ulong beta f32 nOr ulong to bool 449 for mu ulong 4 450 for par ulong 2 451 if not gpuRunStaple N mu par 452 ret false 453 end 454 if not gpuRunHeatbath N mu par beta 455 ret false 456 end 457 for r ulong nOr bound 8 458 if not gpuRunStaple N mu par 459 ret false 460 end 461 if not gpuRunOverrelax N mu par 462 ret false 463 end 464 end 465 end 466 end 467 ret true 468 end 469 470 note ========================================================================= 471 note Quaternion Helpers + Multi-Level Storage (lvl 0=hL1, 1=hL2, 2=hL3, 3=dLinks) 472 note ========================================================================= 473 fn hQMul a view f32 4 b view f32 4 o edit f32 4 to void 474 v = mul get a 0 get b 0 475 v = sub v mul get a 1 get b 1 476 v = sub v mul get a 2 get b 2 477 v = sub v mul get a 3 get b 3 478 put o 0 v 479 v = mul get a 0 get b 1 480 v = add v mul get a 1 get b 0 481 v = add v mul get a 2 get b 3 482 v = sub v mul get a 3 get b 2 483 put o 1 v 484 v = mul get a 0 get b 2 485 v = sub v mul get a 1 get b 3 486 v = add v mul get a 2 get b 0 487 v = add v mul get a 3 get b 1 488 put o 2 v 489 v = mul get a 0 get b 3 490 v = add v mul get a 1 get b 2 491 v = sub v mul get a 2 get b 1 492 v = add v mul get a 3 get b 0 493 put o 3 v 494 end 495 496 fn hQConj q edit f32 4 to void 497 put q 1 neg get q 1 498 put q 2 neg get q 2 499 put q 3 neg get q 3 500 end 501 502 fn hQNorm q edit f32 4 to void 503 n2 = mul get q 0 get q 0 504 n2 = add n2 mul get q 1 get q 1 505 n2 = add n2 mul get q 2 get q 2 506 n2 = add n2 mul get q 3 get q 3 507 if le n2 0.`0000000001f32` 508 put q 0 1.0f32 509 put q 1 0.0f32 510 put q 2 0.0f32 511 put q 3 0.0f32 512 ret 513 end 514 inv = f32 div 1.0f64 uSqrt64 f64 n2 515 for c ulong 4 516 put q c mul get q c inv 517 end 518 end 519 520 fn loadLvl lvl ulong s ulong mu ulong dst edit f32 4 to void 521 b = mul add mul s 4 mu 4 522 if eq lvl 0 523 put dst 0 get hL1 b 524 put dst 1 get hL1 add b 1 525 put dst 2 get hL1 add b 2 526 put dst 3 get hL1 add b 3 527 ret 528 end 529 if eq lvl 1 530 put dst 0 get hL2 b 531 put dst 1 get hL2 add b 1 532 put dst 2 get hL2 add b 2 533 put dst 3 get hL2 add b 3 534 ret 535 end 536 if eq lvl 2 537 put dst 0 get hL3 b 538 put dst 1 get hL3 add b 1 539 put dst 2 get hL3 add b 2 540 put dst 3 get hL3 add b 3 541 ret 542 end 543 lm = get dLinks 0 544 bo = mul b 4 545 put dst 0 bitcast f32 uint mapget lm bo 4 546 put dst 1 bitcast f32 uint mapget lm add bo 4 4 547 put dst 2 bitcast f32 uint mapget lm add bo 8 4 548 put dst 3 bitcast f32 uint mapget lm add bo 12 4 549 end 550 551 fn storeLvl lvl ulong s ulong mu ulong src view f32 4 to void 552 b = mul add mul s 4 mu 4 553 if eq lvl 0 554 put hL1 b get src 0 555 put hL1 add b 1 get src 1 556 put hL1 add b 2 get src 2 557 put hL1 add b 3 get src 3 558 ret 559 end 560 if eq lvl 1 561 put hL2 b get src 0 562 put hL2 add b 1 get src 1 563 put hL2 add b 2 get src 2 564 put hL2 add b 3 get src 3 565 ret 566 end 567 put hL3 b get src 0 568 put hL3 add b 1 get src 1 569 put hL3 add b 2 get src 2 570 put hL3 add b 3 get src 3 571 end 572 573 fn addBlockStaple x ulong mu ulong nu ulong isBack bool dst edit f32 4 to void 574 lvl = get rgSrcLvl 0 575 Lf = get rgLf 0 576 a = new f32 4 0.0f32 577 b = new f32 4 0.0f32 578 p = new f32 4 0.0f32 579 q = new f32 4 0.0f32 580 x2m = stepCoord stepCoord x Lf mu 1 Lf mu 1 581 if not isBack 582 xn = stepCoord x Lf nu 1 583 loadLvl lvl x nu a 584 loadLvl lvl xn mu b 585 hQMul a b p 586 loadLvl lvl stepCoord xn Lf mu 1 mu a 587 hQMul p a q 588 loadLvl lvl x2m nu a 589 hQConj a 590 hQMul q a p 591 else 592 xm = stepCoord x Lf nu sub Lf 1 593 loadLvl lvl xm nu a 594 hQConj a 595 loadLvl lvl xm mu b 596 hQMul a b p 597 loadLvl lvl stepCoord xm Lf mu 1 mu a 598 hQMul p a q 599 loadLvl lvl stepCoord x2m Lf nu sub Lf 1 nu a 600 hQMul q a p 601 end 602 for c ulong 4 603 put dst c add get dst c get p c 604 end 605 end 606 607 fn coarseToFine X ulong Lf ulong to ulong 608 Lc = div Lf 2 609 c3 = rem X Lc 610 t = div X Lc 611 c2 = rem t Lc 612 t = div t Lc 613 c1 = rem t Lc 614 c0 = div t Lc 615 ret coordIdx mul c0 2 mul c1 2 mul c2 2 mul c3 2 Lf 616 end 617 618 fn blockLinkOne X ulong mu ulong to void 619 srcLvl = get rgSrcLvl 0 620 Lf = get rgLf 0 621 x = coarseToFine X Lf 622 u1 = new f32 4 0.0f32 623 u2 = new f32 4 0.0f32 624 w0 = new f32 4 0.0f32 625 st = new f32 4 0.0f32 626 loadLvl srcLvl x mu u1 627 loadLvl srcLvl stepCoord x Lf mu 1 mu u2 628 hQMul u1 u2 w0 629 for nu ulong 4 630 if ne nu mu 631 addBlockStaple x mu nu false st 632 addBlockStaple x mu nu true st 633 end 634 end 635 wS = div 0.5f32 6.0f32 636 for c ulong 4 637 put w0 c add mul 0.5f32 get w0 c mul wS get st c 638 end 639 hQNorm w0 640 storeLvl get rgDstLvl 0 X mu w0 641 end 642 643 fn blockBox srcLvl ulong dstLvl ulong Lf ulong cLo ulong cHi ulong to void 644 put rgSrcLvl 0 srcLvl 645 put rgDstLvl 0 dstLvl 646 put rgLf 0 Lf 647 Lc = div Lf 2 648 Nc = mul mul Lc Lc mul Lc Lc 649 for X ulong Nc bound 65536 650 if isBox4 X Lc cLo cHi 651 for mu ulong 4 652 blockLinkOne X mu 653 end 654 end 655 end 656 end 657 658 note ========================================================================= 659 note Multi-Loop Wilson Observables: Plaq (1x1), Adj, Rect (1x2), Loop (2x2) 660 note ========================================================================= 661 fn plaqLvl lvl ulong L ulong s ulong mu ulong nu ulong to f64 662 a = new f32 4 0.0f32 663 b = new f32 4 0.0f32 664 p = new f32 4 0.0f32 665 q = new f32 4 0.0f32 666 loadLvl lvl s mu a 667 loadLvl lvl stepCoord s L mu 1 nu b 668 hQMul a b p 669 loadLvl lvl stepCoord s L nu 1 mu a 670 hQConj a 671 hQMul p a q 672 loadLvl lvl s nu b 673 hQConj b 674 hQMul q b p 675 ret f64 get p 0 676 end 677 678 fn rect12Lvl lvl ulong L ulong s ulong mu ulong nu ulong to f64 679 a = new f32 4 0.0f32 680 b = new f32 4 0.0f32 681 p = new f32 4 0.0f32 682 q = new f32 4 0.0f32 683 s1 = stepCoord s L mu 1 684 s2 = stepCoord s1 L mu 1 685 loadLvl lvl s mu a 686 loadLvl lvl s1 mu b 687 hQMul a b p 688 loadLvl lvl s2 nu a 689 hQMul p a q 690 loadLvl lvl stepCoord s1 L nu 1 mu a 691 hQConj a 692 hQMul q a p 693 loadLvl lvl stepCoord s L nu 1 mu a 694 hQConj a 695 hQMul p a q 696 loadLvl lvl s nu b 697 hQConj b 698 hQMul q b p 699 ret f64 get p 0 700 end 701 702 fn rect22Lvl lvl ulong L ulong s ulong mu ulong nu ulong to f64 703 a = new f32 4 0.0f32 704 p = new f32 4 0.0f32 705 q = new f32 4 0.0f32 706 cur = s 707 loadLvl lvl cur mu p 708 cur = stepCoord cur L mu 1 709 loadLvl lvl cur mu a 710 hQMul p a q 711 cur = stepCoord cur L mu 1 712 loadLvl lvl cur nu a 713 hQMul q a p 714 cur = stepCoord cur L nu 1 715 loadLvl lvl cur nu a 716 hQMul p a q 717 cur = stepCoord cur L nu 1 718 cur = stepCoord cur L mu sub L 1 719 loadLvl lvl cur mu a 720 hQConj a 721 hQMul q a p 722 cur = stepCoord cur L mu sub L 1 723 loadLvl lvl cur mu a 724 hQConj a 725 hQMul p a q 726 cur = stepCoord cur L nu sub L 1 727 loadLvl lvl cur nu a 728 hQConj a 729 hQMul q a p 730 cur = stepCoord cur L nu sub L 1 731 loadLvl lvl cur nu a 732 hQConj a 733 hQMul p a q 734 ret f64 get q 0 735 end 736 737 fn accumTomSite lvl ulong L ulong s ulong to void 738 for mu ulong 4 739 for nu ulong 4 740 if lt mu nu 741 vp = plaqLvl lvl L s mu nu 742 put tomCur 0 add get tomCur 0 vp 743 put tomCur 1 add get tomCur 1 sub mul 4.0f64 mul vp vp 1.0f64 744 put tomCur 2 add get tomCur 2 rect12Lvl lvl L s mu nu 745 put tomCur 3 add get tomCur 3 rect22Lvl lvl L s mu nu 746 put tomCnt 0 add get tomCnt 0 1 747 end 748 end 749 end 750 end 751 752 fn evalTomBox lvl ulong L ulong lo ulong hi ulong kIdx ulong to void 753 for c ulong 4 754 put tomCur c 0.0f64 755 end 756 put tomCnt 0 0 757 N = mul mul L L mul L L 758 for s ulong N bound 65536 759 if isBox4 s L lo hi 760 accumTomSite lvl L s 761 end 762 end 763 fc = f64 get tomCnt 0 764 base = mul kIdx 4 765 for d ulong 4 766 idx = add base d 767 nv = add get tomAcc idx div get tomCur d fc 768 put tomAcc idx nv 769 end 770 end 771 772 note Direct 32^4 fine-level sampling on central [14, 18)^4 (256 sites) 773 fn evalTom32Center kIdx ulong to void 774 for c ulong 4 775 put tomCur c 0.0f64 776 end 777 put tomCnt 0 0 778 for c0 ulong 4 779 for c1 ulong 4 780 for c2 ulong 4 781 for c3 ulong 4 782 s = coordIdx add c0 14 add c1 14 add c2 14 add c3 14 32 783 accumTomSite 3 32 s 784 end 785 end 786 end 787 end 788 fc = f64 get tomCnt 0 789 base = mul kIdx 4 790 for d ulong 4 791 idx = add base d 792 nv = add get tomAcc idx div get tomCur d fc 793 put tomAcc idx nv 794 end 795 end 796 797 note ========================================================================= 798 note 12-Point Calibration & Piecewise-Linear Pure-Wilson Reference Interpolation 799 note ========================================================================= 800 fn runCal9 idx ulong beta f32 to void 801 N = ulong 4096 802 if not seedGpuRngStream N add 0xc9000001 mul idx 7919 803 exit 21 804 end 805 if not initLatticeStream 8 add 0xc9000001 mul idx 104729 806 exit 22 807 end 808 for sw ulong 48 809 if not gpuSweep N beta 3 810 exit 23 811 end 812 end 813 for c ulong 4 814 put tomAcc c 0.0f64 815 end 816 for m ulong 32 817 if not gpuSweep N beta 2 818 exit 24 819 end 820 downloadAllToL1 N 821 evalTomBox 0 8 2 6 0 822 end 823 pM = div get tomAcc 0 32.0f64 824 aM = div get tomAcc 1 32.0f64 825 rM = div get tomAcc 2 32.0f64 826 wM = div get tomAcc 3 32.0f64 827 put calBeta idx f64 beta 828 put calP idx pM 829 put calAdj idx aM 830 put calR12 idx rM 831 put calW22 idx wM 832 uPrintF64 f64 beta 833 uPrint tTab 834 uPrintF64 pM 835 uPrint tTab 836 uPrintF64 aM 837 uPrint tTab 838 uPrintF64 rM 839 uPrint tTab 840 uPrintF64 wM 841 uPrint tNl 842 end 843 844 fn invertBeta9 p f64 to f64 845 if le p get calP 0 846 ret mul get calBeta 0 div p get calP 0 847 end 848 for i ulong 11 849 p0 = get calP i 850 p1 = get calP add i 1 851 if le p p1 852 b0 = get calBeta i 853 b1 = get calBeta add i 1 854 dp = sub p1 p0 855 if le dp 0.`000001f64` 856 ret b0 857 end 858 ret add b0 mul sub b1 b0 div sub p p0 dp 859 end 860 end 861 ret get calBeta 11 862 end 863 864 fn interpRef which ulong beta f64 to f64 865 if le beta get calBeta 0 866 if eq which 1 867 ret get calAdj 0 868 end 869 if eq which 2 870 ret get calR12 0 871 end 872 ret get calW22 0 873 end 874 for i ulong 11 875 b0 = get calBeta i 876 b1 = get calBeta add i 1 877 if le beta b1 878 t = div sub beta b0 sub b1 b0 879 v0 = f64 0.0f64 880 v1 = f64 0.0f64 881 if eq which 1 882 v0 = get calAdj i 883 v1 = get calAdj add i 1 884 end 885 if eq which 2 886 v0 = get calR12 i 887 v1 = get calR12 add i 1 888 end 889 if eq which 3 890 v0 = get calW22 i 891 v1 = get calW22 add i 1 892 end 893 ret add v0 mul sub v1 v0 t 894 end 895 end 896 if eq which 1 897 ret get calAdj 11 898 end 899 if eq which 2 900 ret get calR12 11 901 end 902 ret get calW22 11 903 end 904 905 fn printTomRow Lbase ulong beta f64 k ulong nMeas ulong us ulong to void 906 fnM = f64 nMeas 907 base = mul k 4 908 pK = div get tomAcc base fnM 909 aK = div get tomAcc add base 1 fnM 910 rK = div get tomAcc add base 2 fnM 911 wK = div get tomAcc add base 3 fnM 912 bEff = invertBeta9 pK 913 uPrintU Lbase 914 uPrint tTab 915 uPrintF64 beta 916 uPrint tTab 917 uPrintU k 918 uPrint tTab 919 uPrintF64 pK 920 uPrint tTab 921 uPrintF64 bEff 922 uPrint tTab 923 uPrintF64 aK 924 uPrint tTab 925 uPrintF64 sub aK interpRef 1 bEff 926 uPrint tTab 927 uPrintF64 rK 928 uPrint tTab 929 uPrintF64 sub rK interpRef 2 bEff 930 uPrint tTab 931 uPrintF64 wK 932 uPrint tTab 933 uPrintF64 sub wK interpRef 3 bEff 934 uPrint tTab 935 uPrintU us 936 uPrint tNl 937 end 938 939 note Run Blocked-Action Tomography on Periodic 16^4 -> 8^4 -> 4^4 (64 measurements) 940 fn runTom16 beta f32 seed ulong to void 941 t0 = monons 942 N = ulong 65536 943 if not seedGpuRngStream N seed 944 exit 31 945 end 946 if not initLatticeStream 16 add seed 104729 947 exit 32 948 end 949 for sw ulong 64 950 if not gpuSweep N beta 3 951 exit 33 952 end 953 end 954 for c ulong 16 955 put tomAcc c 0.0f64 956 end 957 for m ulong 64 958 if not gpuSweep N beta 2 959 exit 34 960 end 961 if not gpuSweep N beta 2 962 exit 35 963 end 964 downloadAllToL1 N 965 evalTomBox 0 16 6 10 0 966 blockBox 0 1 16 0 8 967 evalTomBox 1 8 2 6 1 968 blockBox 1 2 8 0 4 969 evalTomBox 2 4 0 4 2 970 end 971 us = div ulong sub monons t0 1000 972 printTomRow 16 f64 beta 0 64 us 973 printTomRow 16 f64 beta 1 64 us 974 printTomRow 16 f64 beta 2 64 us 975 end 976 977 note Run Deep k=3 Block-Spin RG on Periodic 32^4 (1,048,576 sites -> 16^4 -> 8^4 -> 4^4, 16 measurements) 978 fn runTom32 beta f32 seed ulong to void 979 t0 = monons 980 N = ulong `1048576` 981 if not seedGpuRngStream N seed 982 exit 41 983 end 984 if not initLatticeStream 32 add seed 104729 985 exit 42 986 end 987 for sw ulong 32 988 if not gpuSweep N beta 3 989 exit 43 990 end 991 end 992 for c ulong 16 993 put tomAcc c 0.0f64 994 end 995 for m ulong 16 996 if not gpuSweep N beta 2 997 exit 44 998 end 999 if not gpuSweep N beta 2 1000 exit 45 1001 end 1002 evalTom32Center 0 1003 blockBox 3 0 32 0 16 1004 evalTomBox 0 16 6 10 1 1005 blockBox 0 1 16 0 8 1006 evalTomBox 1 8 2 6 2 1007 blockBox 1 2 8 0 4 1008 evalTomBox 2 4 0 4 3 1009 end 1010 us = div ulong sub monons t0 1000 1011 printTomRow 32 f64 beta 0 16 us 1012 printTomRow 32 f64 beta 1 16 us 1013 printTomRow 32 f64 beta 2 16 us 1014 printTomRow 32 f64 beta 3 16 us 1015 end 1016 1017 fn allocBuf bytes ulong cached bool to long 1018 m = nvalloc bytes cached 1019 if le m 0 1020 uPrint tC9Err 1021 uPrintU ulong get nvstage 0 1022 uPrint tNl 1023 exit 6 1024 end 1025 ret m 1026 end 1027 1028 fn main to int 1029 uPrint tC9Hdr 1030 if not gbopen 1 1031 uPrint tC9Err 1032 uPrintU ulong get nvstage 0 1033 uPrint tNl 1034 ret 2 1035 end 1036 if not gbbopen 1037 ret 3 1038 end 1039 put uCodeMap 0 0 1040 uEmitAllKernels 1041 csize = mul div add get uCodePos 0 4095 4096 4096 1042 cm = nvalloc csize false 1043 if le cm 0 1044 ret 4 1045 end 1046 put uCodeMap 0 cm 1047 put uCodeFail 0 0 1048 uEmitAllKernels 1049 if ne get uCodeFail 0 0 1050 ret 5 1051 end 1052 1053 note Allocate GPU buffers for up to 32^4 = 1,048,576 sites (189 MB total on GB10!) 1054 put dLinks 0 allocBuf `67108864` true 1055 put dStaples 0 allocBuf `67108864` true 1056 put dFlags 0 allocBuf `16777216` true 1057 put dNbSite 0 allocBuf `33554432` true 1058 put dRng 0 allocBuf `4194304` true 1059 1060 note Step 1: Extended 12-point periodic 8^4 bulk calibration (0.10 .. 10.0) 1061 uPrint tC9CalHdr 1062 uPrint tC9CalCols 1063 if not buildNbTableStream 8 1064 rc = nvmclose 1065 ret 10 1066 end 1067 if not buildFlagsStream 8 1068 rc = nvmclose 1069 ret 11 1070 end 1071 runCal9 0 0.10f32 1072 runCal9 1 0.25f32 1073 runCal9 2 0.50f32 1074 runCal9 3 1.00f32 1075 runCal9 4 1.50f32 1076 runCal9 5 2.00f32 1077 runCal9 6 2.30f32 1078 runCal9 7 2.50f32 1079 runCal9 8 3.00f32 1080 runCal9 9 4.00f32 1081 runCal9 10 6.00f32 1082 runCal9 11 10.00f32 1083 1084 note Step 2: Blocked-Action Tomography on 16^4 -> 8^4 -> 4^4 1085 uPrint tC9TomHdr 1086 uPrint tC9TomCols 1087 if not buildNbTableStream 16 1088 rc = nvmclose 1089 ret 12 1090 end 1091 if not buildFlagsStream 16 1092 rc = nvmclose 1093 ret 13 1094 end 1095 runTom16 1.50f32 0x91010001 1096 runTom16 2.00f32 0x91020001 1097 runTom16 2.30f32 0x91030001 1098 runTom16 2.50f32 0x91040001 1099 runTom16 6.00f32 0x91060001 1100 1101 note Step 3: Deep k=3 Block-Spin RG on 32^4 (1,048,576 sites -> 16^4 -> 8^4 -> 4^4!) 1102 uPrint tC9K3Hdr 1103 uPrint tC9TomCols 1104 if not buildNbTableStream 32 1105 rc = nvmclose 1106 ret 14 1107 end 1108 if not buildFlagsStream 32 1109 rc = nvmclose 1110 ret 15 1111 end 1112 runTom32 2.00f32 0x93020001 1113 runTom32 2.30f32 0x93030001 1114 1115 uPrint tC9Done 1116 rc = nvmclose 1117 ret 0 1118 end