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 / components / record-unit.om

217 lines · 4076 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Verification entry: stdin is independent original-C staged frame; argv is K LB MT W rowmap.
3note Conductor compares complete native/C frames and disassembles all code before this test.
4text RUOk "PASS staged canonical/launch/cfg/out8 controls and independent C statistics\n"
5fn ru_word h view uchar 56 k ulong to ulong
6v = ulong 0
7for j ulong 8
8v = or v shl ulong get h add mul k 8 j mul j 8
9end
10ret v
11end
12fn ru_arg k ulong to ulong
13a = new uchar 8 0
14n = argread k a 0 8
15if or le n 0 gt n 5
16ret 0
17end
18v = ulong 0
19for j ulong ulong n
20c = get a j
21if or lt c 48 gt c 57
22ret 0
23end
24v = add mul v 10 sub ulong c 48
25end
26if gt v 16384
27ret 0
28end
29ret v
30end
31fn ru_bad b edit uchar 4096 field ulong value ulong to bool
32old = compose_word b field
33compose_put b field value
34rc = compose_check b 1152
35compose_put b field old
36ret ne rc 0
37end
38fn ru_input cfg edit ulong 16 out edit ulong 8 to int
39h = new uchar 56 0
40pos = ulong 0
41while lt pos 56 bound 56
42n = read 0 h pos sub ulong 56 pos
43if le n 0
44ret 11
45end
46pos = add pos ulong n
47end
48if ne ru_word h 0 0
49ret 12
50end
51put cfg 0 3
52for j ulong 5
53put cfg add j 1 ru_arg add j 1
54end
55put out 0 ru_word h 1
56put out 1 ru_word h 5
57put out 2 ru_word h 6
58put out 3 ru_word h 4
59put out 4 ru_word h 2
60put out 5 ru_word h 3
61ret 0
62end
63fn ru_build cfg view ulong 16 b edit uchar 4096 l edit ulong 32 out edit ulong 8 to int
64ins = new ulong 8192 0
65meta = new ulong 2048 0
66phys = new ulong 288 0
67fresh = new ulong 8 0
68if ne bc_compose cfg ins meta phys fresh 0
69ret 13
70end
71for j ulong 8
72if ne get fresh j get out j
73ret 14
74end
75put out j get fresh j
76end
77ret ru_fill cfg b l out
78end
79fn ru_fill cfg view ulong 16 b edit uchar 4096 l edit ulong 32 out view ulong 8 to int
80if ne compose_fixture b l 0
81ret 17
82end
83compose_put b 4 64
84compose_put b 6 get cfg 1
85compose_put b 14 get cfg 3
86compose_put b 16 mul get cfg 2 32
87compose_put b 17 get cfg 4
88ks = div get cfg 1 mul get cfg 2 32
89u = ks
90if eq rem ks 2 0
91u = 2
92end
93compose_put b 18 u
94compose_put b 19 3
95compose_put b 21 get out 3
96note Exact original-C omega_bw_gpr_declared expression, not a new launch policy.
97decl = add get out 1 2
98decl = add decl 7
99decl = div decl 8
100decl = mul decl 8
101compose_put b 22 decl
102compose_put b 25 mul get cfg 4 32
103put l 4 mul get cfg 4 32
104put l 7 get out 3
105put l 8 decl
106put l 12 add ulong 8 mul get cfg 5 4
107ret 0
108end
109fn ru_checks cfg edit ulong 16 b edit uchar 4096 l edit ulong 32 out edit ulong 8 to int
110if ne bc_record cfg b l out 0
111ret 18
112end
113decl = compose_word b 22
114peak = get out 1
115u = compose_word b 18
116note A removed +2 guard must be caught even when declaration remains eight-aligned.
117put out 1 sub decl 1
118if eq bc_record cfg b l out 0
119ret 70
120end
121put out 1 peak
122if not ru_bad b 14 3
123ret 20
124end
125if not ru_bad b 15 2
126ret 21
127end
128if not ru_bad b 16 128
129ret 22
130end
131if not ru_bad b 17 3
132ret 23
133end
134if not ru_bad b 18 add u 1
135ret 24
136end
137if not ru_bad b 21 sub get out 3 128
138ret 25
139end
140if not ru_bad b 22 add decl 1
141ret 26
142end
143if not ru_bad b 23 7
144ret 27
145end
146if not ru_bad b 24 0
147ret 28
148end
149if not ru_bad b 28 2
150ret 29
151end
152put l 11 904
153if eq compose_launch b l 0
154ret 30
155end
156put l 11 896
157put l 12 10
158if eq compose_launch b l 0
159ret 31
160end
161put l 12 add ulong 8 mul get cfg 5 4
162put cfg 5 sub ulong 1 get cfg 5
163if eq bc_record cfg b l out 0
164ret 32
165end
166put cfg 5 sub ulong 1 get cfg 5
167put cfg 6 1
168if eq bc_record cfg b l out 0
169ret 33
170end
171put cfg 6 0
172put out 6 1
173if eq bc_record cfg b l out 0
174ret 34
175end
176put out 6 0
177if lt get out 3 16384
178compose_put b 21 add get out 3 128
179put l 7 add get out 3 128
180if ne bc_record cfg b l out 0
181ret 35
182end
183compose_put b 21 get out 3
184put l 7 get out 3
185end
186if le mul get l 4 add decl 8 65536
187compose_put b 22 add decl 8
188put l 8 add decl 8
189if ne bc_record cfg b l out 0
190ret 36
191end
192end
193ret 0
194end
195fn main to int
196if ne argcnt 6
197ret 10
198end
199cfg = new ulong 16 0
200b = new uchar 4096 0
201l = new ulong 32 0
202out = new ulong 8 0
203rc = ru_input cfg out
204if ne rc 0
205ret rc
206end
207rc = ru_build cfg b l out
208if ne rc 0
209ret rc
210end
211rc = ru_checks cfg b l out
212if ne rc 0
213ret rc
214end
215z = write 1 RUOk 0 len RUOk
216ret 0
217end