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 / components / cm_features.om

105 lines · 1962 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Transport op[0], M[1], N[2], state[3], cache[4], core[5], pressure[6].
3note Basis output[16:24]; initialized statistics output[16:64].
4fn cm_features mode ulong words edit ulong 64 to ulong
5if eq mode 0
6if ge get words 0 1
7ret 4294967295
8end
9core = get words 5
10if ge core 3
11core = ulong 2
12end
13pr = get words 6
14if ge pr 3
15pr = ulong 2
16end
17ret add mul core 3 pr
18end
19if eq mode 5
20pr = get words 6
21if ge pr 3
22pr = ulong 2
23end
24ret pr
25end
26if eq mode 3
27n = get words 0
28if gt n 8
29n = ulong 8
30end
31put words 0 ulong 4607182418800017408
32for i ulong 48
33put words add 16 i ulong 0
34end
35idx = ulong 0
36for i ulong 8
37for j ulong 8
38if ge j i
39if eq i j
40put words add 16 idx ulong 4562254508917369340
41end
42idx = add idx 1
43end
44end
45end
46ret n
47end
48if eq mode 4
49put words 16 ulong 4590429028186199163
50put words 17 ulong 0
51put words 18 ulong 0
52put words 19 ulong 4587366580439587226
53put words 20 ulong 500000000
54ret 0
55end
56if ge mode 6
57failures = ulong 0
58for i ulong 9
59failures = add failures get words i
60end
61if eq mode 6
62ret failures
63end
64trials = ulong 0
65for i ulong 9
66trials = add trials get words add 9 i
67end
68ret bitcast ulong div add f64 failures bitcast f64 ulong 4587366580439587226 add f64 trials f64 1.0
69end
70m = get words 1
71n = get words 2
72if eq m 0
73m = ulong 1
74end
75if eq n 0
76n = ulong 1
77end
78lm = cm_log f64 m true
79ln = cm_log f64 n true
80ov = f64 0.0
81if and ne get words 4 0 gt get words 3 get words 4
82ratio = div f64 get words 3 f64 get words 4
83ov = cm_log ratio true
84end
85for i ulong 8
86put words add 16 i ulong 0
87end
88put words 16 ulong 4607182418800017408
89if eq mode 2
90put words 17 bitcast ulong ov
91ret 0
92end
93put words 17 bitcast ulong lm
94put words 18 bitcast ulong ln
95put words 19 bitcast ulong mul lm ln
96put words 20 bitcast ulong mul ln ln
97if le get words 2 3
98put words 21 ulong 4607182418800017408
99end
100if ne rem get words 2 4 0
101put words 22 ulong 4607182418800017408
102end
103put words 23 bitcast ulong ov
104ret 0
105end