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.om

58 lines · 1713 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0
2note gpu/nvidia/checks/arest.om: the shared part of the arest-* checks, the launch(), cache() and steps() blocks of
3note CUDApp tests/api_rest_diff.c. Each apirest unit carries om2 and is a program's head alone, so each has its own
4note check: the unit's parts (gpu/units.tsv), lib.om, lib-om2.om, its arest-UNIT.om (text t_name, text t_au, fn
5note arop) and then this part. Rows:
6note UNIT NY Q E R
7note Q is the call's input words (16 hex digits each, - for none), which arop gives the unit in its own layout; NY
8note is the length of the unit's output view. E lists (index, value) word pairs, 16 hex digits each, that the
9note outputs must hold: index i below 64 is output word i, index 64 + j is word j of an edited q after the call. R
10note is the unit's answer, one word of 16 hex digits; it is last so that the gate's table control changes a word.
11note The rows hold at most 64 input words and 64 output words, the largest of the calls.
12fn cname to void
13for i ulong len t_name bound 64
14ckoc ulong get t_name i
15end
16end
17note word j of field i, a run of 16 hex digits
18fn arw i ulong j ulong to ulong
19w = ulong 0
20for k ulong 8
21w = or shl w 8 ckhex i add mul j 8 k
22end
23ret w
24end
25fn crow to bool
26if or ne ckcnt 5 not ckis 0 t_au
27ckbad
28end
29ny = cknum 1
30nb = ckhexn 2
31eb = ckhexn 3
32if or or gt ny 64 gt nb 512 or ne rem nb 8 0 ne rem eb 16 0
33ckbad
34end
35if ne ckhexn 4 8
36ckbad
37end
38nq = div nb 8
39q = new ulong 64 0
40for j ulong nq bound 64
41put q j arw 2 j
42end
43o = new ulong 128 0
44r = arop q nq ny o
45if ne r arw 4 0
46ret false
47end
48for j ulong div eb 16 bound 1099511627776
49k = arw 3 mul j 2
50if ge k 128
51ckbad
52end
53if ne get o k arw 3 add mul j 2 1
54ret false
55end
56end
57ret true
58end