1 // Auto-generated file. Do not edit!
2 // Template: src/qs8-dwconv/unipass-scalar.c.in
3 // Generator: tools/xngen
4 //
5 // Copyright 2021 Google LLC
6 //
7 // This source code is licensed under the BSD-style license found in the
8 // LICENSE file in the root directory of this source tree.
9
10 #include <assert.h>
11 #include <math.h>
12
13 #include <xnnpack/dwconv.h>
14 #include <xnnpack/math.h>
15
16
xnn_qc8_dwconv_minmax_fp32_ukernel_up4x25__scalar_lrintf(size_t channels,size_t output_width,const int8_t ** input,const void * weights,int8_t * output,size_t input_stride,size_t output_increment,size_t input_offset,const int8_t * zero,const union xnn_qc8_conv_minmax_params params[restrict XNN_MIN_ELEMENTS (1)])17 void xnn_qc8_dwconv_minmax_fp32_ukernel_up4x25__scalar_lrintf(
18 size_t channels,
19 size_t output_width,
20 const int8_t** input,
21 const void* weights,
22 int8_t* output,
23 size_t input_stride,
24 size_t output_increment,
25 size_t input_offset,
26 const int8_t* zero,
27 const union xnn_qc8_conv_minmax_params params[restrict XNN_MIN_ELEMENTS(1)])
28 {
29 assert(channels != 0);
30 assert(output_width != 0);
31
32 const float voutput_min_less_zero_point = params->fp32_scalar_lrintf.output_min_less_zero_point;
33 const float voutput_max_less_zero_point = params->fp32_scalar_lrintf.output_max_less_zero_point;
34 const int32_t voutput_zero_point = params->fp32_scalar_lrintf.output_zero_point;
35 do {
36 const int8_t* i0 = input[0];
37 assert(i0 != NULL);
38 if XNN_UNPREDICTABLE(i0 != zero) {
39 i0 = (const int8_t*) ((uintptr_t) i0 + input_offset);
40 }
41 const int8_t* i1 = input[1];
42 assert(i1 != NULL);
43 if XNN_UNPREDICTABLE(i1 != zero) {
44 i1 = (const int8_t*) ((uintptr_t) i1 + input_offset);
45 }
46 const int8_t* i2 = input[2];
47 assert(i2 != NULL);
48 if XNN_UNPREDICTABLE(i2 != zero) {
49 i2 = (const int8_t*) ((uintptr_t) i2 + input_offset);
50 }
51 const int8_t* i3 = input[3];
52 assert(i3 != NULL);
53 if XNN_UNPREDICTABLE(i3 != zero) {
54 i3 = (const int8_t*) ((uintptr_t) i3 + input_offset);
55 }
56 const int8_t* i4 = input[4];
57 assert(i4 != NULL);
58 if XNN_UNPREDICTABLE(i4 != zero) {
59 i4 = (const int8_t*) ((uintptr_t) i4 + input_offset);
60 }
61 const int8_t* i5 = input[5];
62 assert(i5 != NULL);
63 if XNN_UNPREDICTABLE(i5 != zero) {
64 i5 = (const int8_t*) ((uintptr_t) i5 + input_offset);
65 }
66 const int8_t* i6 = input[6];
67 assert(i6 != NULL);
68 if XNN_UNPREDICTABLE(i6 != zero) {
69 i6 = (const int8_t*) ((uintptr_t) i6 + input_offset);
70 }
71 const int8_t* i7 = input[7];
72 assert(i7 != NULL);
73 if XNN_UNPREDICTABLE(i7 != zero) {
74 i7 = (const int8_t*) ((uintptr_t) i7 + input_offset);
75 }
76 const int8_t* i8 = input[8];
77 assert(i8 != NULL);
78 if XNN_UNPREDICTABLE(i8 != zero) {
79 i8 = (const int8_t*) ((uintptr_t) i8 + input_offset);
80 }
81 const int8_t* i9 = input[9];
82 assert(i9 != NULL);
83 if XNN_UNPREDICTABLE(i9 != zero) {
84 i9 = (const int8_t*) ((uintptr_t) i9 + input_offset);
85 }
86 const int8_t* i10 = input[10];
87 assert(i10 != NULL);
88 if XNN_UNPREDICTABLE(i10 != zero) {
89 i10 = (const int8_t*) ((uintptr_t) i10 + input_offset);
90 }
91 const int8_t* i11 = input[11];
92 assert(i11 != NULL);
93 if XNN_UNPREDICTABLE(i11 != zero) {
94 i11 = (const int8_t*) ((uintptr_t) i11 + input_offset);
95 }
96 const int8_t* i12 = input[12];
97 assert(i12 != NULL);
98 if XNN_UNPREDICTABLE(i12 != zero) {
99 i12 = (const int8_t*) ((uintptr_t) i12 + input_offset);
100 }
101 const int8_t* i13 = input[13];
102 assert(i13 != NULL);
103 if XNN_UNPREDICTABLE(i13 != zero) {
104 i13 = (const int8_t*) ((uintptr_t) i13 + input_offset);
105 }
106 const int8_t* i14 = input[14];
107 assert(i14 != NULL);
108 if XNN_UNPREDICTABLE(i14 != zero) {
109 i14 = (const int8_t*) ((uintptr_t) i14 + input_offset);
110 }
111 const int8_t* i15 = input[15];
112 assert(i15 != NULL);
113 if XNN_UNPREDICTABLE(i15 != zero) {
114 i15 = (const int8_t*) ((uintptr_t) i15 + input_offset);
115 }
116 const int8_t* i16 = input[16];
117 assert(i16 != NULL);
118 if XNN_UNPREDICTABLE(i16 != zero) {
119 i16 = (const int8_t*) ((uintptr_t) i16 + input_offset);
120 }
121 const int8_t* i17 = input[17];
122 assert(i17 != NULL);
123 if XNN_UNPREDICTABLE(i17 != zero) {
124 i17 = (const int8_t*) ((uintptr_t) i17 + input_offset);
125 }
126 const int8_t* i18 = input[18];
127 assert(i18 != NULL);
128 if XNN_UNPREDICTABLE(i18 != zero) {
129 i18 = (const int8_t*) ((uintptr_t) i18 + input_offset);
130 }
131 const int8_t* i19 = input[19];
132 assert(i19 != NULL);
133 if XNN_UNPREDICTABLE(i19 != zero) {
134 i19 = (const int8_t*) ((uintptr_t) i19 + input_offset);
135 }
136 const int8_t* i20 = input[20];
137 assert(i20 != NULL);
138 if XNN_UNPREDICTABLE(i20 != zero) {
139 i20 = (const int8_t*) ((uintptr_t) i20 + input_offset);
140 }
141 const int8_t* i21 = input[21];
142 assert(i21 != NULL);
143 if XNN_UNPREDICTABLE(i21 != zero) {
144 i21 = (const int8_t*) ((uintptr_t) i21 + input_offset);
145 }
146 const int8_t* i22 = input[22];
147 assert(i22 != NULL);
148 if XNN_UNPREDICTABLE(i22 != zero) {
149 i22 = (const int8_t*) ((uintptr_t) i22 + input_offset);
150 }
151 const int8_t* i23 = input[23];
152 assert(i23 != NULL);
153 if XNN_UNPREDICTABLE(i23 != zero) {
154 i23 = (const int8_t*) ((uintptr_t) i23 + input_offset);
155 }
156 const int8_t* i24 = input[24];
157 assert(i24 != NULL);
158 if XNN_UNPREDICTABLE(i24 != zero) {
159 i24 = (const int8_t*) ((uintptr_t) i24 + input_offset);
160 }
161 input = (const int8_t**) ((uintptr_t) input + input_stride);
162
163 size_t c = channels;
164 const void* w = weights;
165 for (; c >= 4; c -= 4) {
166 int32_t vacc0 = ((const int32_t*) w)[0];
167 int32_t vacc1 = ((const int32_t*) w)[1];
168 int32_t vacc2 = ((const int32_t*) w)[2];
169 int32_t vacc3 = ((const int32_t*) w)[3];
170
171
172 const int32_t vi0x0 = (int32_t) i0[0];
173 const int32_t vi0x1 = (int32_t) i0[1];
174 const int32_t vi0x2 = (int32_t) i0[2];
175 const int32_t vi0x3 = (int32_t) i0[3];
176 i0 += 4;
177
178 const int32_t vk0x0 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[0];
179 const int32_t vk0x1 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[1];
180 const int32_t vk0x2 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[2];
181 const int32_t vk0x3 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[3];
182
183 vacc0 += vi0x0 * vk0x0;
184 vacc1 += vi0x1 * vk0x1;
185 vacc2 += vi0x2 * vk0x2;
186 vacc3 += vi0x3 * vk0x3;
187
188 const int32_t vi1x0 = (int32_t) i1[0];
189 const int32_t vi1x1 = (int32_t) i1[1];
190 const int32_t vi1x2 = (int32_t) i1[2];
191 const int32_t vi1x3 = (int32_t) i1[3];
192 i1 += 4;
193
194 const int32_t vk1x0 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[4];
195 const int32_t vk1x1 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[5];
196 const int32_t vk1x2 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[6];
197 const int32_t vk1x3 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[7];
198
199 vacc0 += vi1x0 * vk1x0;
200 vacc1 += vi1x1 * vk1x1;
201 vacc2 += vi1x2 * vk1x2;
202 vacc3 += vi1x3 * vk1x3;
203
204 const int32_t vi2x0 = (int32_t) i2[0];
205 const int32_t vi2x1 = (int32_t) i2[1];
206 const int32_t vi2x2 = (int32_t) i2[2];
207 const int32_t vi2x3 = (int32_t) i2[3];
208 i2 += 4;
209
210 const int32_t vk2x0 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[8];
211 const int32_t vk2x1 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[9];
212 const int32_t vk2x2 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[10];
213 const int32_t vk2x3 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[11];
214
215 vacc0 += vi2x0 * vk2x0;
216 vacc1 += vi2x1 * vk2x1;
217 vacc2 += vi2x2 * vk2x2;
218 vacc3 += vi2x3 * vk2x3;
219
220 const int32_t vi3x0 = (int32_t) i3[0];
221 const int32_t vi3x1 = (int32_t) i3[1];
222 const int32_t vi3x2 = (int32_t) i3[2];
223 const int32_t vi3x3 = (int32_t) i3[3];
224 i3 += 4;
225
226 const int32_t vk3x0 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[12];
227 const int32_t vk3x1 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[13];
228 const int32_t vk3x2 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[14];
229 const int32_t vk3x3 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[15];
230
231 vacc0 += vi3x0 * vk3x0;
232 vacc1 += vi3x1 * vk3x1;
233 vacc2 += vi3x2 * vk3x2;
234 vacc3 += vi3x3 * vk3x3;
235
236 const int32_t vi4x0 = (int32_t) i4[0];
237 const int32_t vi4x1 = (int32_t) i4[1];
238 const int32_t vi4x2 = (int32_t) i4[2];
239 const int32_t vi4x3 = (int32_t) i4[3];
240 i4 += 4;
241
242 const int32_t vk4x0 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[16];
243 const int32_t vk4x1 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[17];
244 const int32_t vk4x2 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[18];
245 const int32_t vk4x3 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[19];
246
247 vacc0 += vi4x0 * vk4x0;
248 vacc1 += vi4x1 * vk4x1;
249 vacc2 += vi4x2 * vk4x2;
250 vacc3 += vi4x3 * vk4x3;
251
252 const int32_t vi5x0 = (int32_t) i5[0];
253 const int32_t vi5x1 = (int32_t) i5[1];
254 const int32_t vi5x2 = (int32_t) i5[2];
255 const int32_t vi5x3 = (int32_t) i5[3];
256 i5 += 4;
257
258 const int32_t vk5x0 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[20];
259 const int32_t vk5x1 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[21];
260 const int32_t vk5x2 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[22];
261 const int32_t vk5x3 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[23];
262
263 vacc0 += vi5x0 * vk5x0;
264 vacc1 += vi5x1 * vk5x1;
265 vacc2 += vi5x2 * vk5x2;
266 vacc3 += vi5x3 * vk5x3;
267
268 const int32_t vi6x0 = (int32_t) i6[0];
269 const int32_t vi6x1 = (int32_t) i6[1];
270 const int32_t vi6x2 = (int32_t) i6[2];
271 const int32_t vi6x3 = (int32_t) i6[3];
272 i6 += 4;
273
274 const int32_t vk6x0 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[24];
275 const int32_t vk6x1 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[25];
276 const int32_t vk6x2 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[26];
277 const int32_t vk6x3 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[27];
278
279 vacc0 += vi6x0 * vk6x0;
280 vacc1 += vi6x1 * vk6x1;
281 vacc2 += vi6x2 * vk6x2;
282 vacc3 += vi6x3 * vk6x3;
283
284 const int32_t vi7x0 = (int32_t) i7[0];
285 const int32_t vi7x1 = (int32_t) i7[1];
286 const int32_t vi7x2 = (int32_t) i7[2];
287 const int32_t vi7x3 = (int32_t) i7[3];
288 i7 += 4;
289
290 const int32_t vk7x0 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[28];
291 const int32_t vk7x1 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[29];
292 const int32_t vk7x2 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[30];
293 const int32_t vk7x3 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[31];
294
295 vacc0 += vi7x0 * vk7x0;
296 vacc1 += vi7x1 * vk7x1;
297 vacc2 += vi7x2 * vk7x2;
298 vacc3 += vi7x3 * vk7x3;
299
300 const int32_t vi8x0 = (int32_t) i8[0];
301 const int32_t vi8x1 = (int32_t) i8[1];
302 const int32_t vi8x2 = (int32_t) i8[2];
303 const int32_t vi8x3 = (int32_t) i8[3];
304 i8 += 4;
305
306 const int32_t vk8x0 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[32];
307 const int32_t vk8x1 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[33];
308 const int32_t vk8x2 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[34];
309 const int32_t vk8x3 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[35];
310
311 vacc0 += vi8x0 * vk8x0;
312 vacc1 += vi8x1 * vk8x1;
313 vacc2 += vi8x2 * vk8x2;
314 vacc3 += vi8x3 * vk8x3;
315
316 const int32_t vi9x0 = (int32_t) i9[0];
317 const int32_t vi9x1 = (int32_t) i9[1];
318 const int32_t vi9x2 = (int32_t) i9[2];
319 const int32_t vi9x3 = (int32_t) i9[3];
320 i9 += 4;
321
322 const int32_t vk9x0 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[36];
323 const int32_t vk9x1 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[37];
324 const int32_t vk9x2 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[38];
325 const int32_t vk9x3 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[39];
326
327 vacc0 += vi9x0 * vk9x0;
328 vacc1 += vi9x1 * vk9x1;
329 vacc2 += vi9x2 * vk9x2;
330 vacc3 += vi9x3 * vk9x3;
331
332 const int32_t vi10x0 = (int32_t) i10[0];
333 const int32_t vi10x1 = (int32_t) i10[1];
334 const int32_t vi10x2 = (int32_t) i10[2];
335 const int32_t vi10x3 = (int32_t) i10[3];
336 i10 += 4;
337
338 const int32_t vk10x0 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[40];
339 const int32_t vk10x1 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[41];
340 const int32_t vk10x2 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[42];
341 const int32_t vk10x3 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[43];
342
343 vacc0 += vi10x0 * vk10x0;
344 vacc1 += vi10x1 * vk10x1;
345 vacc2 += vi10x2 * vk10x2;
346 vacc3 += vi10x3 * vk10x3;
347
348 const int32_t vi11x0 = (int32_t) i11[0];
349 const int32_t vi11x1 = (int32_t) i11[1];
350 const int32_t vi11x2 = (int32_t) i11[2];
351 const int32_t vi11x3 = (int32_t) i11[3];
352 i11 += 4;
353
354 const int32_t vk11x0 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[44];
355 const int32_t vk11x1 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[45];
356 const int32_t vk11x2 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[46];
357 const int32_t vk11x3 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[47];
358
359 vacc0 += vi11x0 * vk11x0;
360 vacc1 += vi11x1 * vk11x1;
361 vacc2 += vi11x2 * vk11x2;
362 vacc3 += vi11x3 * vk11x3;
363
364 const int32_t vi12x0 = (int32_t) i12[0];
365 const int32_t vi12x1 = (int32_t) i12[1];
366 const int32_t vi12x2 = (int32_t) i12[2];
367 const int32_t vi12x3 = (int32_t) i12[3];
368 i12 += 4;
369
370 const int32_t vk12x0 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[48];
371 const int32_t vk12x1 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[49];
372 const int32_t vk12x2 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[50];
373 const int32_t vk12x3 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[51];
374
375 vacc0 += vi12x0 * vk12x0;
376 vacc1 += vi12x1 * vk12x1;
377 vacc2 += vi12x2 * vk12x2;
378 vacc3 += vi12x3 * vk12x3;
379
380 const int32_t vi13x0 = (int32_t) i13[0];
381 const int32_t vi13x1 = (int32_t) i13[1];
382 const int32_t vi13x2 = (int32_t) i13[2];
383 const int32_t vi13x3 = (int32_t) i13[3];
384 i13 += 4;
385
386 const int32_t vk13x0 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[52];
387 const int32_t vk13x1 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[53];
388 const int32_t vk13x2 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[54];
389 const int32_t vk13x3 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[55];
390
391 vacc0 += vi13x0 * vk13x0;
392 vacc1 += vi13x1 * vk13x1;
393 vacc2 += vi13x2 * vk13x2;
394 vacc3 += vi13x3 * vk13x3;
395
396 const int32_t vi14x0 = (int32_t) i14[0];
397 const int32_t vi14x1 = (int32_t) i14[1];
398 const int32_t vi14x2 = (int32_t) i14[2];
399 const int32_t vi14x3 = (int32_t) i14[3];
400 i14 += 4;
401
402 const int32_t vk14x0 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[56];
403 const int32_t vk14x1 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[57];
404 const int32_t vk14x2 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[58];
405 const int32_t vk14x3 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[59];
406
407 vacc0 += vi14x0 * vk14x0;
408 vacc1 += vi14x1 * vk14x1;
409 vacc2 += vi14x2 * vk14x2;
410 vacc3 += vi14x3 * vk14x3;
411
412 const int32_t vi15x0 = (int32_t) i15[0];
413 const int32_t vi15x1 = (int32_t) i15[1];
414 const int32_t vi15x2 = (int32_t) i15[2];
415 const int32_t vi15x3 = (int32_t) i15[3];
416 i15 += 4;
417
418 const int32_t vk15x0 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[60];
419 const int32_t vk15x1 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[61];
420 const int32_t vk15x2 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[62];
421 const int32_t vk15x3 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[63];
422
423 vacc0 += vi15x0 * vk15x0;
424 vacc1 += vi15x1 * vk15x1;
425 vacc2 += vi15x2 * vk15x2;
426 vacc3 += vi15x3 * vk15x3;
427
428 const int32_t vi16x0 = (int32_t) i16[0];
429 const int32_t vi16x1 = (int32_t) i16[1];
430 const int32_t vi16x2 = (int32_t) i16[2];
431 const int32_t vi16x3 = (int32_t) i16[3];
432 i16 += 4;
433
434 const int32_t vk16x0 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[64];
435 const int32_t vk16x1 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[65];
436 const int32_t vk16x2 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[66];
437 const int32_t vk16x3 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[67];
438
439 vacc0 += vi16x0 * vk16x0;
440 vacc1 += vi16x1 * vk16x1;
441 vacc2 += vi16x2 * vk16x2;
442 vacc3 += vi16x3 * vk16x3;
443
444 const int32_t vi17x0 = (int32_t) i17[0];
445 const int32_t vi17x1 = (int32_t) i17[1];
446 const int32_t vi17x2 = (int32_t) i17[2];
447 const int32_t vi17x3 = (int32_t) i17[3];
448 i17 += 4;
449
450 const int32_t vk17x0 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[68];
451 const int32_t vk17x1 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[69];
452 const int32_t vk17x2 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[70];
453 const int32_t vk17x3 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[71];
454
455 vacc0 += vi17x0 * vk17x0;
456 vacc1 += vi17x1 * vk17x1;
457 vacc2 += vi17x2 * vk17x2;
458 vacc3 += vi17x3 * vk17x3;
459
460 const int32_t vi18x0 = (int32_t) i18[0];
461 const int32_t vi18x1 = (int32_t) i18[1];
462 const int32_t vi18x2 = (int32_t) i18[2];
463 const int32_t vi18x3 = (int32_t) i18[3];
464 i18 += 4;
465
466 const int32_t vk18x0 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[72];
467 const int32_t vk18x1 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[73];
468 const int32_t vk18x2 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[74];
469 const int32_t vk18x3 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[75];
470
471 vacc0 += vi18x0 * vk18x0;
472 vacc1 += vi18x1 * vk18x1;
473 vacc2 += vi18x2 * vk18x2;
474 vacc3 += vi18x3 * vk18x3;
475
476 const int32_t vi19x0 = (int32_t) i19[0];
477 const int32_t vi19x1 = (int32_t) i19[1];
478 const int32_t vi19x2 = (int32_t) i19[2];
479 const int32_t vi19x3 = (int32_t) i19[3];
480 i19 += 4;
481
482 const int32_t vk19x0 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[76];
483 const int32_t vk19x1 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[77];
484 const int32_t vk19x2 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[78];
485 const int32_t vk19x3 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[79];
486
487 vacc0 += vi19x0 * vk19x0;
488 vacc1 += vi19x1 * vk19x1;
489 vacc2 += vi19x2 * vk19x2;
490 vacc3 += vi19x3 * vk19x3;
491
492 const int32_t vi20x0 = (int32_t) i20[0];
493 const int32_t vi20x1 = (int32_t) i20[1];
494 const int32_t vi20x2 = (int32_t) i20[2];
495 const int32_t vi20x3 = (int32_t) i20[3];
496 i20 += 4;
497
498 const int32_t vk20x0 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[80];
499 const int32_t vk20x1 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[81];
500 const int32_t vk20x2 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[82];
501 const int32_t vk20x3 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[83];
502
503 vacc0 += vi20x0 * vk20x0;
504 vacc1 += vi20x1 * vk20x1;
505 vacc2 += vi20x2 * vk20x2;
506 vacc3 += vi20x3 * vk20x3;
507
508 const int32_t vi21x0 = (int32_t) i21[0];
509 const int32_t vi21x1 = (int32_t) i21[1];
510 const int32_t vi21x2 = (int32_t) i21[2];
511 const int32_t vi21x3 = (int32_t) i21[3];
512 i21 += 4;
513
514 const int32_t vk21x0 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[84];
515 const int32_t vk21x1 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[85];
516 const int32_t vk21x2 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[86];
517 const int32_t vk21x3 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[87];
518
519 vacc0 += vi21x0 * vk21x0;
520 vacc1 += vi21x1 * vk21x1;
521 vacc2 += vi21x2 * vk21x2;
522 vacc3 += vi21x3 * vk21x3;
523
524 const int32_t vi22x0 = (int32_t) i22[0];
525 const int32_t vi22x1 = (int32_t) i22[1];
526 const int32_t vi22x2 = (int32_t) i22[2];
527 const int32_t vi22x3 = (int32_t) i22[3];
528 i22 += 4;
529
530 const int32_t vk22x0 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[88];
531 const int32_t vk22x1 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[89];
532 const int32_t vk22x2 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[90];
533 const int32_t vk22x3 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[91];
534
535 vacc0 += vi22x0 * vk22x0;
536 vacc1 += vi22x1 * vk22x1;
537 vacc2 += vi22x2 * vk22x2;
538 vacc3 += vi22x3 * vk22x3;
539
540 const int32_t vi23x0 = (int32_t) i23[0];
541 const int32_t vi23x1 = (int32_t) i23[1];
542 const int32_t vi23x2 = (int32_t) i23[2];
543 const int32_t vi23x3 = (int32_t) i23[3];
544 i23 += 4;
545
546 const int32_t vk23x0 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[92];
547 const int32_t vk23x1 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[93];
548 const int32_t vk23x2 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[94];
549 const int32_t vk23x3 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[95];
550
551 vacc0 += vi23x0 * vk23x0;
552 vacc1 += vi23x1 * vk23x1;
553 vacc2 += vi23x2 * vk23x2;
554 vacc3 += vi23x3 * vk23x3;
555
556 const int32_t vi24x0 = (int32_t) i24[0];
557 const int32_t vi24x1 = (int32_t) i24[1];
558 const int32_t vi24x2 = (int32_t) i24[2];
559 const int32_t vi24x3 = (int32_t) i24[3];
560 i24 += 4;
561
562 const int32_t vk24x0 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[96];
563 const int32_t vk24x1 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[97];
564 const int32_t vk24x2 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[98];
565 const int32_t vk24x3 = (int32_t) ((const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t)))[99];
566
567 vacc0 += vi24x0 * vk24x0;
568 vacc1 += vi24x1 * vk24x1;
569 vacc2 += vi24x2 * vk24x2;
570 vacc3 += vi24x3 * vk24x3;
571
572 w = (const void*) ((uintptr_t) w + 4 * sizeof(int32_t) + 100 * sizeof(int8_t));
573
574 float vfpacc0 = (float) vacc0;
575 float vfpacc1 = (float) vacc1;
576 float vfpacc2 = (float) vacc2;
577 float vfpacc3 = (float) vacc3;
578
579 const float vscale0 = ((const float*) w)[0];
580 const float vscale1 = ((const float*) w)[1];
581 const float vscale2 = ((const float*) w)[2];
582 const float vscale3 = ((const float*) w)[3];
583 w = (const void*) ((const float*) w + 4);
584
585 vfpacc0 *= vscale0;
586 vfpacc1 *= vscale1;
587 vfpacc2 *= vscale2;
588 vfpacc3 *= vscale3;
589
590 vfpacc0 = math_max_f32(vfpacc0, voutput_min_less_zero_point);
591 vfpacc1 = math_max_f32(vfpacc1, voutput_min_less_zero_point);
592 vfpacc2 = math_max_f32(vfpacc2, voutput_min_less_zero_point);
593 vfpacc3 = math_max_f32(vfpacc3, voutput_min_less_zero_point);
594
595 vfpacc0 = math_min_f32(vfpacc0, voutput_max_less_zero_point);
596 vfpacc1 = math_min_f32(vfpacc1, voutput_max_less_zero_point);
597 vfpacc2 = math_min_f32(vfpacc2, voutput_max_less_zero_point);
598 vfpacc3 = math_min_f32(vfpacc3, voutput_max_less_zero_point);
599
600 const int32_t vrndacc0 = (int32_t) lrintf(vfpacc0);
601 const int32_t vrndacc1 = (int32_t) lrintf(vfpacc1);
602 const int32_t vrndacc2 = (int32_t) lrintf(vfpacc2);
603 const int32_t vrndacc3 = (int32_t) lrintf(vfpacc3);
604
605 int32_t vout0 = (int32_t) vrndacc0 + voutput_zero_point;
606 int32_t vout1 = (int32_t) vrndacc1 + voutput_zero_point;
607 int32_t vout2 = (int32_t) vrndacc2 + voutput_zero_point;
608 int32_t vout3 = (int32_t) vrndacc3 + voutput_zero_point;
609
610 output[0] = (int8_t) vout0;
611 output[1] = (int8_t) vout1;
612 output[2] = (int8_t) vout2;
613 output[3] = (int8_t) vout3;
614 output += 4;
615 }
616 if XNN_UNLIKELY(c != 0) {
617 const int8_t* k = (const int8_t*) ((uintptr_t) w + 4 * sizeof(int32_t));
618 do {
619 int32_t vacc = *((const int32_t*) w);
620 w = (const void*) ((uintptr_t) w + sizeof(int32_t));
621
622 const int32_t vi0 = (int32_t) *i0++;
623 const int32_t vk0 = (int32_t) k[0];
624 vacc += vi0 * vk0;
625 const int32_t vi1 = (int32_t) *i1++;
626 const int32_t vk1 = (int32_t) k[4];
627 vacc += vi1 * vk1;
628 const int32_t vi2 = (int32_t) *i2++;
629 const int32_t vk2 = (int32_t) k[8];
630 vacc += vi2 * vk2;
631 const int32_t vi3 = (int32_t) *i3++;
632 const int32_t vk3 = (int32_t) k[12];
633 vacc += vi3 * vk3;
634 const int32_t vi4 = (int32_t) *i4++;
635 const int32_t vk4 = (int32_t) k[16];
636 vacc += vi4 * vk4;
637 const int32_t vi5 = (int32_t) *i5++;
638 const int32_t vk5 = (int32_t) k[20];
639 vacc += vi5 * vk5;
640 const int32_t vi6 = (int32_t) *i6++;
641 const int32_t vk6 = (int32_t) k[24];
642 vacc += vi6 * vk6;
643 const int32_t vi7 = (int32_t) *i7++;
644 const int32_t vk7 = (int32_t) k[28];
645 vacc += vi7 * vk7;
646 const int32_t vi8 = (int32_t) *i8++;
647 const int32_t vk8 = (int32_t) k[32];
648 vacc += vi8 * vk8;
649 const int32_t vi9 = (int32_t) *i9++;
650 const int32_t vk9 = (int32_t) k[36];
651 vacc += vi9 * vk9;
652 const int32_t vi10 = (int32_t) *i10++;
653 const int32_t vk10 = (int32_t) k[40];
654 vacc += vi10 * vk10;
655 const int32_t vi11 = (int32_t) *i11++;
656 const int32_t vk11 = (int32_t) k[44];
657 vacc += vi11 * vk11;
658 const int32_t vi12 = (int32_t) *i12++;
659 const int32_t vk12 = (int32_t) k[48];
660 vacc += vi12 * vk12;
661 const int32_t vi13 = (int32_t) *i13++;
662 const int32_t vk13 = (int32_t) k[52];
663 vacc += vi13 * vk13;
664 const int32_t vi14 = (int32_t) *i14++;
665 const int32_t vk14 = (int32_t) k[56];
666 vacc += vi14 * vk14;
667 const int32_t vi15 = (int32_t) *i15++;
668 const int32_t vk15 = (int32_t) k[60];
669 vacc += vi15 * vk15;
670 const int32_t vi16 = (int32_t) *i16++;
671 const int32_t vk16 = (int32_t) k[64];
672 vacc += vi16 * vk16;
673 const int32_t vi17 = (int32_t) *i17++;
674 const int32_t vk17 = (int32_t) k[68];
675 vacc += vi17 * vk17;
676 const int32_t vi18 = (int32_t) *i18++;
677 const int32_t vk18 = (int32_t) k[72];
678 vacc += vi18 * vk18;
679 const int32_t vi19 = (int32_t) *i19++;
680 const int32_t vk19 = (int32_t) k[76];
681 vacc += vi19 * vk19;
682 const int32_t vi20 = (int32_t) *i20++;
683 const int32_t vk20 = (int32_t) k[80];
684 vacc += vi20 * vk20;
685 const int32_t vi21 = (int32_t) *i21++;
686 const int32_t vk21 = (int32_t) k[84];
687 vacc += vi21 * vk21;
688 const int32_t vi22 = (int32_t) *i22++;
689 const int32_t vk22 = (int32_t) k[88];
690 vacc += vi22 * vk22;
691 const int32_t vi23 = (int32_t) *i23++;
692 const int32_t vk23 = (int32_t) k[92];
693 vacc += vi23 * vk23;
694 const int32_t vi24 = (int32_t) *i24++;
695 const int32_t vk24 = (int32_t) k[96];
696 vacc += vi24 * vk24;
697 k += 1;
698
699 const float vscale = *((const float*) ((uintptr_t) w + 3 * sizeof(int32_t) + 100 * sizeof(int8_t)));
700 float vfpacc = (float) vacc * vscale;
701
702 vfpacc = math_max_f32(vfpacc, voutput_min_less_zero_point);
703 vfpacc = math_min_f32(vfpacc, voutput_max_less_zero_point);
704 const int32_t vrndacc = (int32_t) lrintf(vfpacc);
705 int32_t vout = vrndacc + voutput_zero_point;
706
707 *output++ = (int8_t) vout;
708 } while (--c != 0);
709 }
710
711 output = (int8_t*) ((uintptr_t) output + output_increment);
712 } while (--output_width != 0);
713 }
714