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

87 lines · 1419 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Spec order is the public OmegaTgemmSpec field order, widened without truncation.
3fn tg_spec_ok s view ulong 10 to ulong
4if or lt get s 0 128 gt get s 0 65536
5ret 0
6end
7if ne rem get s 0 128 0
8ret 0
9end
10if and and ne get s 2 2 ne get s 2 4 ne get s 2 8
11ret 0
12end
13if ne get s 3 2
14ret 0
15end
16if and ne get s 4 8 ne get s 4 16
17ret 0
18end
19if ne get s 5 32
20ret 0
21end
22if and ne get s 6 1 ne get s 6 2
23ret 0
24end
25if or ne get s 7 0 ne get s 8 0
26ret 0
27end
28span = mul mul get s 4 8 get s 3
29if or eq get s 1 0 ge get s 1 131072
30ret 0
31end
32if ne rem get s 1 span 0
33ret 0
34end
35t = mul 32 get s 4
36if true
37pieces = mul mul 16 get s 2 div get s 5 4
38if ne rem pieces t 0
39ret 0
40end
41rj = div t div get s 5 4
42nj = div pieces t
43if ne rem rj 16 0
44ret 0
45end
46off = mul mul mul sub nj 1 rj get s 0 2
47extra = sub div 128 get s 5 1
48extra = mul extra get s 5
49extra = mul extra 2
50off = add off extra
51if ge off 8388608
52ret 0
53end
54end
55shared = mul mul mul mul ulong 2 16 get s 2 get s 5 2
56if gt shared 16384
57ret 0
58end
59if gt mul 32 span shared
60ret 0
61end
62if ne rem mul 8 span t 0
63ret 0
64end
65if gt get s 9 5
66ret 0
67end
68ret 1
69end
70fn cg_tgemm_spec s view ulong 10 kind ulong to ulong
71if eq tg_spec_ok s 0
72ret 0
73end
74if eq kind 0
75ret 1
76end
77if eq kind 1
78ret mul mul mul mul ulong 2 16 get s 2 get s 5 2
79end
80if eq kind 2
81ret mul mul get s 4 8 get s 3
82end
83if eq kind 3
84ret mul 16 get s 2
85end
86ret 0
87end