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_policy.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Pure shape refusals at CUDApp b774723. Result 0 accepted, 1 bad, 2 too large. |
| 3 | note Modes 0 matmul; 1 rmsnorm; 2 rope; 3 attention heads; 4 bounded subrange; |
| 4 | note 5 bf16 weight shape; 6 router expert shape. Pointer admission stays in C. |
| 5 | fn api_policy mode ulong a ulong b ulong c ulong to ulong |
| 6 | if eq mode 0 |
| 7 | if or eq a 0 or eq b 0 eq c 0 |
| 8 | ret 1 |
| 9 | end |
| 10 | if or gt a 8192 or gt b 16384 gt c 262144 |
| 11 | ret 2 |
| 12 | end |
| 13 | ret 0 |
| 14 | end |
| 15 | if eq mode 1 |
| 16 | if or eq a 0 or eq b 0 ne rem b 128 0 |
| 17 | ret 1 |
| 18 | end |
| 19 | if gt b 16384 |
| 20 | ret 2 |
| 21 | end |
| 22 | ret 0 |
| 23 | end |
| 24 | if eq mode 2 |
| 25 | if or eq a 0 or lt b 2 ne and b 1 0 |
| 26 | ret 1 |
| 27 | end |
| 28 | if gt b 2048 |
| 29 | ret 2 |
| 30 | end |
| 31 | ret 0 |
| 32 | end |
| 33 | if eq mode 3 |
| 34 | if or eq a 0 or eq b 0 eq c 0 |
| 35 | ret 1 |
| 36 | end |
| 37 | if or gt c 256 gt a 1024 |
| 38 | ret 2 |
| 39 | end |
| 40 | if ne rem a b 0 |
| 41 | ret 1 |
| 42 | end |
| 43 | ret 0 |
| 44 | end |
| 45 | if eq mode 4 |
| 46 | if gt a c |
| 47 | ret 1 |
| 48 | end |
| 49 | if gt b sub c a |
| 50 | ret 1 |
| 51 | end |
| 52 | ret 0 |
| 53 | end |
| 54 | if eq mode 5 |
| 55 | if or eq a 0 or eq b 0 ne rem b 256 0 |
| 56 | ret 1 |
| 57 | end |
| 58 | if gt b c |
| 59 | ret 2 |
| 60 | end |
| 61 | ret 0 |
| 62 | end |
| 63 | if eq mode 6 |
| 64 | if or and ne a 128 ne a 256 gt b 1 |
| 65 | ret 1 |
| 66 | end |
| 67 | ret 0 |
| 68 | end |
| 69 | ret 1 |
| 70 | end |