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 / recorder-test.om

169 lines · 3149 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Host checks for native/trace/htrec.om. Synthetic events only; no device is opened.
3note Prints one line per failed check and HOSTTRACE_RECORDER_PASS <checks> or _FAIL <failures>.
4global tally ulong 2
5global digits uchar 32
6global back uchar 262144
7text passmsg "HOSTTRACE_RECORDER_PASS "
8text failmsg "HOSTTRACE_RECORDER_FAIL "
9text nlaunch "kernel.launch:VECTOR_1D"
10text nspace "bad name"
11text nlong "a123456789a123456789a123456789a123456789a123456789a123456789abcd"
12fn number n ulong to void
13if ge n 10
14number div n 10
15end
16put digits 0 uchar add 48 rem n 10
17w = write 1 digits 0 1
18end
19fn ck yes bool to void
20put tally 0 add get tally 0 1
21if not yes
22put tally 1 add get tally 1 1
23number get tally 0
24put digits 0 10
25w = write 1 digits 0 1
26end
27end
28fn regl id uint to bool
29if not htnbeg id
30ret false
31end
32for i ulong len nlaunch
33b = htnbyte get nlaunch i
34end
35ret htnend
36end
37fn regsp id uint to bool
38if not htnbeg id
39ret false
40end
41for i ulong len nspace
42b = htnbyte get nspace i
43end
44ret htnend
45end
46fn reglong id uint to bool
47if not htnbeg id
48ret false
49end
50for i ulong len nlong
51b = htnbyte get nlong i
52end
53ret htnend
54end
55fn rd at ulong k ulong to ulong
56v = ulong 0
57for i ulong k
58v = or v shl ulong get back add at i mul i 8
59end
60ret v
61end
62fn offchecks to void
63ck not htlive
64ck eq htbeg 4 1 0
65ck not htmark 2 1 0 0 0
66ck eq get htst 1 0
67ck eq get htst 3 0
68end
69fn namechecks to void
70ck regl 1
71ck not regl 1
72ck not regl 0
73ck not regsp 2
74ck not reglong 3
75ck not htnbyte 65
76ck htnbeg 4
77ck not htnend
78ck eq get htst 6 1
79ck eq get htst 3 6
80ck htnbeg 5
81ck not htnbeg 6
82ck eq get htst 3 7
83end
84fn spanchecks to void
85ck htinit
86ck htlive
87s = htbeg 4 1
88ck eq s 1
89ck eq get htst 7 1
90ck htend s 1024 43 0
91ck eq get htst 7 0
92ck not htend s 1 1 1
93ck not htend 99 1 1 1
94ck eq htbeg 2 1 0
95ck not htmark 4 1 0 0 0
96ck eq htbeg 0 1 0
97ck eq htbeg 12 1 0
98ck eq htbeg 4 77 0
99ck not htmark 8 77 3 0 0
100ck eq get htst 3 8
101ck htmark 8 1 3 12 -22
102ck eq get htst 1 2
103ck eq get htkind 1 8
104ck eq get hta0 1 3
105ck eq get htrc 1 -22
106end
107fn dumpchecks to void
108fd = memfd nlaunch 0 len nlaunch 1
109ck ge fd 0
110r = htdump int fd
111ck eq ulong r htbytes
112ck eq r 189
113p = fseek int fd 0 0
114k = read int fd back 0 len back
115ck eq k r
116ck eq rd 0 4 827479119
117ck eq rd 4 2 1
118ck eq rd 6 2 48
119ck eq rd 8 4 2
120ck eq rd 16 4 8
121ck eq rd 20 4 1
122ck eq rd 44 4 1
123ck eq rd 64 2 4
124ck eq rd 66 2 1
125ck eq rd 68 4 1
126ck ge rd 80 8 rd 72 8
127ck eq rd 88 8 1024
128ck eq rd 96 8 43
129ck eq rd 112 2 8
130ck eq rd 152 8 18446744073709551594
131ck eq rd 160 4 1
132ck eq rd 164 2 len nlaunch
133ck eq rd 166 1 107
134c = fclose int fd
135end
136fn capchecks to void
137n = get htst 1
138for i ulong sub HTCAP n
139b = htmark 10 1 i 0 0
140end
141ck eq get htst 1 HTCAP
142ck eq get htst 2 0
143ck not htmark 10 1 0 0 0
144ck eq htbeg 9 1 0
145ck eq get htst 2 2
146htstop
147ck not htlive
148ck eq htbeg 9 1 0
149ck eq get htst 2 2
150end
151fn main to int
152offchecks
153namechecks
154spanchecks
155dumpchecks
156capchecks
157if ne get tally 1 0
158w = write 1 failmsg 0 len failmsg
159number get tally 1
160put digits 0 10
161w = write 1 digits 0 1
162ret 1
163end
164w = write 1 passmsg 0 len passmsg
165number get tally 0
166put digits 0 10
167w = write 1 digits 0 1
168ret 0
169end