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_check1_gb10.om

904 lines · 17674 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0
2note src/ufbi_check1_gb10.om: Pure Seeded-OM-2 Zero-CUDA GB10 Runner for UFBI Check #1
3note (4D Massive Free Scalar UV-Divergence Test: Exact 4D DST-I Oracle + Native SM121 CG).
4note
5note Composed after:
6note gpu/nvidia/native/nvrm/context.om
7note gpu/nvidia/native/blackwell/vector.om
8note gpu/nvidia/native/blackwell/launch.om
9note gpu/nvidia/native/blackwell/batch.om
10note om/encoder/bw_enc_sm121.om
11note src/ufbi_math.om
12note src/ufbi_check1_kernels.om
13
14global uCodePos ulong 1
15global uEntry ulong 8
16global uSmem ulong 8
17global uCodeMap long 1
18global uCodeFail uint 1
19global uBind uint 32
20global uBindN ulong 1
21global uDirty uint 1
22
23note Device unified-memory buffers (allocated for max N = 64^4 = 16,777,216 floats = 64 MiB each)
24global dX long 1
25global dB long 1
26global dR long 1
27global dP long 1
28global dAp long 1
29global dMaskFull long 1
30global dMaskInt long 1
31global dMaskOut long 1
32global dEta long 1
33global dH long 1
34global dObs long 1
35global dPart long 1
36global uStaging uchar 65536
37
38note Exact 4D DST-I CPU Oracle buffers for L=8 (interior M = 6, M^4 = 1296 sites)
39global dstSin f64 64
40global dstEig f64 16
41global dstB f64 1296
42global dstT f64 1296
43global dstH f64 1296
44
45text tHdr "=== UFBI CHECK #1: 4D MASSIVE FREE SCALAR UV-DIVERGENCE (PURE OM-2 ZERO-CUDA GB10) ===\n"
46text tOpenErr "FAIL: GB10 native NVRM open/alloc error stage="
47text tSubErr "FAIL: GB10 kernel submit error stage="
48text tOracleOk "ORACLE_4D_DST1_L8: PASS max_abs_err="
49text tOracleBad "ORACLE_4D_DST1_L8: FAIL max_abs_err="
50text tCols "L\tml\tcollar\tcg_h_it\tcg_w_it\tDelta_raw\tTV_raw\tBlockAvg_d\tBlockAvg_TV\tGauss_d\tGauss_TV\tDipole_d\tDipole_TV\tQuad_d\tQuad_TV\tSite_d\tSite_TV\tus_total\n"
51text tTab "\t"
52text tNl "\n"
53text tC0 "const"
54text tC1 "sin1"
55text tC2 "uv_chk"
56text tC3 "rand_N01"
57text tDone "CHECK1_GB10_DONE status=PASS\n"
58
59fn uCodeWrite w view ulong 4 to void
60p = get uCodePos 0
61b = new uchar 16 0
62if gt get uCodeMap 0 0
63for i ulong 16
64put b i uchar and shr get w div i 4 mul rem i 4 8 255
65end
66if ne mapwrite get uCodeMap 0 p b 0 16 16
67put uCodeFail 0 1
68end
69end
70put uCodePos 0 add p 16
71end
72
73fn uEmitAllKernels to void
74put uCodePos 0 0
75for id ulong 4
76p = mul div add get uCodePos 0 255 256 256
77put uEntry id p
78put uCodePos 0 p
79put uPc 0 0
80put uGuard 0 0
81ok = false
82if eq id 0
83ok = uEmitHelm4d
84end
85if eq id 1
86ok = uEmitDotCta
87end
88if eq id 2
89ok = uEmitAxpy
90end
91if eq id 3
92ok = uEmitMaskCopy
93end
94if not ok
95exit 4
96end
97uDone
98end
99put uSmem 0 0
100put uSmem 1 256
101put uSmem 2 0
102put uSmem 3 0
103end
104
105fn uArg u uint to void
106i = get uBindN 0
107put uBind i u
108put uBindN 0 add i 1
109end
110
111fn uPtr va ulong to void
112uArg gblo va
113uArg gbhi va
114end
115
116fn uRecord id ulong gx uint bx uint to bool
117gbqmd 1
118a = add mapaddr get uCodeMap 0 get uEntry id
119put gbq1 32 gblo shr a 4
120put gbq1 33 or uint and shr a 36 2097151 20971520
121put gbq1 59 gblo shr a 8
122put gbq1 34 or uint 65536 bx
123put gbq1 35 or uint 131073 shl uint 64 8
124sm = get uSmem id
125s7 = ulong 8
126if ne sm 0
127s7 = div add sm 127 128
128end
129put gbq1 36 uint or 78923776 s7
130put gbq1 37 0
131put gbq1 39 gx
132put gbq1 40 1
133put gbq1 41 1
134put gbcb 216 bx
135put gbcb 220 gx
136put gbcb 221 1
137put gbcb 222 1
138cb = mapaddr get gbmem 1
139words = get uBindN 0
140endva = add cb add 896 mul words 4
141put gbcb 212 gbhi endva
142put gbcb 213 gblo endva
143put gbused 0 0
144gbsetup
145if ne get uDirty 0 0
146gbmth 0 40 4
147gbemit 0
148gbemit 0
149gbemit 0
150gbemit 2281701376
151put uDirty 0 0
152end
153gbdma cb 224
154for j ulong 224
155gbemit get gbcb j
156end
157gbdma add cb 896 uint words
158for j ulong words bound 32
159gbemit get uBind j
160end
161q = mapaddr get gbmem 2
162gbinline q false
163gbdma add q 8192 1
164gbemit 1
165gbinline add q 4096 true
166gbrel add mapaddr get gbmem 3 32 6
167put uBindN 0 0
168ret gbappend id get gbst 1
169end
170
171fn uRunKernel id ulong gx uint bx uint to bool
172put uDirty 0 1
173if not gbbegin 1
174ret false
175end
176if not uRecord id gx bx
177ret false
178end
179ret gbbsubmit 2000000000
180end
181
182note Fast zero-fill of a GPU buffer via 64 KiB chunks
183fn uZeroBuf m long nFloats ulong to bool
184bytes = mul nFloats 4
185for i ulong 65536
186put uStaging i 0
187end
188off = ulong 0
189while lt off bytes bound 4096
190n = sub bytes off
191if gt n 65536
192n = ulong 65536
193end
194if ne mapwrite m off uStaging 0 n long n
195ret false
196end
197off = add off n
198end
199ret true
200end
201
202note Write f32 value to staging buffer at float slot k (0..16383)
203fn uStagePut k ulong v f32 to void
204bits = bitcast uint v
205base = mul k 4
206put uStaging base uchar and bits 255
207put uStaging add base 1 uchar and shr bits 8 255
208put uStaging add base 2 uchar and shr bits 16 255
209put uStaging add base 3 uchar and shr bits 24 255
210end
211
212fn uStageFlush m long offBytes ulong nFloats ulong to bool
213nb = mul nFloats 4
214ret eq mapwrite m offBytes uStaging 0 nb long nb
215end
216
217note GPU primitives wrapped cleanly
218fn gpuHelm4d xM long yM long mM long L ulong diag f32 to bool
219L2 = mul L L
220L3 = mul L2 L
221N = mul L3 L
222gx = uint div add N 255 256
223uPtr mapaddr xM
224uPtr mapaddr yM
225uPtr mapaddr mM
226uArg uint N
227uArg uint L
228uArg uint L2
229uArg uint L3
230uArg uint sub 4294967296 L
231uArg uint sub 4294967296 L2
232uArg uint sub 4294967296 L3
233uArg bitcast uint diag
234ret uRunKernel 0 gx 256
235end
236
237fn gpuAxpy xM long yM long N ulong a f32 b f32 to bool
238gx = uint div add N 255 256
239uPtr mapaddr xM
240uPtr mapaddr yM
241uArg uint N
242uArg bitcast uint a
243uArg bitcast uint b
244ret uRunKernel 2 gx 256
245end
246
247fn gpuMaskCopy xM long yM long mM long N ulong to bool
248gx = uint div add N 255 256
249uPtr mapaddr xM
250uPtr mapaddr yM
251uPtr mapaddr mM
252uArg uint N
253ret uRunKernel 3 gx 256
254end
255
256note Exact f64 reduction on Grace CPU over CTA partial sums from GB10
257fn gpuDot64 uM long vM long N ulong to f64
258gx = div add N 255 256
259uPtr mapaddr uM
260uPtr mapaddr vM
261uPtr mapaddr get dPart 0
262uArg uint N
263if not uRunKernel 1 uint gx 256
264exit 21
265end
266acc = f64 0.0f64
267pm = get dPart 0
268for i ulong gx bound 131072
269v = bitcast f32 uint mapget pm mul i 4 4
270acc = add acc f64 v
271end
272ret acc
273end
274
275note Solve masked A x = b on GB10 via Conjugate Gradient with f64 dot products
276global cgCfg ulong 4
277global cgTol f64 2
278
279fn cgStep xM long mM long L ulong diag f32 to bool
280N = get cgCfg 0
281if not gpuHelm4d get dP 0 get dAp 0 mM L diag
282exit 25
283end
284pAp = gpuDot64 get dP 0 get dAp 0 N
285if le pAp bitcast f64 ulong 0x39b0692313b315d2
286ret false
287end
288rr = get cgTol 0
289alpha = div rr pAp
290if not gpuAxpy get dP 0 xM N f32 alpha 1.0f32
291exit 26
292end
293if not gpuAxpy get dAp 0 get dR 0 N f32 neg alpha 1.0f32
294exit 27
295end
296rrNew = gpuDot64 get dR 0 get dR 0 N
297put cgTol 0 rrNew
298if le rrNew get cgTol 1
299ret false
300end
301beta = div rrNew rr
302if not gpuAxpy get dR 0 get dP 0 N 1.0f32 f32 beta
303exit 28
304end
305ret true
306end
307
308fn gpuSolveCG bM long xM long mM long L ulong diag f32 maxIt ulong to ulong
309N = mul mul L L mul L L
310put cgCfg 0 N
311if not uZeroBuf xM N
312exit 22
313end
314if not gpuAxpy bM get dR 0 N 1.0f32 0.0f32
315exit 23
316end
317if not gpuAxpy bM get dP 0 N 1.0f32 0.0f32
318exit 24
319end
320rr = gpuDot64 get dR 0 get dR 0 N
321if le rr bitcast f64 ulong 0x3af3017d8a34c436
322ret 0
323end
324put cgTol 0 rr
325put cgTol 1 mul rr bitcast f64 ulong 0x3d719799812dea11
326it = ulong 0
327while lt it maxIt bound 4096
328it = add it 1
329if not cgStep xM mM L diag
330break
331end
332end
333ret it
334end
335
336note =========================================================================
337note Populate 4D region masks on GPU in 64 KiB streaming chunks
338note =========================================================================
339fn coordIsFull idx ulong L ulong to bool
340x3 = rem idx L
341t = div idx L
342x2 = rem t L
343t = div t L
344x1 = rem t L
345x0 = div t L
346lm1 = sub L 1
347if or eq x0 0 eq x0 lm1
348ret false
349end
350if or eq x1 0 eq x1 lm1
351ret false
352end
353if or eq x2 0 eq x2 lm1
354ret false
355end
356if or eq x3 0 eq x3 lm1
357ret false
358end
359ret true
360end
361
362fn coordIsInt idx ulong L ulong to bool
363lo = div L 4
364hi = sub L lo
365x3 = rem idx L
366t = div idx L
367x2 = rem t L
368t = div t L
369x1 = rem t L
370x0 = div t L
371if or lt x0 lo ge x0 hi
372ret false
373end
374if or lt x1 lo ge x1 hi
375ret false
376end
377if or lt x2 lo ge x2 hi
378ret false
379end
380if or lt x3 lo ge x3 hi
381ret false
382end
383ret true
384end
385
386fn buildMasks L ulong to bool
387N = mul mul L L mul L L
388for pass ulong 3
389tgt = get dMaskFull 0
390if eq pass 1
391tgt = get dMaskInt 0
392end
393if eq pass 2
394tgt = get dMaskOut 0
395end
396off = ulong 0
397while lt off N bound 2048
398cnt = sub N off
399if gt cnt 16384
400cnt = ulong 16384
401end
402for k ulong cnt bound 16384
403idx = add off k
404isF = coordIsFull idx L
405isI = coordIsInt idx L
406val = f32 0.0f32
407if eq pass 0
408if isF
409val = f32 1.0f32
410end
411end
412if eq pass 1
413if isI
414val = f32 1.0f32
415end
416end
417if eq pass 2
418if and isF not isI
419val = f32 1.0f32
420end
421end
422uStagePut k val
423end
424if not uStageFlush tgt mul off 4 cnt
425ret false
426end
427off = add off cnt
428end
429end
430ret true
431end
432
433note Populate boundary collar eta on dEta (0 on interior, collar pattern on boundary)
434note mode: 0=const(1.0), 1=sin1, 2=uv_checkerboard, 3=rand_N01
435fn collarVal idx ulong L ulong mode ulong to f32
436if coordIsFull idx L
437ret 0.0f32
438end
439if eq mode 0
440ret 1.0f32
441end
442if eq mode 3
443ret f32 uRngNorm64
444end
445x3 = rem idx L
446t = div idx L
447x2 = rem t L
448t = div t L
449x1 = rem t L
450x0 = div t L
451if eq mode 2
452if eq and add add x0 x1 add x2 x3 1 0
453ret 1.0f32
454end
455ret neg 1.0f32
456end
457pf = div uPi f64 sub L 1
458acc = uSin64 mul pf f64 x0
459acc = add acc uSin64 mul pf f64 x1
460acc = add acc uSin64 mul pf f64 x2
461acc = add acc uSin64 mul pf f64 x3
462ret f32 acc
463end
464
465fn buildCollar L ulong mode ulong to bool
466N = mul mul L L mul L L
467uRngSeed add 0x517cc1b727220a95 mul L 131
468off = ulong 0
469while lt off N bound 2048
470cnt = sub N off
471if gt cnt 16384
472cnt = ulong 16384
473end
474for k ulong cnt bound 16384
475uStagePut k collarVal add off k L mode
476end
477if not uStageFlush get dEta 0 mul off 4 cnt
478ret false
479end
480off = add off cnt
481end
482ret true
483end
484
485note Populate linear CentralObs probe K(x) supported inside Lambda_int onto dObs
486note obsKind: 0=BlockAvg, 1=GaussSmear(sigma=L/8), 2=Dipole, 3=Quadrupole, 4=SingleSite
487fn obsGauss x0 ulong x1 ulong x2 ulong x3 ulong L ulong obsKind ulong to f32
488ctr = mul 0.5f64 f64 sub L 1
489sig = div f64 L 8.0f64
490d = sub f64 x0 ctr
491r2 = mul d d
492d = sub f64 x1 ctr
493r2 = add r2 mul d d
494d = sub f64 x2 ctr
495r2 = add r2 mul d d
496d = sub f64 x3 ctr
497r2 = add r2 mul d d
498g = uExp64 neg div mul 0.5f64 r2 mul sig sig
499if eq obsKind 1
500ret f32 g
501end
502if eq obsKind 2
503ret f32 mul sub f64 x0 ctr g
504end
505d = sub f64 x0 ctr
506sig = sub f64 x1 ctr
507ret f32 mul sub mul d d mul sig sig g
508end
509
510fn obsVal idx ulong L ulong obsKind ulong to f32
511if not coordIsInt idx L
512ret 0.0f32
513end
514if eq obsKind 0
515ret 1.0f32
516end
517x3 = rem idx L
518t = div idx L
519x2 = rem t L
520t = div t L
521x1 = rem t L
522x0 = div t L
523if eq obsKind 4
524mid = div L 2
525if and and and eq x0 mid eq x1 mid eq x2 mid eq x3 mid
526ret 1.0f32
527end
528ret 0.0f32
529end
530ret obsGauss x0 x1 x2 x3 L obsKind
531end
532
533fn buildObs L ulong obsKind ulong to bool
534N = mul mul L L mul L L
535off = ulong 0
536while lt off N bound 2048
537cnt = sub N off
538if gt cnt 16384
539cnt = ulong 16384
540end
541for k ulong cnt bound 16384
542uStagePut k obsVal add off k L obsKind
543end
544if not uStageFlush get dObs 0 mul off 4 cnt
545ret false
546end
547off = add off cnt
548end
549ret true
550end
551
552note =========================================================================
553note Exact 4D DST-I Spectral Oracle on L=8 (M = L-2 = 6 interior sites/axis)
554note =========================================================================
555fn idx4 a ulong b ulong c ulong d ulong M ulong to ulong
556r = add mul a M b
557r = add mul r M c
558ret add mul r M d
559end
560
561fn dst1dOne ax ulong idx ulong to f64
562i3 = rem idx 6
563i2 = rem div idx 6 6
564i1 = rem div idx 36 6
565i0 = div idx 216
566acc = f64 0.0f64
567for j ulong 6
568if eq ax 0
569s = get dstSin add mul i0 6 j
570k = idx4 j i1 i2 i3 6
571acc = add acc mul s get dstB k
572end
573if eq ax 1
574s = get dstSin add mul i1 6 j
575k = idx4 i0 j i2 i3 6
576acc = add acc mul s get dstB k
577end
578if eq ax 2
579s = get dstSin add mul i2 6 j
580k = idx4 i0 i1 j i3 6
581acc = add acc mul s get dstB k
582end
583if eq ax 3
584s = get dstSin add mul i3 6 j
585k = idx4 i0 i1 i2 j 6
586acc = add acc mul s get dstB k
587end
588end
589ret acc
590end
591
592fn dst1dAxis4 to void
593for ax ulong 4
594for idx ulong 1296
595put dstT idx dst1dOne ax idx
596end
597for idx ulong 1296
598put dstB idx get dstT idx
599end
600end
601end
602
603fn dstBuildTables to void
604pi = uPi
605norm = uSqrt64 div 2.0f64 7.0f64
606for k ulong 6
607kf = f64 add k 1
608sn = uSin64 div mul pi kf 14.0f64
609put dstEig k mul 4.0f64 mul sn sn
610for j ulong 6
611jf = f64 add j 1
612put dstSin add mul k 6 j mul norm uSin64 div mul pi mul kf jf 7.0f64
613end
614end
615end
616
617fn dstBuildRhs to void
618for idx ulong 1296
619i3 = rem idx 6
620t = div idx 6
621i2 = rem t 6
622t = div t 6
623i1 = rem t 6
624i0 = div t 6
625bc = f64 0.0f64
626if eq i0 0
627bc = add bc 1.0f64
628end
629if eq i0 5
630bc = add bc 1.0f64
631end
632if eq i1 0
633bc = add bc 1.0f64
634end
635if eq i1 5
636bc = add bc 1.0f64
637end
638if eq i2 0
639bc = add bc 1.0f64
640end
641if eq i2 5
642bc = add bc 1.0f64
643end
644if eq i3 0
645bc = add bc 1.0f64
646end
647if eq i3 5
648bc = add bc 1.0f64
649end
650put dstB idx bc
651end
652end
653
654fn dstDivEig ma2 f64 to void
655for idx ulong 1296
656lam = add ma2 get dstEig div idx 216
657lam = add lam get dstEig rem div idx 36 6
658lam = add lam get dstEig rem div idx 6 6
659lam = add lam get dstEig rem idx 6
660put dstB idx div get dstB idx lam
661end
662end
663
664fn dstMaxErrL8 to f64
665maxErr = f64 0.0f64
666hm = get dH 0
667for idx ulong 1296
668a = add div idx 216 1
669b = add rem div idx 36 6 1
670c = add rem div idx 6 6 1
671d = add rem idx 6 1
672gIdx = idx4 a b c d 8
673gpuV = f64 bitcast f32 uint mapget hm mul gIdx 4 4
674err = uAbs64 sub gpuV get dstH idx
675if gt err maxErr
676maxErr = err
677end
678end
679ret maxErr
680end
681
682fn runDst1OracleL8 ml f64 to bool
683ma = div ml 8.0f64
684ma2 = mul ma ma
685diag = f32 add 8.0f64 ma2
686dstBuildTables
687dstBuildRhs
688dst1dAxis4
689dstDivEig ma2
690dst1dAxis4
691for k ulong 1296
692put dstH k get dstB k
693end
694if not buildMasks 8
695ret false
696end
697if not buildCollar 8 0
698ret false
699end
700if not gpuHelm4d get dEta 0 get dB 0 get dMaskFull 0 8 diag
701ret false
702end
703if not gpuAxpy get dB 0 get dB 0 4096 neg 1.0f32 0.0f32
704ret false
705end
706it = gpuSolveCG get dB 0 get dH 0 get dMaskFull 0 8 diag 500
707maxErr = dstMaxErrL8
708if le maxErr 0.0001f64
709uPrint tOracleOk
710uPrintF64 maxErr
711uPrint tNl
712ret true
713end
714uPrint tOracleBad
715uPrintF64 maxErr
716uPrint tNl
717ret false
718end
719
720note =========================================================================
721note Run one (L, m*ell, collarMode) experiment on GB10
722note =========================================================================
723fn runObsProbes L ulong diag f32 to bool
724N = mul mul L L mul L L
725for obsKind ulong 5
726if not buildObs L obsKind
727ret false
728end
729dMu = uAbs64 gpuDot64 get dObs 0 get dH 0 N
730itO = gpuSolveCG get dObs 0 get dX 0 get dMaskFull 0 L diag 1200
731sig2 = gpuDot64 get dObs 0 get dX 0 N
732dObsVal = f64 0.0f64
733if gt sig2 bitcast f64 ulong 0x3af3017d8a34c436
734dObsVal = div dMu uSqrt64 sig2
735end
736uPrint tTab
737uPrintF64 dObsVal
738uPrint tTab
739uPrintF64 uGaussTv dObsVal
740end
741ret true
742end
743
744fn printCollarName collarMode ulong to void
745if eq collarMode 0
746uPrint tC0
747end
748if eq collarMode 1
749uPrint tC1
750end
751if eq collarMode 2
752uPrint tC2
753end
754if eq collarMode 3
755uPrint tC3
756end
757end
758
759fn runExperiment L ulong ml f64 collarMode ulong to bool
760t0 = monons
761N = mul mul L L mul L L
762ma = div ml f64 L
763diag = f32 add 8.0f64 mul ma ma
764if not buildCollar L collarMode
765ret false
766end
767if not gpuHelm4d get dEta 0 get dB 0 get dMaskFull 0 L diag
768ret false
769end
770if not gpuAxpy get dB 0 get dB 0 N neg 1.0f32 0.0f32
771ret false
772end
773itH = gpuSolveCG get dB 0 get dH 0 get dMaskFull 0 L diag 1200
774if not gpuMaskCopy get dH 0 get dObs 0 get dMaskInt 0 N
775ret false
776end
777if not gpuHelm4d get dObs 0 get dB 0 get dMaskOut 0 L diag
778ret false
779end
780if not gpuAxpy get dB 0 get dB 0 N neg 1.0f32 0.0f32
781ret false
782end
783itW = gpuSolveCG get dB 0 get dX 0 get dMaskOut 0 L diag 1200
784if not gpuAxpy get dObs 0 get dX 0 N 1.0f32 1.0f32
785ret false
786end
787if not gpuHelm4d get dX 0 get dB 0 get dMaskInt 0 L diag
788ret false
789end
790dRaw = uSqrt64 gpuDot64 get dObs 0 get dB 0 N
791uPrintU L
792uPrint tTab
793uPrintF64 ml
794uPrint tTab
795printCollarName collarMode
796uPrint tTab
797uPrintU itH
798uPrint tTab
799uPrintU itW
800uPrint tTab
801uPrintF64 dRaw
802uPrint tTab
803uPrintF64 uGaussTv dRaw
804if not runObsProbes L diag
805ret false
806end
807us = div ulong sub monons t0 1000
808uPrint tTab
809uPrintU us
810uPrint tNl
811ret true
812end
813
814fn allocField bytes ulong cached bool to long
815m = nvalloc bytes cached
816if le m 0
817uPrint tOpenErr
818uPrintU ulong get nvstage 0
819uPrint tNl
820exit 6
821end
822ret m
823end
824
825fn main to int
826uPrint tHdr
827if not gbopen 1
828uPrint tOpenErr
829uPrintU ulong get nvstage 0
830uPrint tNl
831ret 2
832end
833if not gbbopen
834uPrint tOpenErr
835uPrintU ulong get nvstage 0
836uPrint tNl
837ret 3
838end
839put uCodeMap 0 0
840uEmitAllKernels
841csize = mul div add get uCodePos 0 4095 4096 4096
842cm = nvalloc csize false
843if le cm 0
844ret 4
845end
846put uCodeMap 0 cm
847put uCodeFail 0 0
848uEmitAllKernels
849if ne get uCodeFail 0 0
850ret 5
851end
852
853note Max lattice L=64 -> 16,777,216 floats = 67,108,864 bytes (64 MiB) per buffer
854note Total 11 buffers x 64 MiB = 704 MiB (< 0.6% of GB10 128 GB unified memory!)
855maxBytes = ulong 67108864
856put dX 0 allocField maxBytes true
857put dB 0 allocField maxBytes true
858put dR 0 allocField maxBytes true
859put dP 0 allocField maxBytes true
860put dAp 0 allocField maxBytes true
861put dMaskFull 0 allocField maxBytes true
862put dMaskInt 0 allocField maxBytes true
863put dMaskOut 0 allocField maxBytes true
864put dEta 0 allocField maxBytes true
865put dH 0 allocField maxBytes true
866put dObs 0 allocField maxBytes true
867note Partial sums: up to 65536 CTAs x 4 B = 262,144 B (uncached for instant CPU f64 sum)
868put dPart 0 allocField 262144 false
869
870note 1. Self-verify GB10 CG solver against exact 4D DST-I spectral oracle on L=8
871if not runDst1OracleL8 2.0f64
872rc = nvmclose
873ret 10
874end
875
876note 2. Run UV-divergence scaling sweep across L = 8, 16, 32, 64
877uPrint tCols
878ls = new ulong 4 8
879put ls 1 16
880put ls 2 32
881put ls 3 64
882for li ulong 4
883L = get ls li
884if not buildMasks L
885rc = nvmclose
886ret 11
887end
888for mi ulong 2
889ml = f64 2.0f64
890if eq mi 1
891ml = f64 4.0f64
892end
893for cmode ulong 4
894if not runExperiment L ml cmode
895rc = nvmclose
896ret 12
897end
898end
899end
900end
901uPrint tDone
902rc = nvmclose
903ret 0
904end