1// Copyright 2022 Google LLC
2//
3// This source code is licensed under the BSD-style license found in the
4// LICENSE file in the root directory of this source tree.
5
6#pragma once
7
8#include <cstdint>
9#include <cstddef>
10#include <vector>
11
12namespace xnnpack {
13void compute_convolution_qs8_reference_results(
14 size_t batch_size,
15 size_t output_height,
16 size_t output_width,
17 size_t input_height,
18 size_t input_width,
19 size_t input_padding_top,
20 size_t input_padding_right,
21 size_t input_padding_bottom,
22 size_t input_padding_left,
23 size_t kernel_height,
24 size_t kernel_width,
25 size_t subsampling_height,
26 size_t subsampling_width,
27 size_t dilation_height,
28 size_t dilation_width,
29 size_t groups,
30 size_t group_input_channels,
31 size_t group_output_channels,
32 size_t input_channel_stride,
33 int8_t input_zero_point,
34 const std::vector<int8_t>& input,
35 const std::vector<int8_t>& filter,
36 std::vector<int32_t>& accumulators,
37 bool has_bias,
38 const std::vector<int32_t>& bias);
39
40void compute_convolution_qs8_reference_results(
41 size_t batch_size,
42 size_t output_height,
43 size_t output_width,
44 size_t input_height,
45 size_t input_width,
46 size_t input_padding_top,
47 size_t input_padding_right,
48 size_t input_padding_bottom,
49 size_t input_padding_left,
50 size_t kernel_height,
51 size_t kernel_width,
52 size_t subsampling_height,
53 size_t subsampling_width,
54 size_t dilation_height,
55 size_t dilation_width,
56 size_t groups,
57 size_t group_input_channels,
58 size_t group_output_channels,
59 int8_t input_zero_point,
60 const std::vector<int8_t>& input,
61 const std::vector<int8_t>& filter,
62 std::vector<int32_t>& accumulators,
63 bool has_bias,
64 const std::vector<int32_t>& bias);
65
66void compute_convolution_qu8_reference_results(
67 size_t batch_size,
68 size_t output_height,
69 size_t output_width,
70 size_t input_height,
71 size_t input_width,
72 size_t input_padding_top,
73 size_t input_padding_right,
74 size_t input_padding_bottom,
75 size_t input_padding_left,
76 size_t kernel_height,
77 size_t kernel_width,
78 size_t subsampling_height,
79 size_t subsampling_width,
80 size_t dilation_height,
81 size_t dilation_width,
82 size_t groups,
83 size_t group_input_channels,
84 size_t group_output_channels,
85 uint8_t input_zero_point,
86 uint8_t kernel_zero_point,
87 const std::vector<uint8_t>& input,
88 const std::vector<uint8_t>& filter,
89 std::vector<int32_t>& accumulators,
90 bool has_bias,
91 const std::vector<int32_t>& bias);
92
93void compute_convolution_qu8_reference_results(
94 size_t batch_size,
95 size_t output_height,
96 size_t output_width,
97 size_t input_height,
98 size_t input_width,
99 size_t input_padding_top,
100 size_t input_padding_right,
101 size_t input_padding_bottom,
102 size_t input_padding_left,
103 size_t kernel_height,
104 size_t kernel_width,
105 size_t subsampling_height,
106 size_t subsampling_width,
107 size_t dilation_height,
108 size_t dilation_width,
109 size_t groups,
110 size_t group_input_channels,
111 size_t group_output_channels,
112 size_t input_channel_stride,
113 uint8_t input_zero_point,
114 uint8_t kernel_zero_point,
115 const std::vector<uint8_t>& input,
116 const std::vector<uint8_t>& filter,
117 std::vector<int32_t>& accumulators,
118 bool has_bias,
119 const std::vector<int32_t>& bias);
120
121void compute_depthwise_convolution_qs8_reference_results(
122 size_t batch_size,
123 size_t output_height,
124 size_t output_width,
125 size_t input_height,
126 size_t input_width,
127 size_t input_padding_top,
128 size_t input_padding_right,
129 size_t input_padding_bottom,
130 size_t input_padding_left,
131 size_t kernel_height,
132 size_t kernel_width,
133 size_t subsampling_height,
134 size_t subsampling_width,
135 size_t dilation_height,
136 size_t dilation_width,
137 size_t input_channels,
138 size_t depth_multiplier,
139 size_t input_channel_stride,
140 int8_t input_zero_point,
141 const std::vector<int8_t>& input,
142 const std::vector<int8_t>& filter,
143 std::vector<int32_t>& accumulators,
144 bool has_bias,
145 const std::vector<int32_t>& bias);
146
147void compute_depthwise_convolution_qs8_reference_results(
148 size_t batch_size,
149 size_t output_height,
150 size_t output_width,
151 size_t input_height,
152 size_t input_width,
153 size_t input_padding_top,
154 size_t input_padding_right,
155 size_t input_padding_bottom,
156 size_t input_padding_left,
157 size_t kernel_height,
158 size_t kernel_width,
159 size_t subsampling_height,
160 size_t subsampling_width,
161 size_t dilation_height,
162 size_t dilation_width,
163 size_t input_channels,
164 size_t depth_multiplier,
165 int8_t input_zero_point,
166 const std::vector<int8_t>& input,
167 const std::vector<int8_t>& filter,
168 std::vector<int32_t>& accumulators,
169 bool has_bias,
170 const std::vector<int32_t>& bias);
171
172void compute_depthwise_convolution_qu8_reference_results(
173 size_t batch_size,
174 size_t output_height,
175 size_t output_width,
176 size_t input_height,
177 size_t input_width,
178 size_t input_padding_top,
179 size_t input_padding_right,
180 size_t input_padding_bottom,
181 size_t input_padding_left,
182 size_t kernel_height,
183 size_t kernel_width,
184 size_t subsampling_height,
185 size_t subsampling_width,
186 size_t dilation_height,
187 size_t dilation_width,
188 size_t input_channels,
189 size_t depth_multiplier,
190 size_t input_channel_stride,
191 uint8_t input_zero_point,
192 uint8_t kernel_zero_point,
193 const std::vector<uint8_t>& input,
194 const std::vector<uint8_t>& filter,
195 std::vector<int32_t>& accumulators,
196 bool has_bias,
197 const std::vector<int32_t>& bias);
198
199void compute_depthwise_convolution_qu8_reference_results(
200 size_t batch_size,
201 size_t output_height,
202 size_t output_width,
203 size_t input_height,
204 size_t input_width,
205 size_t input_padding_top,
206 size_t input_padding_right,
207 size_t input_padding_bottom,
208 size_t input_padding_left,
209 size_t kernel_height,
210 size_t kernel_width,
211 size_t subsampling_height,
212 size_t subsampling_width,
213 size_t dilation_height,
214 size_t dilation_width,
215 size_t input_channels,
216 size_t depth_multiplier,
217 uint8_t input_zero_point,
218 uint8_t kernel_zero_point,
219 const std::vector<uint8_t>& input,
220 const std::vector<uint8_t>& filter,
221 std::vector<int32_t>& accumulators,
222 bool has_bias,
223 const std::vector<int32_t>& bias);
224} // namespace xnnpack
225