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 / q38-head / driver.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | global QHOut uchar 8 |
| 3 | fn qh_word v ulong to void |
| 4 | for j ulong 8 |
| 5 | put QHOut j uchar and shr v mul j 8 255 |
| 6 | end |
| 7 | if ne write 1 QHOut 0 8 8 |
| 8 | trap 5 |
| 9 | end |
| 10 | end |
| 11 | fn main to int |
| 12 | ins = new ulong 8192 0 |
| 13 | meta = new ulong 2048 0 |
| 14 | phys = new ulong 288 0 |
| 15 | st = new ulong 4 0 |
| 16 | rs = new ulong 4 0 |
| 17 | code = new uchar 16384 0 |
| 18 | if ne q38_bounds ins meta st 0 |
| 19 | ret 66 |
| 20 | end |
| 21 | if ne bc_ircheck ins get st 0 meta 0 |
| 22 | ret 69 |
| 23 | end |
| 24 | if ne bc_regalloc ins get st 0 meta phys rs 128 0 |
| 25 | ret 67 |
| 26 | end |
| 27 | nbytes = bc_encode ins phys get st 0 1 code |
| 28 | if eq nbytes 0 |
| 29 | ret 68 |
| 30 | end |
| 31 | for k ulong 4 |
| 32 | qh_word get st k |
| 33 | end |
| 34 | qh_word get rs 1 |
| 35 | qh_word get rs 2 |
| 36 | for k ulong get st 1 |
| 37 | qh_word get meta k |
| 38 | qh_word get phys k |
| 39 | end |
| 40 | for k ulong get st 2 |
| 41 | qh_word get meta add k 256 |
| 42 | qh_word get phys add k 256 |
| 43 | end |
| 44 | for k ulong mul get st 0 8 |
| 45 | qh_word get ins k |
| 46 | end |
| 47 | if ne write 1 code 0 nbytes long nbytes |
| 48 | ret 74 |
| 49 | end |
| 50 | ret 0 |
| 51 | end |