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