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 / graph / hello.om

55 lines · 1272 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Little-endian binary32 buffers. Byte views match the pinned bridge ABI.
3fn hload a view uchar 4194304 i ulong to uint
4o = mul i 4
5v = ulong get a o
6v = or v shl ulong get a add o 1 8
7v = or v shl ulong get a add o 2 16
8v = or v shl ulong get a add o 3 24
9ret uint v
10end
11fn hstore a edit uchar 4194304 i ulong v uint to void
12o = mul i 4
13put a o uchar and v 255
14put a add o 1 uchar and shr v 8 255
15put a add o 2 uchar and shr v 16 255
16put a add o 3 uchar shr v 24
17end
18fn hinit aa edit uchar 4194304 bb edit uchar 4194304 cc edit uchar 4194304 to ulong
19for i ulong 1048576
20x = mul f32 i 0.25f32
21y = div 1.0f32 f32 add 1 rem i 7
22hstore aa i bitcast uint x
23hstore bb i bitcast uint y
24hstore cc i uint 4290838510
25end
26ret 1
27end
28fn hello mode ulong aa edit uchar 4194304 bb edit uchar 4194304 cc edit uchar 4194304 out edit ulong 4 to ulong
29if gt mode 1
30ret 0
31end
32for j ulong 4
33put out j 0
34end
35if eq mode 0
36ret hinit aa bb cc
37end
38for i ulong 1048576
39x = bitcast f32 hload aa i
40y = bitcast f32 hload bb i
41want = bitcast uint add x y
42got = hload cc i
43if eq got 4290838510
44put out 1 add get out 1 1
45end
46if ne want got
47if eq get out 0 0
48put out 2 i
49put out 3 ulong want
50end
51put out 0 add get out 0 1
52end
53end
54ret 1
55end