interplane.Get Omega
Read in your language

aien-train

AIEN training programme: language-model history, GB10 constraints and the route to training on the project engine. Plans and runnable checks are distinguished.

Brought by drakestapleton

branch main Branches Tags History

aien-train / tools / verified_examples / sources.om

316 lines · 5604 bytes Raw Blame History
1note SPDX-License-Identifier: AGPL-3.0-or-later
2note Composed after examples.om with its main renamed to vxmodelmain by the gate/build command.
3text vsprep "prep"
4text vstaskdir "/tasks/"
5text vsrefs "references"
6text vsharness "harness"
7text vstask "task"
8text vsref "/reference."
9text vsstmt "/statement.txt"
10text vsslash "/"
11text vssource ",\"source\":"
12text vstaskkey "{\"task\":"
13text vsprogram ",\"program\":"
14text vscontract ",\"referee_contract\":"
15text vscompiler ",\"omc_sha256\":"
16text vsdigest ",\"task_set_sha256\":"
17text vsreceipt ",\"referee_output_sha256\":"
18text vsend "}\n"
19text vsarchive "archive"
20text vsformat "--format=tar"
21text vshead "HEAD"
22text vsgit "/usr/bin/git"
23text vsc "-C"
24text vsdiff "diff"
25text vsquiet "--quiet"
26text vsgate "/examples/gate.sh"
27text vsbash "/usr/bin/bash"
28text vstar "/harness.tar"
29text vsreceiptfile "/harness-receipt.txt"
30text vsreceiptbad "/harness-receipt.err"
31text vsexpect ".expect"
32text vssuffix ".om"
33text vspass "PASS"
34text vsexit "(exit"
35text vslicence ",\"licence_position\":"
36text vsreflic "reference source retains its original licence; verification is not a relicensing grant"
37global vscompilerhash uchar 64
38global vstaskhash uchar 64
39fn vscapturehash k ulong which ulong to void
40h = new uchar 64 0
41vxhash k h
42for i ulong 64
43if eq which 0
44put vscompilerhash i get h i
45else
46put vstaskhash i get h i
47end
48end
49end
50fn vswritehash which ulong to void
51h = new uchar 64 0
52for i ulong 64
53if eq which 0
54put h i get vscompilerhash i
55else
56put h i get vstaskhash i
57end
58end
59vxquote h
60end
61fn vssetup to void
62for i ulong 5
63vxarg add i 1 i
64end
65vxenvinit
66r = makedir vxp mul ulong 4 4096 get vxplen 4 448
67if ne r 0
68vxfail 3
69end
70vxcopy 5 1
71vxadd 5 vxdriver
72vxcopy 14 4
73vxadd 14 vxt56
74vxcopy 15 4
75vxadd 15 vxt57
76fd = vxopen 14 193
77put vxion 1 ulong fd
78vscapturehash 2 0
79end
80fn vsrecord name view uchar * rh view uchar 64 to void
81b = new uchar 8 0
82vxout vstaskkey
83vxquote name
84vxout vssource
85if eq get vxcounts 10 1
86vxquote vxrefsource
87else
88vxquote vxharsource
89end
90vxout vscontract
91vxqfile 12
92vxout vsprogram
93vxqfile 10
94vxout vscompiler
95vswritehash 0
96vxout vsdigest
97vswritehash 1
98vxout vsreceipt
99vxquote rh
100vxout vxt23
101if eq get vxcounts 10 1
102for i ulong get vxcounts 7
103put b i get vxp add mul ulong 11 4096 i
104end
105vxquote part b 0 get vxcounts 7
106else
107vxquote vxt39
108end
109vxout vxt26
110vxout vxarrnone
111vxout vsend
112end
113fn vsrefone lang view uchar * task view uchar 16 idx ulong to void
114h = new uchar 64 0
115l = new uchar 8 0
116for i ulong len lang
117put l i get lang i
118end
119put vxcounts 7 len lang
120vxset 11 lang
121vxcopy 10 1
122vxadd 10 vstaskdir
123vxadd 10 part task 0 6
124vxadd 10 vsref
125vxadd 10 lang
126vxcopy 12 1
127vxadd 12 vstaskdir
128vxadd 12 part task 0 6
129vxadd 12 vsstmt
130vxcopy 13 4
131vxadd 13 vxt46
132vxdecimal 13 get vxcounts 9
133put vxcounts 9 add get vxcounts 9 1
134r = vxreferee l task
135if ne r 0
136vxfail 17
137end
138vxcopy 6 13
139vxadd 6 vxevalout
140vxhash 6 h
141vsrecord part task 0 6 h
142put vxcounts idx add get vxcounts idx 1
143put vxcounts 4 add get vxcounts 4 1
144end
145fn vsreferences to void
146b = new uchar 16 0
147h = new uchar 64 0
148vxchecktasks
149vxhash 2 h
150if not vxequal h vxsha
151vxfail 10
152end
153for i ulong 64
154put vstaskhash i get vxtasks i
155end
156put vxcounts 10 1
157for n ulong 20
158for i ulong 4
159put b i get vstask i
160end
161v = add n 1
162put b 4 uchar add div v 10 48
163put b 5 uchar add rem v 10 48
164vsrefone vxt39 b 0
165vsrefone vxt36 b 1
166vsrefone vxt37 b 2
167vsrefone vxt38 b 3
168end
169end
170fn vsgitcmd cmd view uchar * tail view uchar * to ulong
171vxset 6 vxnull
172vxcopy 7 4
173vxadd 7 vstar
174vxcopy 8 4
175vxadd 8 vsreceiptbad
176vxpkinit
177vxpk vsgit
178vxpk vsc
179vxpkpath 1
180vxpk cmd
181vxpk tail
182vxpk vshead
183ret vxspawn
184end
185fn vsharone line view uchar * to void
186name = new uchar 4096 0
187h = new uchar 64 0
188n = vxword line 1 name
189if lt n 4
190vxfail 2
191end
192vxcopy 10 1
193vxadd 10 vsslash
194vxadd 10 part name 0 n
195vxadd 10 vssuffix
196vxcopy 12 1
197vxadd 12 vsslash
198vxadd 12 part name 0 n
199vxadd 12 vsexpect
200vxcopy 6 4
201vxadd 6 vsreceiptfile
202vxhash 6 h
203vsrecord part name 0 n h
204put vxcounts 0 add get vxcounts 0 1
205put vxcounts 4 add get vxcounts 4 1
206end
207fn vsharvest to void
208b = new uchar 4096 0
209a = new uchar 4096 0
210put vxcounts 10 2
211r = vsgitcmd vsdiff vsquiet
212if ne r 0
213vxfail 18
214end
215r = vsgitcmd vsarchive vsformat
216if ne r 0
217vxfail 18
218end
219vxcopy 6 4
220vxadd 6 vstar
221vscapturehash 6 1
222vxset 6 vxnull
223vxcopy 7 4
224vxadd 7 vsreceiptfile
225vxcopy 8 4
226vxadd 8 vsreceiptbad
227vxcopy 5 1
228vxadd 5 vsgate
229vxpkinit
230vxpk vsbash
231vxpkpath 5
232vxpkpath 2
233r = vxspawn
234if ne r 0
235vxfail 19
236end
237fd = vxopen 7 0
238while true bound 9223372036854775807
239n = vxline fd b
240if eq n 0
241break
242end
243z = vxword part b 0 n 0 a
244if vxequal part a 0 z vspass
245z = vxword part b 0 n 2 a
246if vxequal part a 0 z vsexit
247vsharone part b 0 n
248end
249end
250end
251vxclose fd
252end
253fn vsmanifest to void
254h = new uchar 64 0
255vxflush
256vxclose int get vxion 1
257vxhash 14 h
258fd = vxopen 15 193
259put vxion 1 ulong fd
260vxout vxt48
261vxoutnum get vxcounts 4
262vxout vxt49
263vxoutnum get vxcounts 0
264vxout vxt50
265vxoutnum get vxcounts 1
266vxout vxt51
267vxoutnum get vxcounts 2
268vxout vxt52
269vxoutnum get vxcounts 3
270vxout vxt53
271vxoutnum get vxcounts 5
272vxout vxt54
273vxquote h
274vxout vscompiler
275vswritehash 0
276vxout vsdigest
277vswritehash 1
278vxout vssource
279if eq get vxcounts 10 1
280vxquote vxrefsource
281else
282vxquote vxharsource
283end
284vxout vslicence
285vxquote vsreflic
286vxout vsend
287vxflush
288vxclose fd
289end
290fn main to int
291b = new uchar 4096 0
292if lt argcnt 7
293vxfail 2
294end
295n = argread 1 b 0 len b
296if lt n 0
297vxfail 2
298end
299if vxequal part b 0 ulong n vsprep
300put vxshift 0 1
301ret vxmodelmain
302end
303if vxequal part b 0 ulong n vsrefs
304vssetup
305vsreferences
306vsmanifest
307ret 0
308end
309if vxequal part b 0 ulong n vsharness
310vssetup
311vsharvest
312vsmanifest
313ret 0
314end
315ret vxmodelmain
316end