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 / cm_blob.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Native-ABI blob header pairs; words[63] is the host's big-endian flag. |
| 3 | note WolframLanguageEvaluator: {FromDigits["4d43474f",16],FromDigits["4d43474f",16]+2^32,FromDigits["4d43474f",16]2^32+1,8 2^32,9+8 2^32,9 2^32+8,3 2^32} |
| 4 | note -> {1296254799,5591222095,5567371968988053505,34359738368,34359738377,38654705672,12884901888}. |
| 5 | fn cm_blob mode ulong words edit ulong 64 to ulong |
| 6 | if eq mode 3 |
| 7 | if ge get words 0 get words 1 |
| 8 | ret 1 |
| 9 | end |
| 10 | ret 0 |
| 11 | end |
| 12 | if eq mode 4 |
| 13 | if eq get words 0 get words 1 |
| 14 | ret 1 |
| 15 | end |
| 16 | ret 0 |
| 17 | end |
| 18 | if eq mode 2 |
| 19 | scale = bitcast f64 get words 0 |
| 20 | if and ge scale f64 1 lt scale f64 1000000 |
| 21 | ret 1 |
| 22 | end |
| 23 | ret 0 |
| 24 | end |
| 25 | big = ne get words 63 0 |
| 26 | if eq mode 0 |
| 27 | if big |
| 28 | put words 16 ulong 5567371968988053505 |
| 29 | put words 17 or shl get words 0 32 8 |
| 30 | put words 18 ulong 38654705672 |
| 31 | put words 19 ulong 12884901888 |
| 32 | else |
| 33 | put words 16 ulong 5591222095 |
| 34 | put words 17 or get words 0 ulong 34359738368 |
| 35 | put words 18 ulong 34359738377 |
| 36 | put words 19 ulong 3 |
| 37 | end |
| 38 | put words 20 get words 1 |
| 39 | ret 1 |
| 40 | end |
| 41 | n = ulong 0 |
| 42 | if big |
| 43 | if ne get words 16 5567371968988053505 |
| 44 | ret 0 |
| 45 | end |
| 46 | if ne and get words 17 4294967295 8 |
| 47 | ret 0 |
| 48 | end |
| 49 | if ne get words 18 38654705672 |
| 50 | ret 0 |
| 51 | end |
| 52 | if ne shr get words 19 32 3 |
| 53 | ret 0 |
| 54 | end |
| 55 | n = shr get words 17 32 |
| 56 | else |
| 57 | if ne get words 16 5591222095 |
| 58 | ret 0 |
| 59 | end |
| 60 | if ne shr get words 17 32 8 |
| 61 | ret 0 |
| 62 | end |
| 63 | if ne get words 18 34359738377 |
| 64 | ret 0 |
| 65 | end |
| 66 | if ne and get words 19 4294967295 3 |
| 67 | ret 0 |
| 68 | end |
| 69 | n = and get words 17 4294967295 |
| 70 | end |
| 71 | if or eq n 0 gt n 8 |
| 72 | ret 0 |
| 73 | end |
| 74 | ret n |
| 75 | end |