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 / apirest / pack.om

91 lines · 1395 bytes Raw Blame History
1om2
2note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3note Composed with apish_pack.om, preserving its scalar scale and NaN rules.
4fn ar_nan x view uchar * y edit ulong 2 to ulong
5n = ulong 0
6base = ulong 0
7for chunks ulong 281474976710656
8if ge base len x
9break
10end
11for j ulong 65536
12i = add base j
13if ge i len x
14break
15end
16if ne isnanb uint get x i 0
17if eq n 0
18put y 0 i
19end
20n = add n 1
21end
22end
23base = add base 65536
24end
25put y 1 n
26ret 0
27end
28fn ar_scale mut ulong x view ushort * y edit f32 * to ulong
29if ne len x len y
30ret 1
31end
32base = ulong 0
33for chunks ulong 281474976710656
34if ge base len x
35break
36end
37for j ulong 65536
38i = add base j
39if ge i len x
40break
41end
42v = scalef uint get x i uint mut
43if ne shr v 32 0
44ret 1
45end
46put y i bitcast f32 uint v
47end
48base = add base 65536
49end
50ret 0
51end
52fn ar_fold x view f32 * y edit f32 * to ulong
53if ne len x len y
54ret 1
55end
56base = ulong 0
57for chunks ulong 281474976710656
58if ge base len x
59break
60end
61for j ulong 65536
62i = add base j
63if ge i len x
64break
65end
66put y i bitcast f32 xfold bitcast uint get x i 64
67end
68base = add base 65536
69end
70ret 0
71end
72fn ar_foldh x view ushort * y edit f32 * to ulong
73if ne len x len y
74ret 1
75end
76base = ulong 0
77for chunks ulong 281474976710656
78if ge base len x
79break
80end
81for j ulong 65536
82i = add base j
83if ge i len x
84break
85end
86put y i bitcast f32 xfold shl uint get x i 16 64
87end
88base = add base 65536
89end
90ret 0
91end