interplane.Get Omega
Read in your language

CUDApp

CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.

Brought by drakestapleton

branch main Branches Tags History

CUDApp / om / codegen / fixture_verify.om

99 lines · 1496 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Scalar ABI: a/b and c/d are memcpy-packed pairs of 32-bit golden words.
3fn fv_bool b bool to ulong
4if b
5ret 1
6end
7ret 0
8end
9
10fn fv_words a ulong b ulong c ulong d ulong mask ulong to ulong
11if ne and mask 1 0
12if ne and a 4294967295 and c 4294967295
13ret 0
14end
15end
16if ne and mask 2 0
17if ne shr a 32 shr c 32
18ret 0
19end
20end
21if ne and mask 4 0
22if ne and b 4294967295 and d 4294967295
23ret 0
24end
25end
26if ne and mask 8 0
27if ne shr b 32 shr d 32
28ret 0
29end
30end
31ret 1
32end
33
34note Variable shifts are decomposed into proven literal shifts for the freest profile.
35fn fv_shl val ulong cnt ulong to ulong
36x = val
37if ne and cnt 1 0
38x = shl x 1
39end
40if ne and cnt 2 0
41x = shl x 2
42end
43if ne and cnt 4 0
44x = shl x 4
45end
46if ne and cnt 8 0
47x = shl x 8
48end
49if ne and cnt 16 0
50x = shl x 16
51end
52if ne and cnt 32 0
53x = shl x 32
54end
55ret x
56end
57
58fn fv_run op ulong a ulong b ulong c ulong d ulong e ulong to ulong
59if eq op 0
60ret fv_words a b c d e
61end
62if eq op 7
63mask = ulong 7
64if ne shr d 32 0
65mask = 15
66end
67ret fv_words a b c d mask
68end
69if eq op 1
70ret and sub ulong 0 add mul a 2 b 4294967295
71end
72if eq op 2
73if eq b 0
74ret fv_bool ne a 0
75end
76ret fv_bool eq a 0
77end
78if eq op 3
79if eq e 0
80ret fv_bool eq and xor b d 4294967295 262144
81end
82ret fv_bool and eq a c eq shr b 32 shr d 32
83end
84if eq op 4
85ret fv_bool and eq a or c 288230376151711744 eq b d
86end
87if eq op 5
88x = fv_shl b c
89y = fv_shl d e
90ret or or a x y
91end
92if eq op 6
93if eq a b
94ret c
95end
96ret d
97end
98ret 0
99end