interplane.Get Omega
Read in your language

CUDApp

CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.

Brought by drakestapleton

branch main Branches Tags History

CUDApp / evidence / LEARN53-L777-CONTINUATION / author / omega-red.om

1326 lines · 19695 bytes Raw Blame History
1note LEARN653 v1 consumer checks. No compiler, judge, signer or process supervisor.
2note Task slots are 32 ulongs; see docs/learning/benchmark-v1.md.
3global LT ulong 2048
4global LS ulong 24
5global LSeen ulong 64
6global LWon ulong 64
7global LPin ulong 16
8global LWant uchar 256
9global LGot uchar 256
10
11fn lequal a ulong b ulong n ulong to bool
12for k ulong n
13if ne get LT add a k get LT add b k
14ret false
15end
16end
17ret true
18end
19
20fn lnonzero a ulong to bool
21x = ulong 0
22for k ulong 4
23x = or x get LT add a k
24end
25ret ne x 0
26end
27
28fn lrecord a ulong to ulong
29split = get LT add a 1
30if or eq get LT a 0 or lt split 1 gt split 4
31ret 2
32end
33if or ne get LT add a 5 1 ne get LT add a 4 1
34ret 3
35end
36if eq get LT add a 3 0
37ret 4
38end
39if eq get LT add a 6 0
40ret 4
41end
42if eq get LT add a 7 0
43ret 4
44end
45note Only public train/dev records are admissible to this builder-side API.
46note Adaptive/final custody stays with the existing independent owner.
47if or gt split 2 ne get LT add a 2 1
48ret 5
49end
50for h ulong 5
51if eq lnonzero add a add 8 mul h 4 false
52ret 6
53end
54end
55if or eq get LT add a 28 0 gt get LT add a 28 256
56ret 7
57end
58if or eq get LT add a 29 0 gt get LT add a 29 256
59ret 7
60end
61if or eq get LT add a 30 0 gt get LT add a 30 1000000
62ret 7
63end
64if ne get LT add a 31 0
65ret 7
66end
67ret 0
68end
69
70fn lpair a ulong b ulong to ulong
71if eq get LT a get LT b
72ret 8
73end
74if lequal add a 8 add b 8 4
75ret 9
76end
77if lequal add a 12 add b 12 4
78ret 10
79end
80if ne get LT add a 1 get LT add b 1
81if eq get LT add a 3 get LT add b 3
82ret 15
83end
84if eq get LT add a 7 get LT add b 7
85ret 11
86end
87if lequal add a 16 add b 16 4
88ret 12
89end
90if lequal add a 20 add b 20 4
91ret 13
92end
93if lequal add a 24 add b 24 4
94ret 14
95end
96end
97ret 0
98end
99
100fn lmanifest n ulong to ulong
101if or eq n 0 gt n 64
102ret 1
103end
104for i ulong n
105a = mul i 32
106code = lrecord a
107if ne code 0
108ret code
109end
110for j ulong i
111b = mul j 32
112code = lpair a b
113if ne code 0
114ret code
115end
116end
117end
118ret 0
119end
120
121note Caller supplies independent expected bytes and actual executor observations.
122note Status 0=completed, 1=syntax,2=type,3=unsupported,4=timeout,5=resource,6=operational.
123note Result 0=correct,1..6 as above,7=wrong value,8=trap mismatch,9=empty output,10=malformed.
124fn lobserve status ulong wantcode ulong gotcode ulong wantn ulong gotn ulong to ulong
125if gt status 6
126ret 10
127end
128if ne status 0
129ret status
130end
131if or gt wantn 256 gt gotn 256
132ret 10
133end
134if ne wantcode gotcode
135ret 8
136end
137if ne wantcode 0
138note Only declared runtime traps 101..107; arbitrary exit failures never pass.
139if or lt wantcode 101 or gt wantcode 107 ne wantn 0
140ret 10
141end
142if ne gotn 0
143ret 8
144end
145ret 0
146end
147if eq wantn 0
148ret 10
149end
150if eq gotn 0
151ret 9
152end
153if ne wantn gotn
154ret 7
155end
156for i ulong wantn
157if ne get LWant i get LGot i
158ret 7
159end
160end
161ret 0
162end
163
164note Full 256-bit compiler and executable identities, expected then observed.
165note LPin[0..3] expected compiler, [4..7] observed, [8..11] expected ELF, [12..15] observed.
166fn lpins to bool
167ca = ulong 0
168ba = ulong 0
169for i ulong 4
170ca = or ca get LPin i
171ba = or ba get LPin add i 8
172if ne get LPin i get LPin add i 4
173ret false
174end
175if ne get LPin add i 8 get LPin add i 12
176ret false
177end
178end
179ret and ne ca 0 ne ba 0
180end
181
182note Each begin is one explicit fresh development run; no durable resume API exists.
183note LS: active,tasks,maxattempts,attempts,pass1,passbudget,invalid,closed,
184note generation_us,compile_us,judge_us,other_us,input_tokens,output_tokens,peak_bytes,
185note energy_uj,energy_unknown,budget_us,completed,abstained,reserved...
186fn lbegin n ulong maxtries ulong budget ulong to ulong
187if eq get LS 0 1
188ret 20
189end
190for i ulong 24
191put LS i 0
192end
193for i ulong 64
194put LSeen i 0
195put LWon i 0
196end
197code = lmanifest n
198if ne code 0
199put LS 6 code
200ret code
201end
202if or eq maxtries 0 or gt maxtries 64 or eq budget 0 gt budget 1000000000000
203put LS 6 21
204ret 21
205end
206put LS 0 1
207put LS 1 n
208put LS 2 maxtries
209put LS 17 budget
210ret 0
211end
212
213note Charge before classifying. Costs are exact integer caller measurements, never estimates.
214note Missing cost values use all-ones and invalidate the run, never become free.
215fn lcost slot ulong value ulong to ulong
216if or lt slot 8 gt slot 15
217put LS 6 22
218ret 22
219end
220if gt value 1000000000000
221put LS 6 23
222ret 23
223end
224if eq slot 14
225if gt value get LS slot
226put LS slot value
227end
228else
229if gt get LS slot sub ulong 1000000000000 value
230put LS 6 23
231ret 23
232end
233put LS slot add get LS slot value
234end
235ret 0
236end
237
238note Attempt outcomes come from lobserve or explicit abstention 11, never compiler acceptance.
239note Mandatory cost vector is supplied per attempt in LC; energy unknown is explicit.
240global LC ulong 9
241
242fn lattempt task ulong ordinal ulong outcome ulong to ulong
243if ne get LS 0 1
244ret 24
245end
246for k ulong 8
247r = lcost add k 8 get LC k
248end
249if eq get LC 8 0
250put LS 16 add get LS 16 1
251if ne get LC 7 0
252put LS 6 25
253end
254else
255if ne get LC 8 1
256put LS 6 25
257end
258end
259put LS 3 add get LS 3 1
260note At most 64 attempts across a public development run, including failed attempts.
261if gt get LS 3 64
262put LS 6 31
263ret 31
264end
265if eq lpins false
266put LS 6 26
267end
268note Invalid costs or identities can never add successful tasks.
269if ne get LS 6 0
270ret get LS 6
271end
272if or ge task get LS 1 gt outcome 11
273put LS 6 27
274ret 27
275end
276if or ne ordinal add get LSeen task 1 gt ordinal get LS 2
277put LS 6 28
278ret 28
279end
280put LSeen task ordinal
281if eq outcome 0
282if eq ordinal 1
283put LS 4 add get LS 4 1
284end
285if eq get LWon task 0
286put LWon task 1
287put LS 5 add get LS 5 1
288end
289end
290if eq outcome 11
291put LS 19 add get LS 19 1
292end
293elapsed = add get LS 8 get LS 9
294elapsed = add elapsed get LS 10
295elapsed = add elapsed get LS 11
296if gt elapsed get LS 17
297put LS 6 29
298end
299ret get LS 6
300end
301
302fn lfinish to ulong
303if ne get LS 0 1
304ret 24
305end
306put LS 0 0
307for i ulong get LS 1
308if eq get LSeen i 0
309if eq get LS 6 0
310put LS 6 30
311end
312end
313end
314if ne get LS 6 0
315ret get LS 6
316end
317put LS 18 1
318ret 0
319end
320
321note GEN-1 genjac rule reused: lowercase ASCII word-triple SET Jaccard strictly above 1/2.
322note Input contains two public prompts only; never load final or sealed text here.
323global LText uchar 512
324global LStart ulong 128
325global LLength ulong 128
326global LCount ulong 2
327
328fn llower c uchar to uchar
329if and ge c 65 le c 90
330ret add c 32
331end
332ret c
333end
334
335fn lword c uchar to bool
336d = llower c
337ret or and ge d 97 le d 122 and ge d 48 le d 57
338end
339
340fn ltokens side ulong size ulong to bool
341if or gt side 1 gt size 256
342ret false
343end
344base = mul side 256
345slots = mul side 64
346count = ulong 0
347pos = ulong 0
348while lt pos size
349if gt get LText add base pos 127
350ret false
351end
352if lword get LText add base pos
353start = pos
354scanning = true
355while and lt pos size scanning
356if lword get LText add base pos
357pos = add pos 1
358else
359scanning = false
360end
361end
362if ge count 64
363ret false
364end
365put LStart add slots count add base start
366put LLength add slots count sub pos start
367count = add count 1
368else
369pos = add pos 1
370end
371end
372put LCount side count
373ret true
374end
375
376fn lwordeq a ulong b ulong to bool
377n = get LLength a
378if ne n get LLength b
379ret false
380end
381for k ulong n
382if ne llower get LText add get LStart a k llower get LText add get LStart b k
383ret false
384end
385end
386ret true
387end
388
389fn ltriple a ulong b ulong to bool
390for k ulong 3
391if eq lwordeq add a k add b k false
392ret false
393end
394end
395ret true
396end
397
398fn lunique at ulong base ulong to bool
399j = base
400while lt j at
401if ltriple at j
402ret false
403end
404j = add j 1
405end
406ret true
407end
408
409note 0=no near match,1=above threshold,2=insufficient words,3=unsupported input.
410fn lnear an ulong bn ulong to ulong
411if eq ltokens 0 an false
412ret 3
413end
414if eq ltokens 1 bn false
415ret 3
416end
417a = get LCount 0
418b = get LCount 1
419if or lt a 3 lt b 3
420ret 2
421end
422ua = ulong 0
423ub = ulong 0
424overlap = ulong 0
425for i ulong sub a 2
426if lunique i 0
427ua = add ua 1
428hit = false
429for j ulong sub b 2
430if ltriple i add 64 j
431hit = true
432end
433end
434if hit
435overlap = add overlap 1
436end
437end
438end
439for j ulong sub b 2
440if lunique add 64 j 64
441ub = add ub 1
442end
443end
444if gt mul overlap 3 add ua ub
445ret 1
446end
447ret 0
448end
449note SPDX-License-Identifier: AGPL-3.0-only
450note CUL1 public domain adapter. See docs/learn53/CONTRACT.md.
451note Caller owns/pins kt; only ko contains candidate observations. No code execution.
452global kt uchar 4096
453global ko uchar 1032
454fn kw i ulong to ulong
455v = ulong 0
456for j ulong 4
457v = or v shl ulong get kt add mul i 4 j mul j 8
458end
459ret v
460end
461fn kc i ulong to ulong
462v = ulong 0
463for j ulong 4
464v = or v shl ulong get ko add mul i 4 j mul j 8
465end
466ret v
467end
468fn kshape to ulong
469op = kw 2
470m = kw 5
471n = kw 6
472k = kw 7
473if eq op 3
474if eq m 2
475if eq n 3
476if eq k 2
477ret 301
478end
479end
480end
481if eq m 3
482if eq n 2
483if eq k 3
484ret 302
485end
486end
487end
488ret 0
489end
490if ne n 1
491ret 0
492end
493if ne k 1
494ret 0
495end
496base = mul op 100
497if eq m 3
498ret add base 1
499end
500if eq m 8
501ret add base 2
502end
503if eq m 17
504ret add base 3
505end
506ret 0
507end
508fn kextent rows ulong cols ulong stride ulong to ulong
509ret add mul sub rows 1 stride cols
510end
511fn kstrides to int
512op = kw 2
513m = kw 5
514if eq op 3
515if lt kw 8 kw 7
516ret 65
517end
518if lt kw 9 kw 6
519ret 65
520end
521if lt kw 10 kw 6
522ret 65
523end
524if ne kw 11 kextent m kw 7 kw 8
525ret 65
526end
527if ne kw 12 kextent kw 7 kw 6 kw 9
528ret 65
529end
530if ne kw 13 kextent m kw 6 kw 10
531ret 65
532end
533ret 0
534end
535if eq kw 8 0
536ret 65
537end
538if ne kw 11 kextent m 1 kw 8
539ret 65
540end
541if eq op 2
542if ne kw 9 0
543ret 65
544end
545if ne kw 12 0
546ret 65
547end
548if ne kw 10 1
549ret 65
550end
551if ne kw 13 1
552ret 65
553end
554ret 0
555end
556if eq kw 9 0
557ret 65
558end
559if eq kw 10 0
560ret 65
561end
562if ne kw 12 kextent m 1 kw 9
563ret 65
564end
565if ne kw 13 kextent m 1 kw 10
566ret 65
567end
568ret 0
569end
570fn kvalid n ulong to int
571note All variable reads follow size/count validation. Bounds precede arithmetic.
572if lt n 96
573ret 65
574end
575if gt n 4096
576ret 65
577end
578if ne kw 0 827086147
579ret 65
580end
581if ne kw 1 1
582ret 69
583end
584if gt kw 11 256
585ret 65
586end
587if gt kw 12 256
588ret 65
589end
590if eq kw 13 0
591ret 65
592end
593if gt kw 13 256
594ret 65
595end
596if ne n add 96 mul 4 add kw 11 kw 12
597ret 65
598end
599if ne kw 23 0
600ret 65
601end
602if eq kw 16 0
603ret 65
604end
605if ne kw 21 0
606ret 65
607end
608if ne kw 22 0
609ret 65
610end
611if lt kw 2 1
612ret 69
613end
614if gt kw 2 3
615ret 69
616end
617if ne kw 3 1
618ret 69
619end
620if ne kw 4 0
621ret 69
622end
623if ne kw 17 1
624ret 69
625end
626if ne kw 18 0
627ret 69
628end
629if ne kw 19 1
630ret 69
631end
632if ne kw 20 1
633ret 69
634end
635if eq kw 14 0
636ret 65
637end
638if gt kw 14 3
639ret 65
640end
641if ne kw 14 1
642ret 77
643end
644family = kshape
645if eq family 0
646ret 69
647end
648if ne kw 15 family
649ret 65
650end
651for i ulong 3
652if gt kw add i 8 32
653ret 65
654end
655end
656ret kstrides
657end
658fn ksum to ulong
659v = ulong 0
660for i ulong kw 5
661v = and add v kw add 24 mul i kw 8 4294967295
662end
663ret v
664end
665fn kdot row ulong col ulong to ulong
666v = ulong 0
667for i ulong kw 7
668a = kw add 24 add mul row kw 8 i
669b = kw add add 24 kw 11 add mul i kw 9 col
670v = and add v mul a b 4294967295
671end
672ret v
673end
674fn kexpect pos ulong to ulong
675op = kw 2
676if eq op 2
677ret ksum
678end
679stride = kw 10
680row = div pos stride
681col = rem pos stride
682if eq op 3
683if ge col kw 6
684ret 2779096485
685end
686ret kdot row col
687end
688if ne col 0
689ret 2779096485
690end
691a = kw add 24 mul row kw 8
692b = kw add add 24 kw 11 mul row kw 9
693ret and add a b 4294967295
694end
695fn keval n ulong c ulong to int
696status = kvalid n
697if ne status 0
698ret status
699end
700note Candidate result length is not trusted. No caller-supplied PASS or tolerance.
701if ne c mul 4 add kw 13 2
702ret 65
703end
704if ne kc 0 2779096485
705ret 1
706end
707if ne kc add kw 13 1 2779096485
708ret 1
709end
710for i ulong kw 13
711if ne kc add i 1 kexpect i
712ret 1
713end
714end
715ret 0
716end
717note SPDX-License-Identifier: AGPL-3.0-only
718note Eight fixed public development tasks. Not a sealed pool or a process runner.
719fn kput p ulong v ulong to void
720for i ulong 4
721put kt add mul p 4 i uchar and shr v mul i 8 255
722end
723end
724fn kbase id ulong to void
725for i ulong 4096
726put kt i 0
727end
728kput 0 827086147
729kput 1 1
730kput 3 1
731kput 5 3
732kput 6 1
733kput 7 1
734kput 8 2
735kput 9 2
736kput 10 2
737kput 11 5
738kput 12 5
739kput 13 5
740kput 14 1
741kput 16 id
742kput 17 1
743kput 19 1
744kput 20 1
745end
746fn klinear id ulong to void
747if eq id 1
748kput 2 1
749kput 15 101
750kput 24 4294967295
751kput 25 111
752kput 26 7
753kput 27 222
754kput 28 9
755kput 29 1
756kput 30 333
757kput 31 4
758kput 32 444
759kput 33 6
760ret
761end
762if eq id 4
763kput 2 2
764kput 15 201
765kput 9 0
766kput 10 1
767kput 12 0
768kput 13 1
769kput 24 4294967295
770kput 25 111
771kput 26 2
772kput 27 222
773kput 28 3
774ret
775end
776n = ulong 8
777if or eq id 3 eq id 6
778n = 17
779end
780kput 5 n
781kput 8 1
782kput 10 1
783kput 11 n
784if le id 3
785kput 2 1
786kput 9 1
787kput 12 n
788kput 13 n
789kput 15 add 100 id
790a = ulong 7
791b = ulong 9
792if eq id 3
793a = 4294967295
794b = 3
795end
796for i ulong n
797kput add 24 i a
798kput add add 24 n i b
799end
800else
801kput 2 2
802kput 9 0
803kput 12 0
804kput 13 1
805kput 15 add 197 id
806for i ulong n
807kput add 24 i 4294967295
808end
809end
810end
811fn kmatrix id ulong to void
812kput 2 3
813if eq id 7
814kput 5 2
815kput 6 3
816kput 7 2
817kput 8 3
818kput 9 4
819kput 10 4
820kput 11 5
821kput 12 7
822kput 13 7
823kput 15 301
824kput 24 1
825kput 25 2
826kput 26 999
827kput 27 3
828kput 28 4
829kput 29 5
830kput 30 6
831kput 31 7
832kput 32 999
833kput 33 8
834kput 34 9
835kput 35 10
836else
837kput 5 3
838kput 6 2
839kput 7 3
840kput 8 3
841kput 9 2
842kput 10 2
843kput 11 9
844kput 12 6
845kput 13 6
846kput 15 302
847for i ulong 9
848kput add 24 i add i 1
849end
850for i ulong 6
851kput add 33 i add i 1
852end
853end
854end
855fn kload id ulong to ulong
856note Reject before modifying either caller buffer. Valid loads never touch ko.
857if or eq id 0 gt id 8
858ret 0
859end
860kbase id
861if le id 6
862klinear id
863else
864kmatrix id
865end
866ret add 96 mul 4 add kw 11 kw 12
867end
868note SPDX-License-Identifier: AGPL-3.0-only
869note RED stubs: canonical attachment not implemented.
870fn aobserve id ulong status ulong code ulong n ulong to ulong
871ret 0
872end
873fn abegin budget ulong to ulong
874ret 0
875end
876fn aattempt idx ulong ordinal ulong status ulong code ulong n ulong to ulong
877ret 0
878end
879note SPDX-License-Identifier: AGPL-3.0-only
880note Public fixtures, never sealed evaluation. Expected literals independently checked with Wolfram.
881text okmsg "PASS "
882text badmsg "FAIL "
883global nums uchar 32
884global tally ulong 2
885global saved uchar 4096
886fn digit n ulong to void
887if ge n 10
888digit div n 10
889end
890put nums 0 uchar add 48 rem n 10
891w = write 1 nums 0 1
892end
893fn check yes bool to void
894put tally 0 add get tally 0 1
895if yes
896w = write 1 okmsg 0 len okmsg
897else
898w = write 1 badmsg 0 len badmsg
899put tally 1 add get tally 1 1
900end
901digit get tally 0
902put nums 0 10
903w = write 1 nums 0 1
904end
905fn tw p ulong v ulong to void
906for i ulong 4
907put kt add mul p 4 i uchar and shr v mul i 8 255
908end
909end
910fn cw p ulong v ulong to void
911for i ulong 4
912put ko add mul p 4 i uchar and shr v mul i 8 255
913end
914end
915fn header op ulong to void
916for i ulong 4096
917put kt i 0
918end
919for i ulong 258
920cw i 2779096485
921end
922tw 0 827086147
923tw 1 1
924tw 2 op
925tw 3 1
926tw 5 3
927tw 6 1
928tw 7 1
929tw 8 2
930tw 9 2
931tw 10 2
932tw 11 5
933tw 12 5
934tw 13 5
935tw 14 1
936tw 15 add mul op 100 1
937tw 16 1
938tw 17 1
939tw 19 1
940tw 20 1
941end
942fn vec to void
943header 1
944tw 24 4294967295
945tw 25 111
946tw 26 7
947tw 27 222
948tw 28 9
949tw 29 1
950tw 30 333
951tw 31 4
952tw 32 444
953tw 33 6
954cw 1 0
955cw 3 11
956cw 5 15
957end
958fn red to void
959header 2
960tw 9 0
961tw 10 1
962tw 12 0
963tw 13 1
964tw 24 4294967295
965tw 25 111
966tw 26 2
967tw 27 222
968tw 28 3
969cw 1 4
970end
971fn mat to void
972header 3
973tw 5 2
974tw 6 3
975tw 7 2
976tw 8 3
977tw 9 4
978tw 10 4
979tw 11 5
980tw 12 7
981tw 13 7
982tw 24 1
983tw 25 2
984tw 26 999
985tw 27 3
986tw 28 4
987tw 29 5
988tw 30 6
989tw 31 7
990tw 32 999
991tw 33 8
992tw 34 9
993tw 35 10
994cw 1 21
995cw 2 24
996cw 3 27
997cw 5 47
998cw 6 54
999cw 7 61
1000end
1001note SPDX-License-Identifier: AGPL-3.0-only
1002note Literal output oracle only. No kexpect/keval calls construct expected values.
1003fn csize id ulong to ulong
1004if eq id 1
1005ret 136
1006end
1007if eq id 2
1008ret 160
1009end
1010if eq id 3
1011ret 232
1012end
1013if eq id 4
1014ret 116
1015end
1016if eq id 5
1017ret 128
1018end
1019if eq id 6
1020ret 164
1021end
1022if eq id 7
1023ret 144
1024end
1025if eq id 8
1026ret 156
1027end
1028ret 0
1029end
1030fn coutn id ulong to ulong
1031if eq id 1
1032ret 28
1033end
1034if eq id 2
1035ret 40
1036end
1037if eq id 3
1038ret 76
1039end
1040if and ge id 4 le id 6
1041ret 12
1042end
1043if eq id 7
1044ret 36
1045end
1046if eq id 8
1047ret 32
1048end
1049ret 0
1050end
1051fn cvalues id ulong to void
1052for i ulong 258
1053cw i 2779096485
1054end
1055if eq id 1
1056cw 1 0
1057cw 3 11
1058cw 5 15
1059end
1060if eq id 2
1061for i ulong 8
1062cw add i 1 16
1063end
1064end
1065if eq id 3
1066for i ulong 17
1067cw add i 1 2
1068end
1069end
1070if eq id 4
1071cw 1 4
1072end
1073if eq id 5
1074cw 1 4294967288
1075end
1076if eq id 6
1077cw 1 4294967279
1078end
1079if eq id 7
1080cw 1 21
1081cw 2 24
1082cw 3 27
1083cw 5 47
1084cw 6 54
1085cw 7 61
1086end
1087if eq id 8
1088cw 1 22
1089cw 2 28
1090cw 3 49
1091cw 4 64
1092cw 5 76
1093cw 6 100
1094end
1095end
1096note SPDX-License-Identifier: AGPL-3.0-only
1097note SYNTHETIC unit metadata, pins and costs, NEVER a real benchmark record.
1098fn afix to void
1099for i ulong 2048
1100put LT i 0
1101end
1102for i ulong 24
1103put LS i 0
1104end
1105for i ulong 8
1106id = add i 1
1107a = mul i 32
1108n = kload id
1109put LT a id
1110put LT add a 1 2
1111put LT add a 2 1
1112put LT add a 3 kw 2
1113put LT add a 4 1
1114put LT add a 5 1
1115put LT add a 6 53
1116put LT add a 7 1
1117for j ulong 20
1118put LT add a add 8 j add add mul i 100 j 1
1119end
1120put LT add a 28 csize id
1121put LT add a 29 coutn id
1122put LT add a 30 1000000
1123end
1124for i ulong 4
1125put LPin i add i 1
1126put LPin add i 4 add i 1
1127put LPin add i 8 add i 5
1128put LPin add i 12 add i 5
1129end
1130for i ulong 9
1131put LC i 0
1132end
1133put LC 0 10
1134put LC 1 20
1135put LC 2 30
1136put LC 3 40
1137put LC 4 50
1138put LC 5 60
1139put LC 6 4096
1140end
1141fn agood id ulong to void
1142cvalues id
1143for i ulong 256
1144put LGot i get ko i
1145end
1146end
1147fn aobs to void
1148for i ulong 8
1149id = add i 1
1150agood id
1151check eq aobserve id 0 0 coutn id 0
1152put LGot sub coutn id 1 0
1153check eq aobserve id 0 0 coutn id 7
1154end
1155agood 1
1156check eq aobserve 0 0 0 28 10
1157check eq aobserve 9 0 0 28 10
1158check eq aobserve 18446744073709551615 0 0 28 10
1159check eq aobserve 1 0 0 0 9
1160check eq aobserve 1 0 0 27 7
1161check eq aobserve 1 0 0 257 10
1162check eq aobserve 1 0 0 18446744073709551615 10
1163check eq aobserve 1 0 101 0 8
1164check eq aobserve 1 7 0 28 10
1165for i ulong 6
1166check eq aobserve 1 add i 1 0 28 add i 1
1167end
1168note A task mutation is discarded; correct output for weakened task is wrong.
1169n = kload 1
1170tw 28 0
1171tw 21 1
1172tw 22 99
1173tw 14 3
1174check eq aobserve 1 0 0 28 0
1175check eq kw 28 9
1176check eq kw 21 0
1177check eq kw 22 0
1178check eq kw 14 1
1179cw 5 6
1180for i ulong 28
1181put LGot i get ko i
1182end
1183check eq aobserve 1 0 0 28 7
1184note Wrong logical output, skipped write, dense stride, PASS spoof, wrong task.
1185for i ulong 4
1186agood 1
1187if eq i 0
1188cw 3 12
1189end
1190if eq i 1
1191cw 5 2779096485
1192end
1193if eq i 2
1194cw 2 11
1195cw 3 15
1196cw 5 2779096485
1197end
1198if eq i 3
1199cw 1 1397965136
1200end
1201for j ulong 28
1202put LGot j get ko j
1203end
1204check eq aobserve 1 0 0 28 7
1205end
1206agood 1
1207check eq aobserve 2 0 0 28 7
1208end
1209fn aall to void
1210afix
1211check eq abegin 1000 0
1212check eq abegin 1000 20
1213for i ulong 8
1214id = add i 1
1215agood id
1216check eq aattempt i 1 0 0 coutn id 0
1217end
1218check eq lfinish 0
1219check eq get LS 18 1
1220check eq get LS 4 8
1221check eq get LS 5 8
1222check eq get LS 3 8
1223check eq get LS 16 8
1224check eq get LS 14 4096
1225note A subsequent invalid begin clears old completed-valid state.
1226put LT 1 3
1227check eq abegin 1000 1
1228check eq get LS 18 0
1229end
1230fn amissing to void
1231afix
1232check eq abegin 1000 0
1233for i ulong 7
1234id = add i 1
1235agood id
1236check eq aattempt i 1 0 0 coutn id 0
1237end
1238check eq lfinish 30
1239check eq get LS 18 0
1240afix
1241check eq abegin 1000 0
1242agood 1
1243check eq aattempt 0 1 0 0 28 0
1244check eq aattempt 0 1 0 0 28 28
1245check eq lfinish 28
1246check eq get LS 18 0
1247afix
1248check eq abegin 1000 0
1249check eq aattempt 8 1 0 0 28 27
1250check eq lfinish 27
1251end
1252fn abad to void
1253afix
1254check eq abegin 1000 0
1255for i ulong 8
1256id = add i 1
1257agood id
1258if eq id 8
1259put LGot 4 0
1260end
1261check eq aattempt i 1 0 0 coutn id 0
1262end
1263check eq lfinish 0
1264check eq get LS 18 1
1265check eq get LS 4 7
1266check eq get LS 5 7
1267note A valid experiment can report failure, never silently drop that task.
1268check eq get LS 1 8
1269check eq get LS 3 8
1270end
1271fn apins to void
1272for i ulong 8
1273afix
1274check eq abegin 1000 0
1275p = add i 4
1276if ge i 4
1277p = add i 8
1278end
1279put LPin p 999
1280agood 1
1281check eq aattempt 0 1 0 0 28 26
1282check eq get LS 4 0
1283check eq lfinish 26
1284end
1285afix
1286check eq abegin 1000 0
1287put LC 0 18446744073709551615
1288agood 1
1289check eq aattempt 0 1 0 0 28 23
1290check eq get LS 4 0
1291check eq lfinish 23
1292afix
1293check eq abegin 1 0
1294agood 1
1295check eq aattempt 0 1 0 0 28 29
1296check eq lfinish 29
1297check eq get LS 18 0
1298end
1299fn ameta to void
1300for i ulong 32
1301if or lt i 8 ge i 28
1302afix
1303put LT i 999
1304check eq abegin 1000 1
1305check eq get LS 18 0
1306end
1307end
1308afix
1309for i ulong 4
1310put LT add i 8 0
1311end
1312check eq abegin 1000 6
1313check eq get LS 18 0
1314end
1315fn main to int
1316aobs
1317aall
1318amissing
1319abad
1320apins
1321ameta
1322if ne get tally 1 0
1323ret 1
1324end
1325ret 0
1326end