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 / models / quant-stream.om

105 lines · 1681 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Verification caller input384 wire +65536 source +1024 scales, exact records.
3note Output384 canonical +65536 packed +1024 packed scales. No output on refusal.
4fn qs_io384 b edit uchar 384 emit bool to bool
5p = ulong 0
6while lt p 384 bound 384
7n = long 0
8if emit
9n = write 1 b p sub ulong 384 p
10else
11n = read 0 b p sub ulong 384 p
12end
13if le n 0
14ret false
15end
16p = add p ulong n
17end
18ret true
19end
20fn qs_io65536 b edit uchar 65536 emit bool to bool
21p = ulong 0
22while lt p 65536 bound 65536
23n = long 0
24if emit
25n = write 1 b p sub ulong 65536 p
26else
27n = read 0 b p sub ulong 65536 p
28end
29if le n 0
30ret false
31end
32p = add p ulong n
33end
34ret true
35end
36fn qs_io1024 b edit uchar 1024 emit bool to bool
37p = ulong 0
38while lt p 1024 bound 1024
39n = long 0
40if emit
41n = write 1 b p sub ulong 1024 p
42else
43n = read 0 b p sub ulong 1024 p
44end
45if le n 0
46ret false
47end
48p = add p ulong n
49end
50ret true
51end
52fn qs_equal a view uchar 384 b view uchar 384 to bool
53for i ulong 384
54if ne get a i get b i
55ret false
56end
57end
58ret true
59end
60fn main to int
61b = new uchar 384 0
62a = new uchar 384 0
63d = new ulong 48 0
64src = new uchar 65536 0
65sc = new uchar 1024 0
66dst = new uchar 65536 0
67ds = new uchar 1024 0
68if not qs_io384 b false
69ret 80
70end
71if not qs_io65536 src false
72ret 80
73end
74if not qs_io1024 sc false
75ret 80
76end
77r = quant_read b d
78if ne r 0
79ret int r
80end
81r = quant_write d a
82if ne r 0
83ret int r
84end
85if ne quant_hash b quant_hash a
86ret 81
87end
88if not qs_equal a b
89ret 81
90end
91r = quant_repack d src sc dst ds
92if ne r 0
93ret int r
94end
95if not qs_io384 a true
96ret 82
97end
98if not qs_io65536 dst true
99ret 82
100end
101if not qs_io1024 ds true
102ret 82
103end
104ret 0
105end