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 / host-trace / fakenv.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note HOST STAND-IN for native/nvrm/context.om, for host trace tests only. It defines the names |
| 3 | note launch.om uses (nvfull nvchan nvalloc nvsend nvwait nverr nvfault nvstage) without opening any |
| 4 | note device: buffers are anonymous private mappings (mapnew -1 0 bytes 3 34). nvsend calls fkdev |
| 5 | note (tests/host-trace/fakedev.om, composed after launch.om because it reads launch.om globals). Nothing here is a GPU observation; |
| 6 | note timings recorded around it are host timings of this stand-in. |
| 7 | note fkmode: 0 normal, 1 nvsend fails, 2 completion never arrives (nvwait times out), |
| 8 | note 3 a wrong completion mark (gblaunch sets nvfault). |
| 9 | global nverr long 1 |
| 10 | global nvfault uchar 1 |
| 11 | global nvstage uint 1 |
| 12 | global fkmode uint 1 |
| 13 | global fksz ulong 8 |
| 14 | global fkn ulong 1 |
| 15 | fn nvfull to bool |
| 16 | ret true |
| 17 | end |
| 18 | fn nvchan to bool |
| 19 | ret true |
| 20 | end |
| 21 | fn nvalloc want ulong cached bool to long |
| 22 | m = mapnew -1 0 want 3 34 |
| 23 | n = get fkn 0 |
| 24 | if lt n 8 |
| 25 | put fksz n want |
| 26 | end |
| 27 | put fkn 0 add n 1 |
| 28 | ret m |
| 29 | end |
| 30 | fn nvsend m long off ulong words uint to bool |
| 31 | if eq get fkmode 0 1 |
| 32 | put nverr 0 -5 |
| 33 | ret false |
| 34 | end |
| 35 | if eq get fkmode 0 2 |
| 36 | ret true |
| 37 | end |
| 38 | mark = uint 1145324612 |
| 39 | if eq get fkmode 0 3 |
| 40 | mark = uint 1 |
| 41 | end |
| 42 | fkdev mark |
| 43 | ret true |
| 44 | end |
| 45 | note nvwait polls the mark with a 20 microsecond host sleep between reads, at most 50 reads. |
| 46 | fn nvwait m long off ulong value uint budget ulong to bool |
| 47 | for i ulong 50 |
| 48 | if eq mapget m off 4 ulong value |
| 49 | ret true |
| 50 | end |
| 51 | s = sleepns 20000 |
| 52 | end |
| 53 | put nverr 0 -110 |
| 54 | ret false |
| 55 | end |