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

191 lines · 4286 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Compose batch-fake.om vector.om launch.om batch.om batch-test.om. Host-only.
3global bttally ulong 2
4global btold uchar 65536
5global btgot uchar 65536
6global btdig uchar 32
7text btpass "BATCH_HOST_PASS checks="
8text btfail "BATCH_HOST_FAIL checks="
9text btpar " parity_cases=32 parity_bytes="
10text btcount " batch_launches=287 kicks=1 waits=1 negatives=8\n"
11global btbytes ulong 1
12fn btnum n ulong to void
13if ge n 10
14btnum div n 10
15end
16put btdig 0 uchar add ulong 48 rem n 10
17r = write 1 btdig 0 1
18end
19fn btck ok bool to void
20put bttally 0 add get bttally 0 1
21if not ok
22put bttally 1 add get bttally 1 1
23end
24end
25fn btreset to void
26put nvfault 0 0
27put bffail 0 0
28put gbst 3 0
29for i ulong 4
30put bfstat i 0
31end
32end
33fn btparity n uint to void
34gbbuild n
35sz = get gbused 0
36for i ulong sz
37put btold i get gbcmd i
38end
39btck gbbegin 1
40gbbody n
41btck gbappend ulong n 0
42btck gbbsubmit 1000000
43btck eq sz get gbst 2
44r = mapread get gbpkt 0 0 btgot 0 sz
45btck eq r long sz
46for i ulong sz
47btck eq get btold i get btgot i
48end
49put btbytes 0 add get btbytes 0 sz
50end
51fn btrecord n ulong to bool
52if not gbbegin n
53ret false
54end
55for i ulong n
56gbbody 64
57if not gbappend add ulong 100 i i
58ret false
59end
60end
61ret true
62end
63fn main to int
64btck gbopen 64
65btck gbbopen
66note Packet and control/code/marker mappings 0-4 GPU-uncached; data operands 5-7 cached.
67btck eq get bfallocs 0 9
68for i ulong 5
69btck eq get bfcache i 2
70end
71for i ulong 3
72btck eq get bfcache add i 5 1
73end
74btck eq get bfcache 8 2
75for i ulong 32
76btparity uint add i 1
77end
78btreset
79btck btrecord 287
80btck gbbsubmit 1000000
81btck eq get bfstat 0 1
82btck eq get bfstat 1 1
83btck eq get gbst 6 1
84btck eq get gbst 7 1
85for i ulong 287
86btck eq mapget get gbmem 3 add ulong 32 mul i 4 4 6
87end
88note Negative 1: future producer, then attempted submit must not send the valid prefix.
89btreset
90btck gbbegin 3
91gbbody 64
92btck gbappend 100 0
93gbbody 64
94btck not gbappend 101 2
95btck not gbbsubmit 1000000
96btck eq get bfstat 0 0
97btck eq get gbst 4 1
98btck eq get gbst 5 101
99note Negative 2: count > capacity before any send.
100btreset
101btck not gbbegin 513
102btck not gbbsubmit 1000000
103btck eq get bfstat 0 0
104note Negative 3: an extra launch poisons the whole recording, cannot send a prefix.
105btreset
106btck btrecord 1
107gbbody 64
108btck not gbappend 101 1
109btck not gbbsubmit 1000000
110btck eq get bfstat 0 0
111note Negative 4: failure inside a batch names index 1 and caller id 101, not final kernel 102.
112btreset
113btck btrecord 3
114put bffail 0 2
115btck not gbbsubmit 1000000
116btck eq get gbst 4 1
117btck eq get gbst 5 101
118btck eq get bfstat 0 1
119btck eq get bfstat 1 1
120btck eq get bfstat 2 4
121btck eq get bfstat 3 100000
122btck ne get nvfault 0 0
123btck not gbbegin 1
124btck not gbappend 104 0
125note Negative 5: incomplete recording refused before send.
126btreset
127btck gbbegin 2
128gbbody 64
129btck gbappend 100 0
130btck not gbbsubmit 1000000
131btck eq get bfstat 0 0
132note Negative 6: malformed body length is refused and poisons the batch.
133btreset
134btck gbbegin 1
135put gbused 0 3
136btck not gbappend 100 0
137btck not gbbsubmit 1000000
138btck eq get bfstat 0 0
139note Negative 7: byte capacity overflow refused before copy, never sends a prefix.
140btreset
141btck gbbegin 32
142for i ulong 16
143put gbused 0 65536
144ok = gbappend i 0
145if lt i 15
146btck ok
147else
148btck not ok
149end
150end
151btck not gbbsubmit 1000000
152btck eq get bfstat 0 0
153note Negative 8: after the reserve is consumed exactly, a further 4-byte body is refused (-75),
154note not accepted through an unsigned wrap and later trapped by the mapping bounds check.
155btreset
156put nverr 0 0
157btck gbbegin 18
158for i ulong 15
159put gbused 0 65536
160btck gbappend i 0
161end
162put gbused 0 64956
163btck gbappend 15 0
164btck eq get gbst 2 1048508
165put gbused 0 4
166btck not gbappend 16 0
167btck eq get nverr 0 -75
168btck eq get gbst 4 16
169btck not gbbsubmit 1000000
170btck eq get bfstat 0 0
171note Existing per-launch entry still does one send and one wait with unchanged completion checks.
172btreset
173btck gblaunch 64
174btck eq get bfstat 0 1
175btck eq get bfstat 1 1
176for i ulong 8
177r = mapdrop get gbmem i
178end
179r = mapdrop get gbpkt 0
180if ne get bttally 1 0
181r = write 1 btfail 0 len btfail
182btnum get bttally 1
183ret 1
184end
185r = write 1 btpass 0 len btpass
186btnum get bttally 0
187r = write 1 btpar 0 len btpar
188btnum get btbytes 0
189r = write 1 btcount 0 len btcount
190ret 0
191end