interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / gpu / nvidia / native / speculation / replay.om

220 lines · 3309 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Native diagnostic stream entrypoint. Binary records are observations, not executable code.
3note No model loading, network, timer, filesystem helper or external runtime is invoked.
4global packet uchar 65537
5global reply uchar 2048
6global nwords ulong 1
7fn word i ulong to ulong
8v = ulong 0
9for j ulong 8
10v = or v shl ulong get packet add mul i 8 j mul j 8
11end
12ret v
13end
14fn outword i ulong v ulong to void
15for j ulong 8
16put reply add mul i 8 j uchar and shr v mul j 8 255
17end
18end
19fn unpack to int
20note Common header: SCX1 magic, version1, operation1..3, reserved0; then identities/profile/rows/prior.
21if lt get nwords 0 182
22ret 65
23end
24if ne word 0 827867987
25ret 65
26end
27if ne word 1 1
28ret 69
29end
30if lt word 2 1
31ret 77
32end
33if gt word 2 3
34ret 77
35end
36if ne word 3 0
37ret 65
38end
39for i ulong 64
40put sid i word add i 4
41end
42for i ulong 6
43put sprofile i word add i 68
44end
45for i ulong 77
46put srows i word add i 74
47end
48for i ulong 31
49put sprior i word add i 151
50end
51ret sheader
52end
53fn replay1 to int
54if ne get nwords 0 190
55ret 65
56end
57status = sbegin 0
58if ne status 0
59ret status
60end
61put scontrol 0 word 182
62put scontrol 1 word 183
63status = sselect word 184 word 185 word 186 word 187 word 188 word 189
64if ne status 0
65ret status
66end
67for i ulong 5
68outword add i 5 get decision i
69end
70outword 4 5
71ret 0
72end
73fn replay2 to int
74if lt get nwords 0 183
75ret 65
76end
77count = word 182
78if gt count 224
79ret 65
80end
81if ne get nwords 0 add 183 mul count 16
82ret 65
83end
84status = cstart
85if ne status 0
86ret status
87end
88for r ulong count
89for i ulong 16
90put cobs i word add add 183 mul r 16 i
91end
92status = cadd
93if ne status 0
94ret status
95end
96end
97status = cseal
98if ne status 0
99ret status
100end
101for i ulong 77
102outword add i 5 get srows i
103end
104for i ulong 7
105outword add i 82 get ccount i
106end
107for i ulong 21
108outword add i 89 get crange i
109end
110outword 4 105
111ret 0
112end
113fn replay3 to int
114if lt get nwords 0 317
115ret 65
116end
117for i ulong 5
118put pconfig i word add i 182
119end
120count = word 188
121if gt count 128
122ret 65
123end
124if ne get nwords 0 add 317 mul count 56
125ret 65
126end
127for i ulong 128
128put parmids i word add i 189
129end
130status = pstart word 187
131if ne status 0
132ret status
133end
134for r ulong count
135for i ulong 56
136put pobs i word add add 317 mul r 56 i
137end
138status = padd
139if ne status 0
140ret status
141end
142end
143for a ulong 3
144status = preport a
145if ne status 0
146ret status
147end
148for i ulong 12
149outword add add 5 mul a 12 i get summary i
150end
151end
152outword 4 36
153ret 0
154end
155fn publish to int
156outword 0 827867987
157outword 1 1
158outword 2 word 2
159outword 3 get sprofile 4
160bytes = mul add wordout 5 8
161done = ulong 0
162for i ulong 2048
163if eq done bytes
164ret 0
165end
166w = write 1 reply done sub bytes done
167if le w 0
168ret 74
169end
170done = add done ulong w
171end
172ret 74
173end
174fn wordout to ulong
175v = ulong 0
176for j ulong 8
177v = or v shl ulong get reply add 32 j mul j 8
178end
179ret v
180end
181fn decode bytes ulong to int
182if ne rem bytes 8 0
183ret 65
184end
185put nwords 0 div bytes 8
186status = unpack
187if ne status 0
188ret status
189end
190if eq word 2 1
191status = replay1
192end
193if eq word 2 2
194status = replay2
195end
196if eq word 2 3
197status = replay3
198end
199if ne status 0
200ret status
201end
202ret publish
203end
204fn main to int
205n = ulong 0
206for i ulong 65538
207if gt n 65536
208ret 65
209end
210r = read 0 packet n sub 65537 n
211if lt r 0
212ret 74
213end
214if eq r 0
215ret decode n
216end
217n = add n ulong r
218end
219ret 65
220end