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

69 lines · 2050 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0
2note gpu/nvidia/checks/arestg.om: the shared part of the arest checks that hold several units of one head (data,
3note pack, tile, tern, bf16, pkh) or a unit of the packing(), prefill() and partition blocks of CUDApp
4note tests/api_rest_diff.c and tests/api_rest_partitions.h. A check is the units' parts (gpu/units.tsv), lib.om,
5note lib-om2.om, its arest-CHECK.om (text t_name, fn arop) and then this part. Rows:
6note UNIT NY Q E R
7note UNIT names the call; arop reads it (ckis 0) and gives the unit the Q words in its own layout. Q is at most 256
8note words of 16 hex digits (- for none); NY is the length of the unit's output view where the row sets it. E lists
9note (index, value) word pairs: index i below 128 is output word i, index 128 + p is input word p of Q after the
10note call (the views a unit edits). R is the unit's answer, one word, last so that the gate's table control changes
11note a word. Where the old test fills a large array by a loop, Q holds the loop's parameters, arop ports the loop and
12note output word 0 is the digest of the unit's output (ardg), which the table holds for the old test's expectation.
13fn cname to void
14for i ulong len t_name bound 64
15ckoc ulong get t_name i
16end
17end
18note word j of field i, a run of 16 hex digits
19fn arw i ulong j ulong to ulong
20w = ulong 0
21for k ulong 8
22w = or shl w 8 ckhex i add mul j 8 k
23end
24ret w
25end
26note the digest: FNV-1a over whole elements, from ardg0
27fn ardg0 to ulong
28ret 14695981039346656037
29end
30fn ardg h ulong v ulong to ulong
31ret mul xor h v 1099511628211
32end
33fn crow to bool
34if ne ckcnt 5
35ckbad
36end
37ny = cknum 1
38nb = ckhexn 2
39eb = ckhexn 3
40if or gt nb 2048 ne rem nb 8 0
41ckbad
42end
43if ne rem eb 16 0
44ckbad
45end
46if ne ckhexn 4 8
47ckbad
48end
49nq = div nb 8
50q = new ulong 256 0
51for j ulong nq bound 256
52put q j arw 2 j
53end
54o = new ulong 256 0
55r = arop q nq ny o
56if ne r arw 4 0
57ret false
58end
59for j ulong div eb 16 bound 1099511627776
60k = arw 3 mul j 2
61if ge k 256
62ckbad
63end
64if ne get o k arw 3 add mul j 2 1
65ret false
66end
67end
68ret true
69end