interplane.Get Omega
Read in your language

babel

aien-dev/babel

Brought by drakestapleton

branch main Branches Tags History

babel / src / 60-report.om

961 lines · 14596 bytes Raw Blame History
1note babel 60-report: REPORT.md, report.json, omega/manifest.json, progress and the terminal summary.
2global Cnt ulong 8
3global Ah0 ulong 1
4global Ahn ulong 1
5global Ar0 ulong 1
6global Arn ulong 1
7global Tty ulong 1
8text Ver "0.1.0"
9text Prof "S1 c17-uint64-pure-v1"
10text LnC "c"
11text LnRs "rust"
12text LnPy "python"
13text LnGo "go"
14text LnZig "zig"
15text LnCpp "cpp"
16text LnOth "other"
17text VTr "TRANSLATED"
18text VUn "UNSUPPORTED("
19text VMi "MISSING_IMPLEMENTATION"
20text VFa "FAIL"
21text VNr "NOT_RUN"
22text VAb "ABSORBED"
23text VPe "PENDING"
24text VEx "EXPORTED"
25text KFn "function"
26text KDe "declaration"
27text KPp "preprocessor"
28text KEof "unterminated"
29text KFi "file"
30text KAb "header"
31text SgSplit "split"
32text SgImp "import"
33text SgLow "lower"
34text SgOmc "omega-check"
35text SgExp "export"
36text SgBld "build"
37text SgDif "differential"
38text SgOrc "oracle"
39text CGrn "[32m"
40text CRed "[31m"
41text CYel "[33m"
42text CMag "[35m"
43text CDim "[2m"
44text CBold "[1m"
45text COff "[0m"
46text CEl "[K"
47text Unk "unknown"
48text MAbs " absorbed"
49
50note ---------- small vocabulary ----------
51fn blang g ulong to void
52if eq g 1
53bs LnC
54ret
55end
56if eq g 2
57bs LnRs
58ret
59end
60if eq g 3
61bs LnPy
62ret
63end
64if eq g 4
65bs LnGo
66ret
67end
68if eq g 5
69bs LnZig
70ret
71end
72if eq g 6
73bs LnCpp
74ret
75end
76bs LnOth
77end
78
79fn bverdict u ulong to void
80s = get Ust u
81if eq s 1
82bs VTr
83ret
84end
85if eq s 2
86bs VUn
87bu get Urc u
88bc 41
89ret
90end
91if eq s 3
92bs VMi
93ret
94end
95if eq s 4
96bs VFa
97ret
98end
99if eq s 5
100bs VNr
101ret
102end
103if eq s 6
104bs VAb
105ret
106end
107if eq s 7
108bs VEx
109ret
110end
111bs VPe
112end
113
114fn bkind u ulong to void
115k = get Ukd u
116if eq k 1
117bs KFn
118ret
119end
120if eq k 2
121bs KDe
122ret
123end
124if eq k 3
125bs KPp
126ret
127end
128if eq k 4
129bs KEof
130ret
131end
132if eq k 5
133bs KFi
134ret
135end
136bs KAb
137end
138
139fn bstage u ulong to void
140g = get Usg u
141if eq g 1
142bs SgSplit
143ret
144end
145if eq g 2
146bs SgImp
147ret
148end
149if eq g 3
150bs SgLow
151ret
152end
153if eq g 4
154bs SgOmc
155ret
156end
157if eq g 5
158bs SgExp
159ret
160end
161if eq g 6
162bs SgBld
163ret
164end
165if eq g 7
166bs SgDif
167ret
168end
169bs SgOrc
170end
171
172note "path:l0-l1" of unit u
173fn bloc u ulong to void
174fi = get Ufi u
175bpl get F0 fi get Fl fi
176bc 58
177bu get Ul0 u
178if ne get Ul1 u get Ul0 u
179bc 45
180bu get Ul1 u
181end
182end
183
184note display name: the function name, or the latest identifier, or "-"
185fn bdisp u ulong to void
186if eq get Unn u 0
187bc 45
188ret
189end
190bname u
191end
192
193fn counts to void
194for i ulong 8
195put Cnt i 0
196end
197for u ulong get Nu 0
198s = get Ust u
199if lt s 8
200put Cnt s add get Cnt s 1
201end
202end
203end
204
205fn colon to bool
206ret eq get Col 0 1
207end
208
209note ANSI escape: ESC then s
210fn besc s view uchar * to void
211bc 27
212bs s
213end
214
215fn bcol u ulong to void
216if not colon
217ret
218end
219s = get Ust u
220if eq s 1
221besc CGrn
222end
223if eq s 2
224besc CYel
225end
226if eq s 3
227besc CMag
228end
229if eq s 4
230besc CRed
231end
232if ge s 5
233besc CDim
234end
235end
236
237fn boff to void
238if colon
239besc COff
240end
241end
242
243fn bbold to void
244if colon
245besc CBold
246end
247end
248
249note write Ob[m, mark) to fd and reset
250fn flush fd int m ulong to void
251w = write fd Ob m sub mark m
252reset m
253end
254
255note the text width of Ob[m, mark) in UTF-8 code points (continuation bytes are not counted)
256fn width m ulong to ulong
257c = ulong 0
258for i ulong sub mark m
259b = get Ob add m i
260if ne and b 192 128
261c = add c 1
262end
263end
264ret c
265end
266
267note pad the cell started at m to w columns
268fn pad m ulong w ulong to void
269k = width m
270if lt k w
271bsp sub w k
272end
273bc 32
274bc 32
275end
276
277note ---------- progress (stderr, only on a terminal) ----------
278note carriage return, erase line
279fn bcr to void
280bc 13
281besc CEl
282end
283text PrB " "
284fn progress u ulong to void
285if eq get Tty 0 0
286ret
287end
288m = mark
289bcr
290bc 32
291bc 32
292bc 91
293bu add u 1
294bc 47
295bu get Nu 0
296bc 93
297bc 32
298bdisp u
299bs PrB
300bloc u
301flush 2 m
302end
303
304note end of progress: clear the line
305fn progend to void
306if eq get Tty 0 0
307ret
308end
309m = mark
310bcr
311flush 2 m
312end
313
314note ---------- terminal summary ----------
315text THead "babel "
316text TArr " -> "
317text TIn " input "
318text TOut " output "
319text TAd " adapters omega-mv "
320text TAdP " (profile "
321text TFiles " files, "
322text TUnits " units\n\n"
323text TH1 "VERDICT"
324text TH2 "UNIT"
325text TH3 "WHERE"
326text TH4 "DETAIL"
327text TSum1 " translated "
328text TSum2 " unsupported "
329text TSum3 " missing implementation "
330text TSum4 " fail "
331text TSum5 " not run "
332text TSum6 " absorbed\n"
333text TRep " report "
334text TRepF "/REPORT.md\n"
335text TTst " tests "
336text TTP "PASS (generated tests ran over the oracle outputs: diff/test.log)\n"
337text TTF "FAIL (see diff/test.log)\n"
338text TTN "NOT_RUN (no generated test harness for this target)\n"
339text TOk "translated = adapter exit 0, Omega check exit 0, and C / Omega / target outputs byte-identical on every vector\n"
340
341fn summary to void
342m = mark
343bbold
344bs THead
345bs Ver
346boff
347bc 32
348bc 32
349bpl get Rt0 0 get Rtn 0
350bs TArr
351blang get Lg 0
352bs NL
353bs TOut
354bout
355bs NL
356bs TAd
357bpl get Ah0 0 get Ahn 0
358bs TAdP
359bs Prof
360bc 41
361bs NL
362bs TIn
363bu get Nf 0
364bs TFiles
365bu get Nu 0
366bs TUnits
367flush 1 m
368table
369m = mark
370bs NL
371bc 32
372bc 32
373counts
374scount 1 TSum1
375scount 2 TSum2
376scount 3 TSum3
377scount 4 TSum4
378scount 5 TSum5
379scount 6 TSum6
380tstline
381csline
382bs TRep
383bout
384bs TRepF
385bc 32
386bc 32
387bs TOk
388flush 1 m
389end
390
391fn scount s ulong t view uchar * to void
392bu get Cnt s
393bs t
394end
395
396fn tstline to void
397t = get Tsr 0
398bs TTst
399if eq t 0
400bs TTP
401ret
402end
403if eq t 999
404bs TTN
405ret
406end
407bs TTF
408end
409
410note column widths from the data, capped
411fn table to void
412w1 = ulong len TH1
413w2 = ulong len TH2
414w3 = ulong len TH3
415for u ulong get Nu 0
416m = mark
417bverdict u
418w1 = umax w1 width m
419reset m
420bdisp u
421w2 = umax w2 width m
422reset m
423bloc u
424w3 = umax w3 width m
425reset m
426end
427w2 = umin w2 28
428w3 = umin w3 36
429m = mark
430bc 32
431bc 32
432c = mark
433bs TH1
434pad c w1
435c = mark
436bs TH2
437pad c w2
438c = mark
439bs TH3
440pad c w3
441bs TH4
442bs NL
443flush 1 m
444for u ulong get Nu 0
445trow u w1 w2 w3
446end
447end
448
449fn umax a ulong b ulong to ulong
450if gt a b
451ret a
452end
453ret b
454end
455
456fn umin a ulong b ulong to ulong
457if lt a b
458ret a
459end
460ret b
461end
462
463fn trow u ulong w1 ulong w2 ulong w3 ulong to void
464m = mark
465bc 32
466bc 32
467bcol u
468c = mark
469bverdict u
470pad c w1
471boff
472c = mark
473bdisp u
474pad c w2
475c = mark
476bloc u
477pad c w3
478bdetail u 96
479bs NL
480flush 1 m
481end
482
483note one-line detail: the reason, or the vector count for TRANSLATED, cut at w code points
484text DTr1 " vectors identical: original C, Omega, "
485fn bdetail u ulong w ulong to void
486c = mark
487if eq get Ust u 1
488bu get Unv u
489bs DTr1
490blang get Lg 0
491else
492bmd get Ur0 u get Urn u
493end
494cut c w
495end
496
497fn cut c ulong w ulong to void
498k = ulong 0
499i = c
500e = mark
501while lt i e bound 999999
502b = get Ob i
503if ne and b 192 128
504if eq k w
505put Ol 0 i
506bc 46
507bc 46
508bc 46
509ret
510end
511k = add k 1
512end
513i = add i 1
514end
515end
516
517note ---------- report.json ----------
518text JA "{\n \"schema\": \"babel.report.v1\",\n \"babel\": \""
519text JB "\",\n \"input\": "
520text JC ",\n \"output\": "
521text JD ",\n \"target\": \""
522text JE "\",\n \"profile\": \""
523text JF "\",\n \"adapters\": {\"repo\": \"aien-dev/omega-mv\", \"head\": "
524text JG ", \"ref\": "
525text JH ", \"native_omc_sha256\": \""
526text JI "\"},\n \"verdict_rule\": \"TRANSLATED = adapter exit 0, Omega check exit 0, and original C / Omega / target outputs byte-identical on every vector\",\n \"toolchains\": {"
527text JJ "},\n \"summary\": {"
528text JK "},\n \"generated_tests\": \""
529text JL "\",\n \"completion\": "
530text JL2 ",\n \"files\": ["
531text JM "\n ],\n \"units\": ["
532text JN "\n ]\n}\n"
533text JQ "\": "
534text JCm ", "
535text JNl "\n "
536text JT0 "\""
537text JTn "null"
538text JS1 "\"translated\": "
539text JS2 ", \"unsupported\": "
540text JS3 ", \"missing_implementation\": "
541text JS4 ", \"fail\": "
542text JS5 ", \"not_run\": "
543text JS6 ", \"absorbed\": "
544text JF1 "{\"path\": "
545text JF2 ", \"sha256\": \""
546text JF3 "\", \"bytes\": "
547text JF4 ", \"language\": \""
548text JF5 "\"}"
549text JU1 "{\"file\": "
550text JU2 ", \"line_start\": "
551text JU3 ", \"line_end\": "
552text JU4 ", \"kind\": \""
553text JU5 "\", \"name\": "
554text JU6 ", \"verdict\": \""
555text JU7 "\", \"stage\": \""
556text JU8 "\", \"exit_code\": "
557text JU9 ", \"reason\": "
558text JUa ", \"adapter_name\": "
559text JUb ", \"omega_name\": "
560text JUc ", \"vectors\": "
561text JUd ", \"omega_mismatches\": "
562text JUe ", \"target_mismatches\": "
563text JUf "}"
564text TlNm0 "cc"
565text TlNm1 "cargo"
566text TlNm2 "python3"
567text TlNm3 "c++"
568text TlNm4 "zig"
569text TlNm5 "go"
570text TsP "PASS"
571text TsF "FAIL"
572text TsN "NOT_RUN"
573
574fn bqpl o ulong n ulong to void
575bjq o n
576end
577
578fn bqnull o ulong n ulong to void
579if eq n 0
580bs JTn
581ret
582end
583bjq o n
584end
585
586fn btsr to void
587t = get Tsr 0
588if eq t 0
589bs TsP
590ret
591end
592if eq t 999
593bs TsN
594ret
595end
596bs TsF
597end
598
599fn jtool s ulong nm view uchar * to void
600if gt s 0
601bs JCm
602end
603bs JT0
604bs nm
605bs JQ
606if eq get Tok s 1
607bjq get Tv0 s get Tvn s
608else
609bs JTn
610end
611end
612
613fn jhead to void
614bs JA
615bs Ver
616bs JB
617bqpl get Rt0 0 get Rtn 0
618bs JC
619m = mark
620bout
621o = psave m sub mark m
622n = sub mark m
623reset m
624bqpl o n
625bs JD
626blang get Lg 0
627bs JE
628bs Prof
629bs JF
630bqnull get Ah0 0 get Ahn 0
631bs JG
632bqnull get Ar0 0 get Arn 0
633bs JH
634bs OmcPin
635bs JI
636jtool 0 TlNm0
637jtool 1 TlNm1
638jtool 2 TlNm2
639jtool 3 TlNm3
640jtool 4 TlNm4
641jtool 5 TlNm5
642bs JJ
643counts
644bs JS1
645bu get Cnt 1
646bs JS2
647bu get Cnt 2
648bs JS3
649bu get Cnt 3
650bs JS4
651bu get Cnt 4
652bs JS5
653bu get Cnt 5
654bs JS6
655bu get Cnt 6
656bs JK
657btsr
658bs JL
659cjson
660bs JL2
661end
662
663fn jfile f ulong to void
664if gt f 0
665bc 44
666end
667bs JNl
668bs JF1
669bqpl get F0 f get Fl f
670bs JF2
671bpl get Fh0 f 64
672bs JF3
673bu get Fsz f
674bs JF4
675blang get Flg f
676bs JF5
677end
678
679fn junit u ulong to void
680if gt u 0
681bc 44
682end
683bs JNl
684bs JU1
685fi = get Ufi u
686bqpl get F0 fi get Fl fi
687bs JU2
688bu get Ul0 u
689bs JU3
690bu get Ul1 u
691bs JU4
692bkind u
693bs JU5
694bqnull get Un0 u get Unn u
695bs JU6
696bverdict u
697bs JU7
698bstage u
699bs JU8
700bu get Urc u
701bs JU9
702bqnull get Ur0 u get Urn u
703junit2 u
704end
705
706fn junit2 u ulong to void
707bs JUa
708bqnull get Ua0 u get Uan u
709bs JUb
710bqnull get Uw0 u get Uwn u
711bs JUc
712bu get Unv u
713bs JUd
714bu get Umo u
715bs JUe
716bu get Umt u
717bs JUf
718end
719
720note report.json is built in the arena from m; the caller writes it to a file and/or stdout
721fn bjson to void
722jhead
723for f ulong get Nf 0
724jfile f
725end
726bs JM
727for u ulong get Nu 0
728junit u
729end
730bs JN
731end
732
733text PJson "report.json"
734text PMd "REPORT.md"
735text PMan "omega/manifest.json"
736
737note ---------- REPORT.md ----------
738text MA "# babel report\n\nGenerated by babel "
739text MB ". Every verdict below comes from a tool that ran in this pass; nothing is copied from a previous run.\n\n| | |\n|---|---|\n| input | `"
740text MC "` |\n| output | `"
741text MD "` |\n| target | "
742text ME " |\n| profile | "
743text MF " (pure functions of 0-6 `uint64_t` inputs: `+ - *` modulo 2^64, one return expression, at most 4096 bytes) |\n| adapters | aien-dev/omega-mv `"
744text MG "` (`"
745text MH "`), native omc sha256 `"
746text MI "` |\n| generated tests | "
747text MJ " |\n"
748text MTl "| "
749text MTm " | "
750text MTn " |\n"
751text MNo "not found"
752text MK "\n## Result\n\n"
753text ML "\n\n**Verdicts.** TRANSLATED: the adapters exited 0, the lowered unit passed the pinned omc, and the original C function, the Omega unit and the generated target printed byte-identical results on every test vector. UNSUPPORTED(rc): an adapter refused the unit with exit code rc; the first line of its stderr is the detail. MISSING_IMPLEMENTATION: no adapter exists for this construct, file or language yet. FAIL: a tool broke or two legs disagreed. NOT_RUN: a required tool was missing, so no verdict was reached. ABSORBED: the `#include <stdint.h>` line, which babel supplies to every unit.\n\n**Renames.** The S1 adapters accept only the function names `calc` or `omega_*`. babel hands every other function to them as `omega_<name>` and packages the result under the original name; the adapter name of each unit is listed in report.json (`adapter_name`).\n\n**Vectors.** Every unit runs on the 9 boundary values {0, 1, 2, 2^32-1, 2^32, 2^63-1, 2^63, 2^64-2, 2^64-1} (all combinations up to 3 inputs, 81 rows above that) plus 64 splitmix64 vectors from seed 20261026. The inputs and all three outputs are kept under `diff/<name>/`.\n\n## Units\n\n| verdict | unit | where | kind | stage | detail |\n|---|---|---|---|---|---|\n"
754text MM "\n## Input files\n\n`input/` is a byte copy of these files; each sha256 below was computed while copying.\n\n| file | language | bytes | sha256 |\n|---|---|---|---|\n"
755text MN "\n## Not walked\n\nDot entries (`.git`, `.cache`, ...), symbolic links, other non-regular files, `*.babel` folders and unreadable directories are neither copied nor translated. Each one is counted in the completion record below and listed there as SKIPPED.\n"
756
757fn mtool s ulong nm view uchar * to void
758bs MTl
759bs nm
760bs MTm
761if eq get Tok s 1
762bmd get Tv0 s get Tvn s
763else
764bs MNo
765end
766bs MTn
767end
768
769fn mdhead to void
770bs MA
771bs Ver
772bs MB
773bpl get Rt0 0 get Rtn 0
774bs MC
775bout
776bs MD
777blang get Lg 0
778bs ME
779bs Prof
780bs MF
781if eq get Ahn 0 0
782bs Unk
783else
784bpl get Ah0 0 get Ahn 0
785end
786bs MG
787bpl get Ar0 0 get Arn 0
788bs MH
789bs OmcPin
790bs MI
791btsr
792bs MJ
793mtool 0 TlNm0
794mtool 1 TlNm1
795mtool 2 TlNm2
796mtool 3 TlNm3
797mtool 4 TlNm4
798mtool 5 TlNm5
799bs MK
800counts
801scount 1 TSum1
802scount 2 TSum2
803scount 3 TSum3
804scount 4 TSum4
805scount 5 TSum5
806bu get Cnt 6
807bs MAbs
808bs ML
809end
810
811fn mdunit u ulong to void
812bs MTl
813bverdict u
814bs MTm
815bc 96
816bdisp u
817bc 96
818bs MTm
819bloc u
820bs MTm
821bkind u
822bs MTm
823bstage u
824bs MTm
825if eq get Ust u 1
826bu get Unv u
827bs DTr1
828blang get Lg 0
829else
830bmd get Ur0 u get Urn u
831end
832bs MTn
833end
834
835fn mdfile f ulong to void
836bs MTl
837bmd get F0 f get Fl f
838bs MTm
839blang get Flg f
840bs MTm
841bu get Fsz f
842bs MTm
843bpl get Fh0 f 64
844bs MTn
845end
846
847fn bmdrep to void
848mdhead
849for u ulong get Nu 0
850mdunit u
851end
852bs MM
853for f ulong get Nf 0
854mdfile f
855end
856bs MN
857cmdsec
858end
859
860note ---------- omega/manifest.json ----------
861text OA "{\n \"schema\": \"babel.omega-manifest.v1\",\n \"profile\": \""
862text OB "\",\n \"adapters_head\": "
863text OC ",\n \"units\": ["
864text OD "\n ]\n}\n"
865text OE "{\"name\": "
866text OF ", \"source\": "
867text OG ", \"c\": \"omega/"
868text OH ".c\", \"omsa\": \"omega/"
869text OI ".omsa\", \"om\": "
870text OJ ", \"om_sha256\": "
871text OK "}"
872
873fn bmanifest to void
874bs OA
875bs Prof
876bs OB
877bqnull get Ah0 0 get Ahn 0
878bs OC
879k = ulong 0
880for u ulong get Nu 0
881if ne get Ukd u 1
882continue
883end
884if lt get Usg u 3
885continue
886end
887if gt k 0
888bc 44
889end
890k = add k 1
891bs JNl
892manunit u
893end
894bs OD
895end
896
897text OmNone "null"
898fn manunit u ulong to void
899bs OE
900c = mark
901bname u
902bjqob c
903bs OF
904c = mark
905bloc u
906bjqob c
907bs OG
908bname u
909bs OH
910bname u
911bs OI
912c = mark
913bouts DOmega
914bname u
915bs ExOm
916e = mark
917r = hfile c e
918reset c
919if lt r 0
920bs OmNone
921bs OJ
922bs OmNone
923else
924bc 34
925bs DOmega
926bname u
927bs ExOm
928bc 34
929bs OJ
930bc 34
931bhash
932bc 34
933end
934bs OK
935end
936
937note quote the arena bytes from c as a JSON string (moves them through the pool)
938fn bjqob c ulong to void
939n = sub mark c
940p = psave c n
941reset c
942bjq p n
943end
944
945note write REPORT.md, report.json and omega/manifest.json
946fn reports to void
947m = mark
948bmdrep
949w = wout m PMd
950bjson
951w = wout m PJson
952bmanifest
953w = wout m PMan
954end
955
956note --json: report.json on stdout
957fn jsonout to void
958m = mark
959bjson
960flush 1 m
961end