interplane.Get Omega
Read in your language

omega-gpu-driver

aien-dev/omega-gpu-driver

Brought by drakestapleton

branch main Branches Tags History

omega-gpu-driver / tests / uvms_trace.om

191 lines · 2890 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Test-only framed stdin driver. Header eight u64 LE: op,a,b,c,d,e,f,payload-size.
3global stin uchar 64
4global stout uchar 32768
5global stlen ulong 1
6fn starg n ulong to ulong
7v = ulong 0
8for j ulong 8
9v = or v shl ulong get stin add mul n 8 j mul j 8
10end
11ret v
12end
13fn stword v ulong to void
14for j ulong 8
15put stout get stlen 0 uchar and shr v mul j 8 255
16put stlen 0 add get stlen 0 1
17end
18end
19fn staction to ulong
20op = starg 0
21if eq op 1
22ret screate
23end
24if eq op 2
25ret sdestroy
26end
27if eq op 3
28ret sadd starg 1 starg 2 starg 3 starg 4
29end
30if eq op 4
31ret ssplit starg 1
32end
33if eq op 5
34ret smerge starg 1
35end
36if eq op 6
37ret sremove starg 1 starg 2
38end
39if eq op 7
40ret fbpush
41end
42if eq op 8
43ret fbbatch
44end
45if eq op 9
46ret fbrecover
47end
48if eq op 10
49ret scnotify starg 1
50end
51if eq op 11
52ret sidispatch starg 1 starg 2
53end
54if eq op 12
55ret siobject starg 1 starg 2 starg 3
56end
57if eq op 13
58for j ulong 8
59r = iqctake
60if ne r 1
61break
62end
63r = iqcack iqcget 1
64if ne r 0
65ret UVFATAL
66end
67end
68ret UVOK
69end
70if eq op 14
71if eq get fbget 0 get fbput 0
72ret UVENOENT
73end
74o = add mul rem get fbget 0 16 32 31
75put fbring o or get fbring o uchar 128
76ret UVOK
77end
78if eq op 15
79put iqcmode 0 starg 1
80put iqcstate 0 starg 2
81ret UVOK
82end
83if eq op 16
84r = iqcommand 1 add get iqcseq 0 1 0 0 0
85if ne r 0
86ret UVEINVAL
87end
88ret UVOK
89end
90ret UVEINVAL
91end
92fn stsnapshot status ulong to void
93put stlen 0 0
94stword status
95stword get slive 0
96stword get sn 0
97stword get sen 0
98stword get fbget 0
99stword get fbput 0
100stword get fbov 0
101stword get siolen 0
102for j ulong mul get sn 0 8
103stword get sr j
104end
105for j ulong mul get sen 0 6
106stword get sev j
107end
108stword get iqcmode 0
109stword get iqcstate 0
110stword get iqcseq 0
111stword get iqcprod 0
112stword get iqccons 0
113stword get sqbad 0
114for j ulong 320
115put stout get stlen 0 get iqcmd j
116put stlen 0 add get stlen 0 1
117end
118for j ulong 512
119put stout get stlen 0 get fbring j
120put stlen 0 add get stlen 0 1
121end
122for j ulong 384
123stword get spage j
124end
125stword get scva 0
126stword get scval 0
127stword get sctyp 0
128stword get sctag 0
129for j ulong get siolen 0
130put stout get stlen 0 get siob j
131put stlen 0 add get stlen 0 1
132end
133end
134fn strequest to long
135off = ulong 0
136while lt off 64 bound 64
137r = read 0 stin off sub 64 off
138if lt r 0
139ret -1
140end
141if eq r 0
142if eq off 0
143ret 0
144end
145ret -1
146end
147off = add off ulong r
148end
149size = starg 7
150if gt size 9264
151ret -1
152end
153off = 0
154while lt off size bound 9264
155r = read 0 siab off sub size off
156if le r 0
157ret -1
158end
159off = add off ulong r
160end
161for j ulong 32
162put uvpkt j get siab j
163end
164put sen 0 0
165put siolen 0 0
166r2 = staction
167stsnapshot r2
168off = 0
169while lt off get stlen 0 bound 32768
170w = write 1 stout off sub get stlen 0 off
171if le w 0
172ret -1
173end
174off = add off ulong w
175end
176ret 1
177end
178fn main to int
179put iqcmode 0 1
180put iqcstate 0 1
181for j ulong 100000
182r = strequest
183if lt r 0
184ret 70
185end
186if eq r 0
187ret 0
188end
189end
190ret 71
191end