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 / graph.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Compose after exact Quant/Composer/Cache/select units, not a second serializer. |
| 3 | note Existing session lock spans validation, selection, cache find+revision+pin. |
| 4 | fn pl_digest h view uchar 32 r view ulong 64 off ulong to bool |
| 5 | for i ulong 4 |
| 6 | v = ulong 0 |
| 7 | for j ulong 8 |
| 8 | v = or v shl ulong get h add mul i 8 j mul j 8 |
| 9 | end |
| 10 | if ne v get r add off i |
| 11 | ret false |
| 12 | end |
| 13 | end |
| 14 | ret true |
| 15 | end |
| 16 | fn pl_bytes row view ulong 64 h edit uchar 32 off ulong to void |
| 17 | for i ulong 4 |
| 18 | v = get row add off i |
| 19 | for j ulong 8 |
| 20 | put h add mul i 8 j uchar and shr v mul j 8 255 |
| 21 | end |
| 22 | end |
| 23 | end |
| 24 | fn pl_realcheck want view uchar 4096 real view uchar 4096 row view ulong 64 to int |
| 25 | if not compose_match want real |
| 26 | ret 69 |
| 27 | end |
| 28 | if ne compose_word real 19 get row 0 |
| 29 | ret 69 |
| 30 | end |
| 31 | if ne compose_word real 3 get row 15 |
| 32 | ret 69 |
| 33 | end |
| 34 | if ne compose_word real 21 get row 13 |
| 35 | ret 69 |
| 36 | end |
| 37 | if ne compose_word real 22 get row 12 |
| 38 | ret 69 |
| 39 | end |
| 40 | if ne compose_word real 25 get row 14 |
| 41 | ret 69 |
| 42 | end |
| 43 | h = new uchar 32 0 |
| 44 | rc = kc_sha real 1152 h |
| 45 | if ne rc 0 |
| 46 | ret 65 |
| 47 | end |
| 48 | if not pl_digest h row 21 |
| 49 | ret 69 |
| 50 | end |
| 51 | pl_bytes row h 57 |
| 52 | if not compose_codeid real h |
| 53 | ret 69 |
| 54 | end |
| 55 | pl_bytes row h 25 |
| 56 | if not compose_launchid real h |
| 57 | ret 69 |
| 58 | end |
| 59 | ret 0 |
| 60 | end |
| 61 | note Internal helper consumes the decision just checked under the same session lock. |
| 62 | fn pl_selected q view ulong 64 a view ulong 1024 p edit ulong 528 o edit ulong 16 lease edit ulong 16 to int |
| 63 | for i ulong 16 |
| 64 | put lease i 0 |
| 65 | end |
| 66 | req = new ulong 16 0 |
| 67 | put req 0 get q 3 |
| 68 | put req 1 get q 4 |
| 69 | put req 2 get a add mul get o 1 64 16 |
| 70 | for i ulong 4 |
| 71 | put req add 3 i get o add 4 i |
| 72 | end |
| 73 | hit = kc_find p req |
| 74 | if le hit 0 |
| 75 | for i ulong 16 |
| 76 | put o i 0 |
| 77 | end |
| 78 | ret 75 |
| 79 | end |
| 80 | slot = ulong sub hit 1 |
| 81 | rev = kc_revision p slot get q 3 |
| 82 | if eq rev 0 |
| 83 | for i ulong 16 |
| 84 | put o i 0 |
| 85 | end |
| 86 | ret 75 |
| 87 | end |
| 88 | rc = kc_pin p slot rev get q 3 |
| 89 | if ne rc 0 |
| 90 | for i ulong 16 |
| 91 | put o i 0 |
| 92 | end |
| 93 | ret 75 |
| 94 | end |
| 95 | put lease 0 1 |
| 96 | put lease 1 slot |
| 97 | put lease 2 rev |
| 98 | put lease 3 get q 3 |
| 99 | for i ulong 4 |
| 100 | put lease add 4 i get o add 4 i |
| 101 | put lease add 8 i get o add 8 i |
| 102 | end |
| 103 | put lease 12 get q 4 |
| 104 | put lease 13 get q 5 |
| 105 | put lease 14 get q 6 |
| 106 | ret 0 |
| 107 | end |
| 108 | fn pl_pin q view ulong 64 a view ulong 1024 p edit ulong 528 o edit ulong 16 lease edit ulong 16 to int |
| 109 | for i ulong 16 |
| 110 | put lease i 0 |
| 111 | end |
| 112 | rc = pl_select q a o |
| 113 | if ne rc 0 |
| 114 | ret rc |
| 115 | end |
| 116 | ret pl_selected q a p o lease |
| 117 | end |