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

52 lines · 1235 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0
2note gpu/nvidia/checks/numhost.om: the Omega port of CUDApp tests/ampere_numeric_host_test.c. Composed after
3note the numeric_reduce unit (gpu/nvidia/om/numeric/numeric.om, tile.om, rest.om, reduce.om) and
4note gpu/nvidia/checks/lib.om; run with gpu/nvidia/checks/numhost.tsv. Numbers are lowercase hex FP32 bits.
5note o OM A B C OUT numeric_ref OM A B C must be OUT (OM: the dispatcher's op code, decimal)
6note r OP N X1 .. XN OUT (OP and N decimal) numeric_reduce OP over the N values (one padded stage, N at most 32) must be OUT
7text t_name "NUMHOST"
8fn cname to void
9for i ulong len t_name bound 64
10ckoc ulong get t_name i
11end
12end
13fn nhx i ulong to ulong
14n = cklen i
15if or eq n 0 gt n 8
16ckbad
17end
18v = ulong 0
19for j ulong n bound 8
20v = or shl v 4 cknib ckch i j
21end
22ret v
23end
24fn nhred op ulong n ulong to bool
25t = new ulong 32 0
26for i ulong n bound 32
27put t i nhx add 3 i
28end
29r = numeric_reduce op n view t 0 0
30ret eq r nhx add 3 n
31end
32fn crow to bool
33k = ckch 0 0
34nc = ckcnt
35if eq k 111
36if ne nc 6
37ckbad
38end
39ret eq numeric_ref cknum 1 nhx 2 nhx 3 nhx 4 nhx 5
40end
41if ne k 114
42ckbad
43end
44n = cknum 2
45if or eq n 0 gt n 32
46ckbad
47end
48if ne nc add n 4
49ckbad
50end
51ret nhred cknum 1 n
52end