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 / fakenv.om

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