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 / pipeline / binding.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Consume canonical launch; never reconstruct it from incumbent shape knobs. |
| 3 | note call0kind1gemv2gemm,1M,2N,3K,4groups/segments,5argumentwords,6rowmap,7GEMVinputrows. |
| 4 | note call8tensorallocationepoch,9currentsessionepoch,10immutableowner generation,11reservedzero. |
| 5 | note out0..27 exact launch fields;28RG,29gridX*warps are private derived ABI metadata. |
| 6 | note out is NOT canonical/hashable launch wire. This binding is NOT qualification. |
| 7 | fn binding_owner call view ulong 12 to bool |
| 8 | if ne get call 8 get call 9 |
| 9 | ret false |
| 10 | end |
| 11 | if eq get call 10 0 |
| 12 | ret false |
| 13 | end |
| 14 | ret eq get call 11 0 |
| 15 | end |
| 16 | fn native_binding real view uchar 4096 launch view uchar 4096 call view ulong 12 out edit ulong 32 to long |
| 17 | for i ulong 32 |
| 18 | put out i 0 |
| 19 | end |
| 20 | if not binding_owner call |
| 21 | ret 69 |
| 22 | end |
| 23 | if ne compose_launchread real launch 256 0 |
| 24 | ret 69 |
| 25 | end |
| 26 | if ne compose_word real 4 get call 1 |
| 27 | ret 69 |
| 28 | end |
| 29 | if ne compose_word real 5 get call 2 |
| 30 | ret 69 |
| 31 | end |
| 32 | if ne compose_word real 6 get call 3 |
| 33 | ret 69 |
| 34 | end |
| 35 | if ne compose_word launch 12 get call 5 |
| 36 | ret 69 |
| 37 | end |
| 38 | if ne compose_word launch 11 896 |
| 39 | ret 69 |
| 40 | end |
| 41 | if ne compose_word launch 3 1 |
| 42 | ret 69 |
| 43 | end |
| 44 | if ne compose_word launch 5 1 |
| 45 | ret 69 |
| 46 | end |
| 47 | if ne compose_word launch 6 1 |
| 48 | ret 69 |
| 49 | end |
| 50 | gpr = compose_word launch 8 |
| 51 | if or lt gpr 64 ne rem gpr 8 0 |
| 52 | ret 69 |
| 53 | end |
| 54 | shared = compose_word launch 7 |
| 55 | if or lt shared 1024 ne rem shared 128 0 |
| 56 | ret 69 |
| 57 | end |
| 58 | if ne compose_word launch 10 1 |
| 59 | ret 69 |
| 60 | end |
| 61 | if eq get call 0 1 |
| 62 | if and ne get call 7 1 ne get call 7 get call 4 |
| 63 | ret 69 |
| 64 | end |
| 65 | if or ne get call 1 1 ne get call 6 0 |
| 66 | ret 69 |
| 67 | end |
| 68 | if ne compose_word launch 2 get call 4 |
| 69 | ret 69 |
| 70 | end |
| 71 | if gt compose_word real 19 2 |
| 72 | ret 69 |
| 73 | end |
| 74 | rows = compose_word real 15 |
| 75 | if eq rows 0 |
| 76 | ret 69 |
| 77 | end |
| 78 | if or ne get call 5 10 ne rem get call 2 rows 0 |
| 79 | ret 69 |
| 80 | end |
| 81 | else |
| 82 | if eq get call 0 2 |
| 83 | if ne get call 7 0 |
| 84 | ret 65 |
| 85 | end |
| 86 | if ne compose_word real 19 3 |
| 87 | ret 69 |
| 88 | end |
| 89 | if ne compose_word launch 2 get call 4 |
| 90 | ret 69 |
| 91 | end |
| 92 | else |
| 93 | ret 69 |
| 94 | end |
| 95 | end |
| 96 | for i ulong 32 |
| 97 | put out i compose_word launch i |
| 98 | end |
| 99 | note Derived ABI scalars, not serialized launch fields: RG and gridX*warps. |
| 100 | put out 28 div get call 2 compose_word real 15 |
| 101 | put out 29 mul compose_word launch 1 compose_word real 17 |
| 102 | ret 0 |
| 103 | end |