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 / api_da_plan.om

70 lines · 1111 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2fn api_da_plan mode ulong a edit ulong 16 to ulong
3if eq mode 0
4layers = get a 0
5pos = get a 1
6if or eq layers 0 gt layers 64
7ret 1
8end
9if or eq pos 0 gt pos 131072
10ret 1
11end
12if or ne rem pos 256 0 not gt bitcast f64 get a 2 f64 0
13ret 1
14end
15put a 8 div pos 256
16put a 9 add mul mul 4 pos 256 add mul mul ulong 4 8 256 64
17put a 10 mul pos 512
18put a 11 mul mul mul layers 2 128 4
19put a 12 mul mul mul 4 div pos 256 1040 4
20ret 0
21end
22if eq mode 1
23if or gt get a 0 get a 2 gt get a 1 sub get a 2 get a 0
24ret 1
25end
26ret 0
27end
28if eq mode 2
29pos = get a 0
30per = get a 1
31if eq per 0
32per = 256
33end
34if ne rem per 256 0
35ret 1
36end
37splits = div add pos per per
38if gt splits get a 2
39ret 2
40end
41depth = get a 3
42if eq depth 0
43depth = 4
44end
45put a 8 per
46put a 9 splits
47put a 10 depth
48put a 11 mul mul mul ulong 2 4 add pos 1 256
49ret 0
50end
51if eq mode 3
52if or ge get a 0 get a 1 ge get a 2 4
53ret 1
54end
55if or eq get a 4 0 gt get a 3 get a 5
56ret 1
57end
58if gt get a 4 sub get a 5 get a 3
59ret 1
60end
61ret 0
62end
63if eq mode 4
64if gt mul get a 0 256 65536
65ret 2
66end
67ret 0
68end
69ret 1
70end