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 / review / omega-review.om

1401 lines · 21025 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 Compose with exact omega653.lock core. No fork, runner, signer or cost collector.
870note LT/LPin/LC/status/exit are trusted executor inputs, not candidate claims.
871fn aword p ulong v ulong to void
872for i ulong 4
873put LWant add mul p 4 i uchar and shr v mul i 8 255
874end
875end
876fn aobserve id ulong status ulong code ulong n ulong to ulong
877tn = kload id
878if eq tn 0
879ret 10
880end
881if ne kvalid tn 0
882ret 10
883end
884for i ulong 256
885put LWant i 0
886end
887aword 0 2779096485
888for i ulong kw 13
889aword add i 1 kexpect i
890end
891aword add kw 13 1 2779096485
892want = mul 4 add kw 13 2
893ret lobserve status 0 code want n
894end
895fn afields to bool
896for i ulong 8
897a = mul i 32
898id = add i 1
899n = kload id
900if ne get LT a id
901ret false
902end
903if ne get LT add a 1 2
904ret false
905end
906if ne get LT add a 2 1
907ret false
908end
909if ne get LT add a 3 kw 2
910ret false
911end
912if ne get LT add a 4 1
913ret false
914end
915if ne get LT add a 5 1
916ret false
917end
918if ne get LT add a 6 53
919ret false
920end
921if ne get LT add a 7 1
922ret false
923end
924if ne get LT add a 28 n
925ret false
926end
927if ne get LT add a 29 mul 4 add kw 13 2
928ret false
929end
930if ne get LT add a 30 1000000
931ret false
932end
933if ne get LT add a 31 0
934ret false
935end
936end
937ret true
938end
939fn abegin budget ulong to ulong
940note Canonical active-run refusal preserves the existing run.
941if eq get LS 0 1
942ret 20
943end
944if eq afields false
945note Invalid count invokes canonical fresh-run invalidation, including stale scores.
946ret lbegin 0 1 budget
947end
948ret lbegin 8 1 budget
949end
950fn aattempt idx ulong ordinal ulong status ulong code ulong n ulong to ulong
951outcome = aobserve add idx 1 status code n
952ret lattempt idx ordinal outcome
953end
954note SPDX-License-Identifier: AGPL-3.0-only
955note Public fixtures, never sealed evaluation. Expected literals independently checked with Wolfram.
956text okmsg "PASS "
957text badmsg "FAIL "
958global nums uchar 32
959global tally ulong 2
960global saved uchar 4096
961fn digit n ulong to void
962if ge n 10
963digit div n 10
964end
965put nums 0 uchar add 48 rem n 10
966w = write 1 nums 0 1
967end
968fn check yes bool to void
969put tally 0 add get tally 0 1
970if yes
971w = write 1 okmsg 0 len okmsg
972else
973w = write 1 badmsg 0 len badmsg
974put tally 1 add get tally 1 1
975end
976digit get tally 0
977put nums 0 10
978w = write 1 nums 0 1
979end
980fn tw p ulong v ulong to void
981for i ulong 4
982put kt add mul p 4 i uchar and shr v mul i 8 255
983end
984end
985fn cw p ulong v ulong to void
986for i ulong 4
987put ko add mul p 4 i uchar and shr v mul i 8 255
988end
989end
990fn header op ulong to void
991for i ulong 4096
992put kt i 0
993end
994for i ulong 258
995cw i 2779096485
996end
997tw 0 827086147
998tw 1 1
999tw 2 op
1000tw 3 1
1001tw 5 3
1002tw 6 1
1003tw 7 1
1004tw 8 2
1005tw 9 2
1006tw 10 2
1007tw 11 5
1008tw 12 5
1009tw 13 5
1010tw 14 1
1011tw 15 add mul op 100 1
1012tw 16 1
1013tw 17 1
1014tw 19 1
1015tw 20 1
1016end
1017fn vec to void
1018header 1
1019tw 24 4294967295
1020tw 25 111
1021tw 26 7
1022tw 27 222
1023tw 28 9
1024tw 29 1
1025tw 30 333
1026tw 31 4
1027tw 32 444
1028tw 33 6
1029cw 1 0
1030cw 3 11
1031cw 5 15
1032end
1033fn red to void
1034header 2
1035tw 9 0
1036tw 10 1
1037tw 12 0
1038tw 13 1
1039tw 24 4294967295
1040tw 25 111
1041tw 26 2
1042tw 27 222
1043tw 28 3
1044cw 1 4
1045end
1046fn mat to void
1047header 3
1048tw 5 2
1049tw 6 3
1050tw 7 2
1051tw 8 3
1052tw 9 4
1053tw 10 4
1054tw 11 5
1055tw 12 7
1056tw 13 7
1057tw 24 1
1058tw 25 2
1059tw 26 999
1060tw 27 3
1061tw 28 4
1062tw 29 5
1063tw 30 6
1064tw 31 7
1065tw 32 999
1066tw 33 8
1067tw 34 9
1068tw 35 10
1069cw 1 21
1070cw 2 24
1071cw 3 27
1072cw 5 47
1073cw 6 54
1074cw 7 61
1075end
1076note SPDX-License-Identifier: AGPL-3.0-only
1077note Literal output oracle only. No kexpect/keval calls construct expected values.
1078fn csize id ulong to ulong
1079if eq id 1
1080ret 136
1081end
1082if eq id 2
1083ret 160
1084end
1085if eq id 3
1086ret 232
1087end
1088if eq id 4
1089ret 116
1090end
1091if eq id 5
1092ret 128
1093end
1094if eq id 6
1095ret 164
1096end
1097if eq id 7
1098ret 144
1099end
1100if eq id 8
1101ret 156
1102end
1103ret 0
1104end
1105fn coutn id ulong to ulong
1106if eq id 1
1107ret 28
1108end
1109if eq id 2
1110ret 40
1111end
1112if eq id 3
1113ret 76
1114end
1115if and ge id 4 le id 6
1116ret 12
1117end
1118if eq id 7
1119ret 36
1120end
1121if eq id 8
1122ret 32
1123end
1124ret 0
1125end
1126fn cvalues id ulong to void
1127for i ulong 258
1128cw i 2779096485
1129end
1130if eq id 1
1131cw 1 0
1132cw 3 11
1133cw 5 15
1134end
1135if eq id 2
1136for i ulong 8
1137cw add i 1 16
1138end
1139end
1140if eq id 3
1141for i ulong 17
1142cw add i 1 2
1143end
1144end
1145if eq id 4
1146cw 1 4
1147end
1148if eq id 5
1149cw 1 4294967288
1150end
1151if eq id 6
1152cw 1 4294967279
1153end
1154if eq id 7
1155cw 1 21
1156cw 2 24
1157cw 3 27
1158cw 5 47
1159cw 6 54
1160cw 7 61
1161end
1162if eq id 8
1163cw 1 22
1164cw 2 28
1165cw 3 49
1166cw 4 64
1167cw 5 76
1168cw 6 100
1169end
1170end
1171note SPDX-License-Identifier: AGPL-3.0-only
1172note SYNTHETIC unit metadata, pins and costs, NEVER a real benchmark record.
1173fn afix to void
1174for i ulong 2048
1175put LT i 0
1176end
1177for i ulong 24
1178put LS i 0
1179end
1180for i ulong 8
1181id = add i 1
1182a = mul i 32
1183n = kload id
1184put LT a id
1185put LT add a 1 2
1186put LT add a 2 1
1187put LT add a 3 kw 2
1188put LT add a 4 1
1189put LT add a 5 1
1190put LT add a 6 53
1191put LT add a 7 1
1192for j ulong 20
1193put LT add a add 8 j add add mul i 100 j 1
1194end
1195put LT add a 28 csize id
1196put LT add a 29 coutn id
1197put LT add a 30 1000000
1198end
1199for i ulong 4
1200put LPin i add i 1
1201put LPin add i 4 add i 1
1202put LPin add i 8 add i 5
1203put LPin add i 12 add i 5
1204end
1205for i ulong 9
1206put LC i 0
1207end
1208put LC 0 10
1209put LC 1 20
1210put LC 2 30
1211put LC 3 40
1212put LC 4 50
1213put LC 5 60
1214put LC 6 4096
1215end
1216fn agood id ulong to void
1217cvalues id
1218for i ulong 256
1219put LGot i get ko i
1220end
1221end
1222fn aobs to void
1223for i ulong 8
1224id = add i 1
1225agood id
1226check eq aobserve id 0 0 coutn id 0
1227put LGot sub coutn id 1 0
1228check eq aobserve id 0 0 coutn id 7
1229end
1230agood 1
1231check eq aobserve 0 0 0 28 10
1232check eq aobserve 9 0 0 28 10
1233check eq aobserve 18446744073709551615 0 0 28 10
1234check eq aobserve 1 0 0 0 9
1235check eq aobserve 1 0 0 27 7
1236check eq aobserve 1 0 0 257 10
1237check eq aobserve 1 0 0 18446744073709551615 10
1238check eq aobserve 1 0 101 0 8
1239check eq aobserve 1 7 0 28 10
1240for i ulong 6
1241check eq aobserve 1 add i 1 0 28 add i 1
1242end
1243note A task mutation is discarded; correct output for weakened task is wrong.
1244n = kload 1
1245tw 28 0
1246tw 21 1
1247tw 22 99
1248tw 14 3
1249check eq aobserve 1 0 0 28 0
1250check eq kw 28 9
1251check eq kw 21 0
1252check eq kw 22 0
1253check eq kw 14 1
1254cw 5 6
1255for i ulong 28
1256put LGot i get ko i
1257end
1258check eq aobserve 1 0 0 28 7
1259note Wrong logical output, skipped write, dense stride, PASS spoof, wrong task.
1260for i ulong 4
1261agood 1
1262if eq i 0
1263cw 3 12
1264end
1265if eq i 1
1266cw 5 2779096485
1267end
1268if eq i 2
1269cw 2 11
1270cw 3 15
1271cw 5 2779096485
1272end
1273if eq i 3
1274cw 1 1397965136
1275end
1276for j ulong 28
1277put LGot j get ko j
1278end
1279check eq aobserve 1 0 0 28 7
1280end
1281agood 1
1282check eq aobserve 2 0 0 28 7
1283end
1284fn aall to void
1285afix
1286check eq abegin 1000 0
1287check eq abegin 1000 20
1288for i ulong 8
1289id = add i 1
1290agood id
1291check eq aattempt i 1 0 0 coutn id 0
1292end
1293check eq lfinish 0
1294check eq get LS 18 1
1295check eq get LS 4 8
1296check eq get LS 5 8
1297check eq get LS 3 8
1298check eq get LS 16 8
1299check eq get LS 14 4096
1300note A subsequent invalid begin clears old completed-valid state.
1301put LT 1 3
1302check eq abegin 1000 1
1303check eq get LS 18 0
1304end
1305fn amissing to void
1306afix
1307check eq abegin 1000 0
1308for i ulong 7
1309id = add i 1
1310agood id
1311check eq aattempt i 1 0 0 coutn id 0
1312end
1313check eq lfinish 30
1314check eq get LS 18 0
1315afix
1316check eq abegin 1000 0
1317agood 1
1318check eq aattempt 0 1 0 0 28 0
1319check eq aattempt 0 1 0 0 28 28
1320check eq lfinish 28
1321check eq get LS 18 0
1322afix
1323check eq abegin 1000 0
1324check eq aattempt 8 1 0 0 28 27
1325check eq lfinish 27
1326end
1327fn abad to void
1328afix
1329check eq abegin 1000 0
1330for i ulong 8
1331id = add i 1
1332agood id
1333if eq id 8
1334put LGot 4 0
1335end
1336check eq aattempt i 1 0 0 coutn id 0
1337end
1338check eq lfinish 0
1339check eq get LS 18 1
1340check eq get LS 4 7
1341check eq get LS 5 7
1342note A valid experiment can report failure, never silently drop that task.
1343check eq get LS 1 8
1344check eq get LS 3 8
1345end
1346fn apins to void
1347for i ulong 8
1348afix
1349check eq abegin 1000 0
1350p = add i 4
1351if ge i 4
1352p = add i 8
1353end
1354put LPin p 999
1355agood 1
1356check eq aattempt 0 1 0 0 28 26
1357check eq get LS 4 0
1358check eq lfinish 26
1359end
1360afix
1361check eq abegin 1000 0
1362put LC 0 18446744073709551615
1363agood 1
1364check eq aattempt 0 1 0 0 28 23
1365check eq get LS 4 0
1366check eq lfinish 23
1367afix
1368check eq abegin 1 0
1369agood 1
1370check eq aattempt 0 1 0 0 28 29
1371check eq lfinish 29
1372check eq get LS 18 0
1373end
1374fn ameta to void
1375for i ulong 32
1376if or lt i 8 ge i 28
1377afix
1378put LT i 999
1379check eq abegin 1000 1
1380check eq get LS 18 0
1381end
1382end
1383afix
1384for i ulong 4
1385put LT add i 8 0
1386end
1387check eq abegin 1000 6
1388check eq get LS 18 0
1389end
1390fn main to int
1391aobs
1392aall
1393amissing
1394abad
1395apins
1396ameta
1397if ne get tally 1 0
1398ret 1
1399end
1400ret 0
1401end