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 / rowpipe-caller.om

148 lines · 2690 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Host-only caller. stdin exactly64 bytes: eight LE64 spec words.
3note Concatenate bw_alloc,bw_effect,bw_project,rowpipe,bw_enc_sm121,bw_spec_sm121,this.
4note bw_spec_sm121 contributes only the prefix before its standalone fn main.
5note stdout same shared caller frame:stats4,peakGPR,peakUGPR,width+phys per GPR/UGPR,
6note all used eight-cell instructions,then unpadded instruction bytes.
7note Exit66 is a clean refusal with zero outputs;69 means refusal leaked output.
8fn rp_word v ulong to bool
9b = new uchar 8 0
10for j ulong 8
11put b j uchar and shr v mul j 8 255
12end
13n = ulong 0
14while lt n 8 bound 8
15k = write 1 b n sub ulong 8 n
16if le k 0
17ret false
18end
19n = add n ulong k
20end
21ret true
22end
23fn rp_bytes b view uchar 16384 n ulong to int
24sent = ulong 0
25while lt sent n bound 16384
26k = write 1 b sent sub n sent
27if le k 0
28ret 74
29end
30sent = add sent ulong k
31end
32ret 0
33end
34fn rp_admit ins view ulong 8192 phys view ulong 288 n ulong to uint
35state = new ulong 3001 0
36o = new ulong 16 0
37w = new ulong 4 0
38for j ulong n
39opnds ins j phys o
40if ne sp_enc state o w 0
41ret 1
42end
43end
44ret 0
45end
46fn rp_input spec edit ulong 8 to int
47b = new uchar 64 0
48n = ulong 0
49while lt n 64 bound 64
50k = read 0 b n sub ulong 64 n
51if le k 0
52ret 65
53end
54n = add n ulong k
55end
56extra = read 0 b 0 1
57if ne extra 0
58ret 65
59end
60for j ulong 8
61v = ulong 0
62for k ulong 8
63v = or v shl ulong get b add mul j 8 k mul k 8
64end
65put spec j v
66end
67ret 0
68end
69fn rp_irout ins view ulong 8192 m view ulong 2048 phys view ulong 288 stats view ulong 4 astats view ulong 4 to int
70for j ulong 4
71if not rp_word get stats j
72ret 74
73end
74end
75if not rp_word get astats 1
76ret 74
77end
78if not rp_word get astats 2
79ret 74
80end
81for j ulong get stats 1
82if not rp_word get m j
83ret 74
84end
85if not rp_word get phys j
86ret 74
87end
88end
89for j ulong get stats 2
90if not rp_word get m add j 256
91ret 74
92end
93if not rp_word get phys add j 256
94ret 74
95end
96end
97for j ulong mul get stats 0 8
98if not rp_word get ins j
99ret 74
100end
101end
102ret 0
103end
104fn main to int
105spec = new ulong 8 0
106ins = new ulong 8192 1
107m = new ulong 2048 1
108stats = new ulong 4 1
109astats = new ulong 4 0
110phys = new ulong 288 0
111code = new uchar 16384 0
112if ne rp_input spec 0
113ret 65
114end
115rc = bc_rowpipe spec ins m stats
116if ne rc 0
117for j ulong 8192
118if ne get ins j 0
119ret 69
120end
121end
122for j ulong 2048
123if ne get m j 0
124ret 69
125end
126end
127for j ulong 4
128if ne get stats j 0
129ret 69
130end
131end
132ret 66
133end
134if ne bc_regalloc ins get stats 0 m phys astats 128 0
135ret 67
136end
137if ne rp_admit ins phys get stats 0 0
138ret 68
139end
140size = bw_enc_sm121 ins phys get stats 0 0 code
141if eq size 0
142ret 68
143end
144if ne rp_irout ins m phys stats astats 0
145ret 74
146end
147ret rp_bytes code size
148end