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

61 lines · 1442 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note No value first defined in a closed loop may be read afterward before its next nonuniform definition.
3fn invread ins view ulong 8192 b ulong v ulong to bool
4ret or eq get ins add b 2 v or eq get ins add b 3 v eq get ins add b 4 v
5end
6fn invwrite ins view ulong 8192 b ulong v ulong to bool
7ret and eq get ins add b 1 v eq and get ins add b 7 1 0
8end
9fn invreg ins view ulong 8192 v ulong e ulong n ulong to bool
10for i ulong n
11if le i e
12continue
13end
14b = mul i 8
15if invread ins b v
16ret false
17end
18if invwrite ins b v
19ret true
20end
21end
22ret true
23end
24fn iv_u2l x ulong to long
25if lt x 9223372036854775808
26ret long x
27end
28ret sub long -1 long xor x 18446744073709551615
29end
30fn iv_i32 x ulong to long
31x = and x 4294967295
32if lt x 2147483648
33ret long x
34end
35ret sub long -1 long xor x 4294967295
36end
37fn invbound meta view ulong 512 l ulong to ulong
38ret or and get meta add 16 mul l 2 4294967295 shl get meta add 17 mul l 2 32
39end
40fn invloop ins view ulong 8192 life view ulong 512 a ulong b ulong to bool
41s = iv_i32 b
42e = shr b 32
43for v ulong shr a 32
44fd = iv_u2l get life mul v 2
45if and ge fd s le fd long e
46if not invreg ins v e and a 4294967295
47ret false
48end
49end
50end
51ret true
52end
53fn cg_invar ins view ulong 8192 meta view ulong 512 life view ulong 512 to ulong
54a = or get meta 0 shl get meta 1 32
55for l ulong get meta 5
56if not invloop ins life a invbound meta l
57ret 6
58end
59end
60ret 0
61end