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-fake.om

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