interplane.Get Omega
Read in your language

yang

This project has not described itself yet.

Brought by drakestapleton

branch main Branches Tags History

yang / src / ufbi_check7_gb10.om

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