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 / artifact_policy.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Pure QMD prefix policy from CUDApp b774723, little-endian packed words. |
| 3 | note Byte views preserve uint32 alignment without copying the QMD. |
| 4 | fn art_word q view uchar 256 i ulong to ulong |
| 5 | j = mul i 4 |
| 6 | lo = or ulong get q j shl ulong get q add j 1 8 |
| 7 | hi = or ulong get q add j 2 shl ulong get q add j 3 8 |
| 8 | ret or lo shl hi 16 |
| 9 | end |
| 10 | fn art_template q0 view uchar 256 q1 view uchar 256 to ulong |
| 11 | if ne art_word q0 12 0 |
| 12 | ret 0 |
| 13 | end |
| 14 | if or ne art_word q1 12 0 or ne art_word q1 15 0 ne art_word q1 16 0 |
| 15 | ret 0 |
| 16 | end |
| 17 | if or ne art_word q1 32 0 ne and art_word q1 33 xor 4294967295 shl ulong 10 21 0 |
| 18 | ret 0 |
| 19 | end |
| 20 | if or ne art_word q1 42 0 ne and art_word q1 43 524287 0 |
| 21 | ret 0 |
| 22 | end |
| 23 | if or ne art_word q1 44 0 ne and art_word q1 45 524287 0 |
| 24 | ret 0 |
| 25 | end |
| 26 | if or ne art_word q1 52 12 ne and art_word q1 53 524287 0 |
| 27 | ret 0 |
| 28 | end |
| 29 | if or ne art_word q1 56 0 or ne and art_word q1 57 524287 0 ne art_word q1 59 0 |
| 30 | ret 0 |
| 31 | end |
| 32 | ret 1 |
| 33 | end |
| 34 | fn art_launch q1 view uchar 256 s view ulong 7 to ulong |
| 35 | wg = get s 6 |
| 36 | if lt wg 16 |
| 37 | wg = 16 |
| 38 | end |
| 39 | ws = ulong 8 |
| 40 | if ne get s 5 0 |
| 41 | ws = div and add get s 5 127 4294967295 128 |
| 42 | end |
| 43 | for i ulong 5 |
| 44 | if eq get s i 0 |
| 45 | ret 0 |
| 46 | end |
| 47 | end |
| 48 | if or gt get s 2 65535 gt get s 3 65535 |
| 49 | ret 0 |
| 50 | end |
| 51 | if or gt get s 4 255 or gt wg 511 gt ws 2047 |
| 52 | ret 0 |
| 53 | end |
| 54 | if ne art_word q1 34 or get s 2 shl get s 3 16 |
| 55 | ret 0 |
| 56 | end |
| 57 | if ne and art_word q1 35 255 get s 4 |
| 58 | ret 0 |
| 59 | end |
| 60 | if ne and shr art_word q1 35 8 511 wg |
| 61 | ret 0 |
| 62 | end |
| 63 | if ne and art_word q1 36 2047 ws |
| 64 | ret 0 |
| 65 | end |
| 66 | if ne art_word q1 39 get s 0 |
| 67 | ret 0 |
| 68 | end |
| 69 | if ne art_word q1 40 get s 1 |
| 70 | ret 0 |
| 71 | end |
| 72 | if ne art_word q1 41 1 |
| 73 | ret 0 |
| 74 | end |
| 75 | ret 1 |
| 76 | end |
| 77 | fn artifact_policy mode ulong q0 view uchar 256 q1 view uchar 256 s view ulong 7 to ulong |
| 78 | if eq mode 0 |
| 79 | ret art_template q0 q1 |
| 80 | end |
| 81 | if eq mode 1 |
| 82 | ret art_launch q1 s |
| 83 | end |
| 84 | ret 0 |
| 85 | end |