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-wait-test.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Compose with the REAL native/nvrm/context.om. No driver function is invoked. |
| 3 | note Shared anonymous host mapping lets a child deliver the completion; timeout stays fail-stop. |
| 4 | global bwwait uchar 4 |
| 5 | text bwpass "BATCH_NATIVE_WAIT_PASS completion timeout refusal\n" |
| 6 | fn main to int |
| 7 | m = mapnew -1 0 4096 3 33 |
| 8 | if le m 0 |
| 9 | ret 1 |
| 10 | end |
| 11 | put nvmmap 0 m |
| 12 | put nvmlen 0 4096 |
| 13 | put nvsched 0 1 |
| 14 | put nvput 0 1 |
| 15 | put nvret 0 0 |
| 16 | child = fork |
| 17 | if lt child 0 |
| 18 | r = mapdrop m |
| 19 | ret 2 |
| 20 | end |
| 21 | if eq child 0 |
| 22 | r = sleepns 1000000 |
| 23 | r = mapset m 0 4 6 |
| 24 | exit 0 |
| 25 | end |
| 26 | ok = nvwait m 0 6 1000000000 |
| 27 | pid = waitpid int child bwwait 0 4 0 |
| 28 | if or not ok ne pid child |
| 29 | r = mapdrop m |
| 30 | ret 3 |
| 31 | end |
| 32 | if ne get nvret 0 1 |
| 33 | r = mapdrop m |
| 34 | ret 4 |
| 35 | end |
| 36 | note A second wait without another send is refused. |
| 37 | if nvwait m 0 6 1000000 |
| 38 | r = mapdrop m |
| 39 | ret 5 |
| 40 | end |
| 41 | put nvput 0 2 |
| 42 | r = mapset m 0 4 0 |
| 43 | start = monons |
| 44 | if nvwait m 0 6 1000000 |
| 45 | r = mapdrop m |
| 46 | ret 6 |
| 47 | end |
| 48 | if or lt sub monons start 1000000 eq get nvfault 0 0 |
| 49 | r = mapdrop m |
| 50 | ret 7 |
| 51 | end |
| 52 | if ne get nverr 0 -110 |
| 53 | r = mapdrop m |
| 54 | ret 8 |
| 55 | end |
| 56 | r = mapdrop m |
| 57 | r = write 1 bwpass 0 len bwpass |
| 58 | ret 0 |
| 59 | end |