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 / encoder / ldg_mini.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note One instruction: LDG.E R2, desc[UR8][R30.64+64]. No padding or kernel builder. |
| 3 | note Compose after bw_enc_sm121.om. No args emits one 128-byte C-adapter record. |
| 4 | note An argument emits status zero plus the seeded four words, 24 bytes total. |
| 5 | fn lm_word b edit uchar 128 pos ulong value ulong n ulong to void |
| 6 | for h ulong n |
| 7 | put b add pos h uchar and shr value mul h 8 255 |
| 8 | end |
| 9 | end |
| 10 | fn main to int |
| 11 | a = new ulong 16 0 |
| 12 | o = new ulong 16 0 |
| 13 | w = new ulong 4 0 |
| 14 | b = new uchar 128 0 |
| 15 | put a 0 11 |
| 16 | put a 1 2 |
| 17 | put a 2 30 |
| 18 | put a 5 8 |
| 19 | put a 6 64 |
| 20 | if gt argcnt 1 |
| 21 | for k ulong 8 |
| 22 | put o k get a k |
| 23 | end |
| 24 | put o 12 1 |
| 25 | put o 14 1 |
| 26 | put o 15 1 |
| 27 | if ne enc1 o w 0 |
| 28 | ret 1 |
| 29 | end |
| 30 | for k ulong 4 |
| 31 | pos = add 8 mul k 4 |
| 32 | lm_word b pos get w k 4 |
| 33 | end |
| 34 | r = write 1 b 0 24 |
| 35 | if ne r 24 |
| 36 | ret 2 |
| 37 | end |
| 38 | else |
| 39 | for k ulong 16 |
| 40 | pos = mul k 8 |
| 41 | lm_word b pos get a k 8 |
| 42 | end |
| 43 | r = write 1 b 0 128 |
| 44 | if ne r 128 |
| 45 | ret 2 |
| 46 | end |
| 47 | end |
| 48 | ret 0 |
| 49 | end |