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 / cache / digest_test.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Concatenate digest.om, hash exact stdin bytes, emit binary digest for sha256sum comparison. |
| 3 | fn main to int |
| 4 | buf = new uchar 4096 0 |
| 5 | code = new uchar 16384 0 |
| 6 | other = new uchar 32 0 |
| 7 | out = new uchar 32 0 |
| 8 | extra = new uchar 1 0 |
| 9 | n = ulong 0 |
| 10 | while lt n 16384 bound 16384 |
| 11 | k = read 0 code n sub ulong 16384 n |
| 12 | if lt k 0 |
| 13 | ret 1 |
| 14 | end |
| 15 | if eq k 0 |
| 16 | break |
| 17 | end |
| 18 | n = add n ulong k |
| 19 | end |
| 20 | if eq n 16384 |
| 21 | k = read 0 extra 0 1 |
| 22 | if ne k 0 |
| 23 | ret 2 |
| 24 | end |
| 25 | end |
| 26 | if ne kc_sha buf 4097 other -1 |
| 27 | ret 5 |
| 28 | end |
| 29 | if ne kc_codesha code n out 0 |
| 30 | ret 3 |
| 31 | end |
| 32 | if le n 4096 |
| 33 | for i ulong n |
| 34 | put buf i get code i |
| 35 | end |
| 36 | if ne kc_sha buf n other 0 |
| 37 | ret 6 |
| 38 | end |
| 39 | for i ulong 32 |
| 40 | if ne get out i get other i |
| 41 | ret 7 |
| 42 | end |
| 43 | end |
| 44 | end |
| 45 | n = 0 |
| 46 | while lt n 32 bound 32 |
| 47 | k = write 1 out n sub ulong 32 n |
| 48 | if le k 0 |
| 49 | ret 4 |
| 50 | end |
| 51 | n = add n ulong k |
| 52 | end |
| 53 | ret 0 |
| 54 | end |