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 / batch-fake.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note HOST-ONLY queue model. Anonymous mappings, no device words. nvsend parses the actual packet. |
| 3 | global nverr long 1 |
| 4 | global nvfault uchar 1 |
| 5 | global nvstage uint 1 |
| 6 | global bfstat ulong 4 |
| 7 | note bfstat: kicks waits sleeps last sleep. bffail is 1-based simulated failing kernel, 0 none. |
| 8 | global bffail ulong 1 |
| 9 | note bfcache: GPU-cache flag per nvalloc call, in call order (1 cached, 2 uncached). |
| 10 | global bfcache uchar 16 |
| 11 | global bfallocs ulong 1 |
| 12 | fn nvfull to bool |
| 13 | ret true |
| 14 | end |
| 15 | fn nvchan to bool |
| 16 | ret true |
| 17 | end |
| 18 | fn nvalloc want ulong cached bool to long |
| 19 | k = get bfallocs 0 |
| 20 | if lt k 16 |
| 21 | put bfcache k uchar 2 |
| 22 | if cached |
| 23 | put bfcache k uchar 1 |
| 24 | end |
| 25 | end |
| 26 | put bfallocs 0 add k 1 |
| 27 | ret mapnew -1 0 want 3 34 |
| 28 | end |
| 29 | fn nvsend m long off ulong words uint to bool |
| 30 | put bfstat 0 add get bfstat 0 1 |
| 31 | ret bfdev m off words |
| 32 | end |
| 33 | fn nvwait m long off ulong value uint budget ulong to bool |
| 34 | put bfstat 1 add get bfstat 1 1 |
| 35 | for i ulong 4 |
| 36 | if eq mapget m off 4 ulong value |
| 37 | ret true |
| 38 | end |
| 39 | put bfstat 2 add get bfstat 2 1 |
| 40 | put bfstat 3 100000 |
| 41 | s = sleepns 100000 |
| 42 | end |
| 43 | put nverr 0 -110 |
| 44 | put nvfault 0 1 |
| 45 | ret false |
| 46 | end |