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 / checks / arest-data.om

398 lines · 7731 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0
2note gpu/nvidia/checks/arest-data.om: the units over gpu/nvidia/om/apirest/data.om with apish_shp.om and
3note apish_slot.om: arfill, arcount, arargs, arpad, aridle, arroute, arperm, arwiden, arnext, arkey, arpfcopy,
4note arpfrat, arsegok, arsegb, argspec, arslot, arsgate. Each ax_ word lays one row out as the call of CUDApp
5note tests/api_rest_diff.c or tests/api_rest_partitions.h it stands for; the fills are the test's own loops.
6note Composed before arestg.om.
7text t_name "AREST-DATA"
8text t_fill "fill"
9text t_count "count"
10text t_args "args"
11text t_pad "pad"
12text t_idle "idle"
13text t_route "route"
14text t_perm "perm"
15text t_widen "widen"
16text t_next "next"
17text t_key "key"
18text t_pfcopy "pfcopy"
19text t_pfrat "pfrat"
20text t_segok "segok"
21text t_segb "segb"
22text t_gspec "gspec"
23text t_slot "slot"
24text t_sgate "sgate"
25note the q of the last next row, for a row whose flag is 1
26global ax_nq ulong 12
27note x[i] = i % 3 ? UINT32_MAX : 0
28fn ax_xgen x edit uint 65537 to void
29for i ulong 65537
30if ne rem i 3 0
31put x i 4294967295
32end
33end
34end
35fn ax_fill q view ulong 256 o edit ulong 256 to ulong
36n = get q 1
37if gt n 65537
38ckbad
39end
40y = new uint 65537 0x5a5a5a5a
41r = arfill get q 0 part y 0 n
42h = ardg0
43for i ulong n bound 65537
44h = ardg h ulong get y i
45end
46put o 0 h
47ret r
48end
49fn ax_count q view ulong 256 to ulong
50n = get q 1
51if gt n 65537
52ckbad
53end
54x = new uint 65537 0
55ax_xgen x
56ret arcount get q 0 part x 0 n
57end
58fn ax_pad q view ulong 256 o edit ulong 256 to ulong
59n = get q 0
60if gt n 65537
61ckbad
62end
63x = new uint 65537 0
64ax_xgen x
65y = new uint 65537 0x5a5a5a5a
66r = arpad part x 0 n part y 0 n
67h = ardg0
68for i ulong n bound 65537
69h = ardg h ulong get y i
70end
71put o 0 h
72ret r
73end
74note Q n and the output length; h[i] = 0x3f00 + i % 128
75fn ax_widen q view ulong 256 o edit ulong 256 to ulong
76n = get q 0
77yl = get q 1
78if or gt n 65537 gt yl 65538
79ckbad
80end
81x = new ushort 65537 0
82for i ulong 65537
83put x i ushort add 16128 rem i 128
84end
85y = new f32 65538 0.0f32
86r = arwiden part x 0 n part y 0 yl
87if ne r 0
88ret r
89end
90h = ardg0
91for i ulong n bound 65537
92h = ardg h ulong bitcast uint get y i
93end
94put o 0 h
95ret r
96end
97fn ax_idle q view ulong 256 nq ulong to ulong
98n = get q 0
99if or ne nq 13 gt n 12
100ckbad
101end
102rec = new uint 12 0
103for i ulong 12
104put rec i uint get q add 1 i
105end
106ret aridle part rec 0 n
107end
108fn ax_args q view ulong 256 nq ulong ny ulong o edit ulong 256 to ulong
109if or gt nq 16 gt ny 32
110ckbad
111end
112va = new ulong 16 0
113for i ulong nq bound 16
114put va i get q i
115end
116y = new uint 32 0x5a5a5a5a
117r = arargs part va 0 nq part y 0 ny
118for i ulong 32
119put o i ulong get y i
120end
121ret r
122end
123note Q e; x[i] = (float)i
124fn ax_route q view ulong 256 o edit ulong 256 to ulong
125e = get q 0
126if gt e 4
127ckbad
128end
129x = new f32 160 0.0f32
130for i ulong 160
131put x i f32 i
132end
133y = new f32 180 -1.0f32
134r = arroute e part x 0 mul e 32 part y 0 mul e 36
135h = ardg0
136for i ulong mul e 36 bound 180
137h = ardg h ulong bitcast uint get y i
138end
139put o 0 h
140ret r
141end
142note Q lb; x[i] = (float)(i % 17), n = 32 * lb
143fn ax_perm q view ulong 256 o edit ulong 256 to ulong
144lb = get q 0
145n = mul 32 lb
146if gt n 512
147ckbad
148end
149x = new f32 512 0.0f32
150for i ulong 512
151put x i f32 rem i 17
152end
153y = new f32 512 7.0f32
154r = arperm lb part x 0 n part y 0 n
155h = ardg0
156for i ulong n bound 512
157h = ardg h ulong bitcast uint get y i
158end
159put o 0 h
160ret r
161end
162fn ax_next q view ulong 256 nq ulong o edit ulong 256 to ulong
163if ne nq 17
164ckbad
165end
166a = new ulong 12 0
167for i ulong 12
168if eq get q 0 0
169put a i get q add 1 i
170else
171put a i get ax_nq i
172end
173end
174cnt = new uint 4 0
175for i ulong 4
176put cnt i uint get q add 13 i
177end
178r = arnext a part cnt 0 4
179for i ulong 12
180put ax_nq i get a i
181put o add 129 i get a i
182end
183ret r
184end
185fn ax_key q view ulong 256 nq ulong ny ulong o edit ulong 256 to ulong
186if or ne nq 4 gt ny 8
187ckbad
188end
189s = new uint 3 0
190for i ulong 3
191put s i uint get q add 1 i
192end
193y = new uint 8 0x5a5a5a5a
194r = arkey uint get q 0 part s 0 3 part y 0 ny
195for i ulong 8
196put o i ulong get y i
197end
198ret r
199end
200note one copy into y, every byte of which is m before the call; the digest of the nk bytes, or 0 when it refuses
201fn ax_pfc a view ulong 4 s view uchar 147456 nk ulong m uchar to ulong
202y = new uchar 147456 m
203if ne arpfcopy a part s 0 nk part y 0 nk 0
204ret 0
205end
206h = ardg0
207for i ulong nk bound 147456
208h = ardg h ulong get y i
209end
210ret h
211end
212note Q n, k, layout, 0; s[i] = (uint8_t)(i / k). The copy runs twice, into bytes that are all 0 and into bytes
213note that are all 255 (outputs 0 and 1), so a byte the unit does not write differs from the table in one of them
214fn ax_pfcopy q view ulong 256 o edit ulong 256 to ulong
215n = get q 0
216k = get q 1
217if or or eq k 0 gt n 384 gt k 384
218ckbad
219end
220nk = mul n k
221a = new ulong 4 0
222for i ulong 4
223put a i get q i
224end
225s = new uchar 147456 0
226for i ulong nk bound 147456
227put s i uchar and div i k 255
228end
229put o 0 ax_pfc a s nk 0
230put o 1 ax_pfc a s nk 255
231ret 0
232end
233note Q n, k, layout, 0; sf[i] = (float)(i + 1); the (n/128)*(k/128) scales give (n/8)*(k/128+1) ratios
234fn ax_pfrat q view ulong 256 o edit ulong 256 to ulong
235n = get q 0
236kb = div get q 1 128
237ns = mul div n 128 kb
238nr = mul div n 8 add kb 1
239if or gt ns 9 gt nr 512
240ckbad
241end
242a = new ulong 4 0
243for i ulong 4
244put a i get q i
245end
246sf = new f32 9 0.0f32
247for i ulong 9
248put sf i f32 add i 1
249end
250y = new f32 512 0.0f32
251r = arpfrat a part sf 0 ns part y 0 nr
252h = ardg0
253for i ulong nr bound 512
254h = ardg h ulong bitcast uint get y i
255end
256put o 0 h
257ret r
258end
259fn ax_segok q view ulong 256 nq ulong to ulong
260if ne nq 10
261ckbad
262end
263e = new uint 4 0
264sc = new f32 4 0.0f32
265for i ulong 4
266put e i uint get q add 2 i
267put sc i bitcast f32 uint get q add 6 i
268end
269ret arsegok uint get q 0 uint get q 1 e sc
270end
271fn ax_segb q view ulong 256 nq ulong o edit ulong 256 to ulong
272if ne nq 6
273ckbad
274end
275e = new uint 3 0
276for i ulong 3
277put e i uint get q add 3 i
278end
279y = new uint 3 0x5a5a5a5a
280r = arsegb uint get q 0 uint get q 1 uint get q 2 e y
281for i ulong 3
282put o i ulong get y i
283end
284ret r
285end
286fn ax_gspec q view ulong 256 nq ulong o edit ulong 256 to ulong
287if ne nq 8
288ckbad
289end
290s = new uint 8 0
291for i ulong 8
292put s i uint get q i
293end
294y = new uint 6 0x5a5a5a5a
295r = argspec s y
296for i ulong 6
297put o i ulong get y i
298end
299ret r
300end
301note Q q (8), r (3), stats (7); all three are edited, so each word comes back at 128 + its place in Q
302fn ax_slot q view ulong 256 nq ulong o edit ulong 256 to ulong
303if ne nq 18
304ckbad
305end
306a = new ulong 8 0
307for i ulong 8
308put a i get q i
309end
310r = new ulong 3 0
311for i ulong 3
312put r i get q add 8 i
313end
314st = new ulong 7 0
315for i ulong 7
316put st i get q add 11 i
317end
318rc = arslot a r st
319for i ulong 8
320put o add 128 i get a i
321end
322for i ulong 3
323put o add 136 i get r i
324end
325for i ulong 7
326put o add 139 i get st i
327end
328ret bitcast ulong rc
329end
330fn ax_sgate q view ulong 256 nq ulong to ulong
331if ne nq 4
332ckbad
333end
334r = new ulong 3 0
335for i ulong 3
336put r i get q add 1 i
337end
338rc = arsgate get q 0 r
339ret bitcast ulong rc
340end
341fn ax_a q view ulong 256 nq ulong ny ulong o edit ulong 256 to ulong
342if ckis 0 t_fill
343ret ax_fill q o
344end
345if ckis 0 t_count
346ret ax_count q
347end
348if ckis 0 t_pad
349ret ax_pad q o
350end
351if ckis 0 t_widen
352ret ax_widen q o
353end
354if ckis 0 t_idle
355ret ax_idle q nq
356end
357if ckis 0 t_args
358ret ax_args q nq ny o
359end
360if ckis 0 t_route
361ret ax_route q o
362end
363if ckis 0 t_perm
364ret ax_perm q o
365end
366if ckis 0 t_next
367ret ax_next q nq o
368end
369ckbad
370ret 0
371end
372fn arop q view ulong 256 nq ulong ny ulong o edit ulong 256 to ulong
373if ckis 0 t_key
374ret ax_key q nq ny o
375end
376if ckis 0 t_pfcopy
377ret ax_pfcopy q o
378end
379if ckis 0 t_pfrat
380ret ax_pfrat q o
381end
382if ckis 0 t_segok
383ret ax_segok q nq
384end
385if ckis 0 t_segb
386ret ax_segb q nq o
387end
388if ckis 0 t_gspec
389ret ax_gspec q nq o
390end
391if ckis 0 t_slot
392ret ax_slot q nq o
393end
394if ckis 0 t_sgate
395ret ax_sgate q nq
396end
397ret ax_a q nq ny o
398end