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

75 lines · 1494 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Native-ABI blob header pairs; words[63] is the host's big-endian flag.
3note WolframLanguageEvaluator: {FromDigits["4d43474f",16],FromDigits["4d43474f",16]+2^32,FromDigits["4d43474f",16]2^32+1,8 2^32,9+8 2^32,9 2^32+8,3 2^32}
4note -> {1296254799,5591222095,5567371968988053505,34359738368,34359738377,38654705672,12884901888}.
5fn cm_blob mode ulong words edit ulong 64 to ulong
6if eq mode 3
7if ge get words 0 get words 1
8ret 1
9end
10ret 0
11end
12if eq mode 4
13if eq get words 0 get words 1
14ret 1
15end
16ret 0
17end
18if eq mode 2
19scale = bitcast f64 get words 0
20if and ge scale f64 1 lt scale f64 1000000
21ret 1
22end
23ret 0
24end
25big = ne get words 63 0
26if eq mode 0
27if big
28put words 16 ulong 5567371968988053505
29put words 17 or shl get words 0 32 8
30put words 18 ulong 38654705672
31put words 19 ulong 12884901888
32else
33put words 16 ulong 5591222095
34put words 17 or get words 0 ulong 34359738368
35put words 18 ulong 34359738377
36put words 19 ulong 3
37end
38put words 20 get words 1
39ret 1
40end
41n = ulong 0
42if big
43if ne get words 16 5567371968988053505
44ret 0
45end
46if ne and get words 17 4294967295 8
47ret 0
48end
49if ne get words 18 38654705672
50ret 0
51end
52if ne shr get words 19 32 3
53ret 0
54end
55n = shr get words 17 32
56else
57if ne get words 16 5591222095
58ret 0
59end
60if ne shr get words 17 32 8
61ret 0
62end
63if ne get words 18 34359738377
64ret 0
65end
66if ne and get words 19 4294967295 3
67ret 0
68end
69n = and get words 17 4294967295
70end
71if or eq n 0 gt n 8
72ret 0
73end
74ret n
75end