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 / tests / components / direct-caller.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Concatenate allocator,effect,project,repaired bw_enc_sm121,then this host caller. |
| 3 | global CTIn uchar 64 |
| 4 | global CTOut uchar 8 |
| 5 | fn ct_word v ulong to bool |
| 6 | for j ulong 8 |
| 7 | put CTOut j uchar and shr v mul j 8 255 |
| 8 | end |
| 9 | ret eq write 1 CTOut 0 8 8 |
| 10 | end |
| 11 | fn ct_parse spec edit ulong 8 to void |
| 12 | for k ulong 8 |
| 13 | v = ulong 0 |
| 14 | for j ulong 8 |
| 15 | v = or v shl ulong get CTIn add mul k 8 j mul j 8 |
| 16 | end |
| 17 | put spec k v |
| 18 | end |
| 19 | end |
| 20 | fn ct_frame ins view ulong 8192 meta view ulong 2048 phys view ulong 288 st view ulong 4 rs view ulong 4 to void |
| 21 | for k ulong 4 |
| 22 | ok = ct_word get st k |
| 23 | end |
| 24 | ok = ct_word get rs 1 |
| 25 | ok = ct_word get rs 2 |
| 26 | for k ulong get st 1 |
| 27 | ok = ct_word get meta k |
| 28 | ok = ct_word get phys k |
| 29 | end |
| 30 | for k ulong get st 2 |
| 31 | ok = ct_word get meta add k 256 |
| 32 | ok = ct_word get phys add k 256 |
| 33 | end |
| 34 | for k ulong mul get st 0 8 |
| 35 | ok = ct_word get ins k |
| 36 | end |
| 37 | end |
| 38 | fn main to int |
| 39 | spec = new ulong 8 0 |
| 40 | ins = new ulong 8192 0 |
| 41 | meta = new ulong 2048 0 |
| 42 | phys = new ulong 288 0 |
| 43 | st = new ulong 4 0 |
| 44 | rs = new ulong 4 0 |
| 45 | code = new uchar 16384 0 |
| 46 | if ne read 0 CTIn 0 64 64 |
| 47 | ret 65 |
| 48 | end |
| 49 | ct_parse spec |
| 50 | rc = bc_project spec ins meta st |
| 51 | if ne rc 0 |
| 52 | ret 66 |
| 53 | end |
| 54 | if ne bc_regalloc ins get st 0 meta phys rs 128 0 |
| 55 | ret 67 |
| 56 | end |
| 57 | nbytes = bc_encode ins phys get st 0 1 code |
| 58 | if eq nbytes 0 |
| 59 | ret 68 |
| 60 | end |
| 61 | ct_frame ins meta phys st rs |
| 62 | if ne write 1 code 0 nbytes long nbytes |
| 63 | ret 74 |
| 64 | end |
| 65 | ret 0 |
| 66 | end |