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 / tests / components / component-unit.om

117 lines · 1955 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Concatenate allocator,effect,check,project,then this host-only unit caller.
3fn ut_ir ins edit ulong 8192 meta edit ulong 2048 n ulong to int
4old = get ins 0
5put ins 0 999
6if eq bc_ircheck ins n meta 0
7ret 5
8end
9put ins 0 old
10for i ulong n
11base = mul i 8
12op = get ins base
13if eq op 56
14slot = add base 6
15old = get ins slot
16put ins slot and old 4294967295
17if eq bc_ircheck ins n meta 0
18ret 6
19end
20put ins slot old
21reg = get ins add base 1
22width = get meta reg
23put meta reg 1
24if eq bc_ircheck ins n meta 0
25ret 7
26end
27put meta reg width
28end
29if eq op 54
30slot = add base 6
31old = get ins slot
32put ins slot or shl shr old 32 32 2147483647
33if eq bc_ircheck ins n meta 0
34ret 8
35end
36put ins slot old
37end
38end
39ret 0
40end
41fn ut_mma to int
42ins = new ulong 8192 0
43meta = new ulong 2048 0
44s = new ulong 64 0
45args = new ulong 4 0
46bc_node s 1 0 1 BCNONE BCNONE
47bc_emit ins s 13
48if eq get s 3 0
49ret 11
50end
51for j ulong 64
52put s j 0
53end
54for j ulong 4
55put args j j
56put meta j 4
57end
58put meta 2 2
59if ne bc_mma ins s meta args 0
60ret 12
61end
62if ne get s 0 3
63ret 13
64end
65if ne shr get ins 6 32 bc_control 8 7 7 0 false
66ret 14
67end
68if ne shr get ins 14 32 bc_control 15 7 7 0 false
69ret 15
70end
71if ne shr get ins 22 32 bc_control 14 7 7 0 false
72ret 16
73end
74put meta 2 1
75if eq bc_mma ins s meta args 0
76ret 17
77end
78ret 0
79end
80fn main to int
81spec = new ulong 8 0
82ins = new ulong 8192 0
83meta = new ulong 2048 0
84phys = new ulong 288 0
85st = new ulong 4 0
86rs = new ulong 4 0
87put spec 0 256
88put spec 1 8
89put spec 2 1
90put spec 3 4
91if ne bc_project spec ins meta st 0
92ret 1
93end
94if ne bc_ircheck ins get st 0 meta 0
95ret 2
96end
97if ne bc_regalloc ins get st 0 meta phys rs 128 0
98ret 3
99end
100if eq bc_regalloc ins get st 0 meta phys rs 3 0
101ret 4
102end
103rc = ut_ir ins meta get st 0
104if ne rc 0
105ret rc
106end
107put spec 4 2
108if eq bc_project spec ins meta st 0
109ret 9
110end
111put spec 4 0
112put spec 5 1
113if eq bc_project spec ins meta st 0
114ret 10
115end
116ret ut_mma
117end