interplane.Get Omega
Read in your language

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

branch main Branches Tags History

CUDApp / tests / host-trace / batch-wait-test.om

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