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

114 lines · 1916 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Tensor-core instruction records: omega_gpu_om_ir.h (22ebf8f).
3note m[7] holds deferred scoreboards; m[8] loop start, m[16..17] closed loop.
4const NR ulong 18446744073709551615
5fn tc_v m edit ulong 512 k ulong to ulong
6v = get m 1
7if ge v 256
8put m 4 1
9ret NR
10end
11put m add 64 v k
12put m 1 add v 1
13ret v
14end
15fn tc_i x edit ulong 16 op ulong to void
16for q ulong 16
17put x q 0
18end
19put x 0 op
20for q ulong 5
21put x add q 1 NR
22end
23end
24fn tc_cw st ulong wb ulong rb ulong wt ulong to ulong
25ret or or shl st 9 shl wb 14 or shl rb 17 shl wt 20
26end
27fn tc_pack b edit ulong 8192 m edit ulong 512 x view ulong 16 to void
28n = get m 0
29if ge n 1024
30put m 4 2
31ret
32end
33p = mul n 8
34for q ulong 6
35put b add p q get x q
36end
37put b add p 6 or and get x 6 4294967295 shl get x 7 32
38fl = or get x 8 shl get x 9 1
39fl = or fl shl get x 10 2
40fl = or fl shl get x 11 16
41fl = or fl shl get x 12 24
42fl = or fl shl get x 13 32
43fl = or fl shl get x 14 40
44put b add p 7 or fl shl get x 15 48
45put m 0 add n 1
46end
47fn tc_emit b edit ulong 8192 m edit ulong 512 x edit ulong 16 k ulong to void
48wt = get m 3
49st = ulong 6
50wb = ulong 7
51rb = ulong 7
52pn = ulong 0
53yld = ulong 0
54if eq k 1
55st = 14
56end
57if or eq k 2 eq k 3
58st = 4
59wb = 0
60rb = 1
61pn = or get m 3 3
62yld = 8192
63if eq k 2
64pn = 3
65else
66wt = and wt 2
67end
68end
69if eq k 4
70st = 4
71wb = 2
72pn = 4
73yld = 8192
74end
75if eq k 5
76st = 4
77rb = 1
78pn = 2
79yld = 8192
80end
81if or eq k 7 eq k 8
82st = 5
83if ne get x 9 0
84pn = wt
85end
86end
87if eq k 9
88st = 1
89yld = 8192
90end
91if eq k 10
92st = 5
93yld = 8192
94end
95if eq k 11
96st = get x 7
97end
98if eq k 12
99st = 4
100wb = get x 7
101rb = 1
102wt = and wt 2
103pn = or get m 3 2
104put m 7 or get m 7 shl ulong 1 wb
105yld = 8192
106end
107put x 7 or tc_cw st wb rb wt yld
108put m 3 pn
109tc_pack b m x
110end
111fn tc_patch b edit ulong 8192 at ulong target ulong to void
112p = add mul at 8 6
113put b p or and get b p 18446744069414584320 and sub target at 4294967295
114end