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

59 lines · 1268 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note q/saved/count/ps/mean/sd/dof/known/borrowed/selected[0:10]; result[10].
3note Mode 4 transports work/explore counters and deltas in [0:4].
4fn cm_calibration mode ulong words edit ulong 32 to ulong
5if eq mode 4
6put words 0 add get words 0 get words 2
7put words 1 add get words 1 get words 3
8ret 0
9end
10q = bitcast f64 get words 0
11if eq mode 0
12if eq get words 2 0
13ret 0
14end
15if not and gt q f64 0.0 lt q f64 1.0
16ret 0
17end
18put words 10 ulong 4607182418800017408
19ret 1
20end
21if eq mode 1
22if not or ne get words 7 0 ne get words 8 0
23ret 0
24end
25if eq get words 3 0
26ret 0
27end
28sd = bitcast f64 get words 5
29if not gt sd f64 0.0
30ret 0
31end
32value = sub cm_log f64 get words 3 true bitcast f64 get words 4
33value = bitcast f64 and bitcast ulong value 9223372036854775807
34value = div value sd
35t = bitcast f64 cm_quantile get words 0 get words 6
36put words 10 bitcast ulong div value t
37ret 1
38end
39if eq mode 2
40k = get words 2
41if lt k 10
42put words 10 get words 1
43ret 0
44end
45rounded = bitcast f64 cm_ceil bitcast ulong mul q f64 k
46idx = sub ulong rounded 1
47if ge idx k
48idx = sub k 1
49end
50put words 10 idx
51ret 1
52end
53scale = bitcast f64 get words 9
54if lt scale f64 1.0
55scale = f64 1.0
56end
57put words 10 bitcast ulong scale
58ret 1
59end