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

77 lines · 1404 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note kind 0 router: a=k,b=e,c=t|(mutant<<32); kind 1 combine: a=h,b=top-k,c=mutant.
3note All configuration decisions, allocation shapes, loops, instruction fields and scheduling are Omega.
4fn ph_rl_valid cf view ulong 64 to bool
5if or lt get cf 0 128 gt get cf 0 16384
6ret false
7end
8if ne rem get cf 0 128 0
9ret false
10end
11if or lt get cf 1 32 gt get cf 1 1024
12ret false
13end
14if ne rem get cf 1 32 0
15ret false
16end
17if or lt get cf 2 1 gt get cf 2 16
18ret false
19end
20if ne rem get cf 2 div get cf 1 32 0
21ret false
22end
23if gt mul mul add div get cf 0 4 1 get cf 1 16 2147483647
24ret false
25end
26ret le get cf 3 2
27end
28fn cg_pfhost kind ulong a ulong b ulong c ulong ins edit ulong 8192 meta edit ulong 512 to int
29st = new ulong 16 0
30cf = new ulong 64 0
31put cf 0 a
32put cf 1 b
33if eq kind 0
34put cf 2 and c 4294967295
35put cf 3 shr c 32
36if not ph_rl_valid cf
37ret 1
38end
39put cf 4 div b 32
40put cf 5 div get cf 2 get cf 4
41put cf 6 div a 128
42put cf 7 mul b 16
43if eq get cf 3 2
44put cf 6 sub get cf 6 1
45end
46if eq get cf 6 0
47ret 1
48end
49ph_rl_meta cf meta
50ph_rl_body ins st cf meta
51ret 0
52end
53if eq kind 1
54if or lt a 128 gt a 4096
55ret 1
56end
57if ne rem a 128 0
58ret 1
59end
60if or lt b 4 gt b 16
61ret 1
62end
63if or ne rem b 4 0 gt c 2
64ret 1
65end
66put cf 3 c
67put cf 4 div b 4
68put cf 5 b
69if eq c 2
70put cf 5 sub b 1
71end
72ph_mc_meta cf meta
73ph_mc_body ins st cf meta
74ret 0
75end
76ret 1
77end