Debian Codegraph @

src/qd8-f32-qc8w-igemm/gen/qd8-f32-qc8w-igemm-6x32c4-minmax-neondot.c

raw
1 // Auto-generated file. Do not edit!
2 // Template: src/qs8-igemm/c4-neondot.c.in
3 // Generator: tools/xngen
4 //
5 // Copyright 2020 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
12 #include <arm_neon.h>
13
14 #include "xnnpack/igemm.h"
15 #include "xnnpack/math.h"
16
17
18 void xnn_qd8_f32_qc8w_igemm_minmax_ukernel_6x32c4__neondot(
19 size_t mr,
20 size_t nc,
21 size_t kc,
22 size_t ks,
23 const int8_t** restrict a,
24 const void* restrict w,
25 float* restrict c,
26 size_t cm_stride,
27 size_t cn_stride,
28 size_t a_offset,
29 const int8_t* zero,
30 const int8_t* zero_data,
31 const union xnn_f32_minmax_params params[restrict XNN_MIN_ELEMENTS(1)],
32 const struct xnn_qd8_quantization_params quantization_params[restrict XNN_MIN_ELEMENTS(1)]) XNN_OOB_READS
33 {
34 assert(mr != 0);
35 assert(mr <= 6);
36 assert(nc != 0);
37 assert(kc != 0);
38 assert(ks != 0);
39 assert(ks % (6 * sizeof(void*)) == 0);
40 assert(a_offset % sizeof(int8_t) == 0);
41 assert(a != NULL);
42 assert(w != NULL);
43 assert(c != NULL);
44
45 kc = round_up_po2(kc, 4 * sizeof(int8_t));
46 float* c0 = c;
47 float* c1 = (float*) ((uintptr_t) c0 + cm_stride);
48 if XNN_UNPREDICTABLE(mr < 2) {
49 c1 = c0;
50 }
51 float* c2 = (float*) ((uintptr_t) c1 + cm_stride);
52 if XNN_UNPREDICTABLE(mr <= 2) {
53 c2 = c1;
54 }
55 float* c3 = (float*) ((uintptr_t) c2 + cm_stride);
56 if XNN_UNPREDICTABLE(mr < 4) {
57 c3 = c2;
58 }
59 float* c4 = (float*) ((uintptr_t) c3 + cm_stride);
60 if XNN_UNPREDICTABLE(mr <= 4) {
61 c4 = c3;
62 }
63 float* c5 = (float*) ((uintptr_t) c4 + cm_stride);
64 if XNN_UNPREDICTABLE(mr != 6) {
65 c5 = c4;
66 }
67
68 do {
69 const int32x4_t vinput_zero_point = vld1q_dup_s32(&quantization_params->zero_point);
70 const int32x4_t vksum0123 = vld1q_s32(w); w = (const int32_t*) w + 4;
71 int32x4_t vacc0x0123 = vmulq_s32(vksum0123, vinput_zero_point);
72 const int32x4_t vksum4567 = vld1q_s32(w); w = (const int32_t*) w + 4;
73 int32x4_t vacc0x4567 = vmulq_s32(vksum4567, vinput_zero_point);
74 const int32x4_t vksum89AB = vld1q_s32(w); w = (const int32_t*) w + 4;
75 int32x4_t vacc0x89AB = vmulq_s32(vksum89AB, vinput_zero_point);
76 const int32x4_t vksumCDEF = vld1q_s32(w); w = (const int32_t*) w + 4;
77 int32x4_t vacc0xCDEF = vmulq_s32(vksumCDEF, vinput_zero_point);
78 const int32x4_t vksumGHIJ = vld1q_s32(w); w = (const int32_t*) w + 4;
79 int32x4_t vacc0xGHIJ = vmulq_s32(vksumGHIJ, vinput_zero_point);
80 const int32x4_t vksumKLMN = vld1q_s32(w); w = (const int32_t*) w + 4;
81 int32x4_t vacc0xKLMN = vmulq_s32(vksumKLMN, vinput_zero_point);
82 const int32x4_t vksumOPQR = vld1q_s32(w); w = (const int32_t*) w + 4;
83 int32x4_t vacc0xOPQR = vmulq_s32(vksumOPQR, vinput_zero_point);
84 const int32x4_t vksumSTUV = vld1q_s32(w); w = (const int32_t*) w + 4;
85 int32x4_t vacc0xSTUV = vmulq_s32(vksumSTUV, vinput_zero_point);
86 int32x4_t vacc1x0123 = vacc0x0123;
87 int32x4_t vacc1x4567 = vacc0x4567;
88 int32x4_t vacc1x89AB = vacc0x89AB;
89 int32x4_t vacc1xCDEF = vacc0xCDEF;
90 int32x4_t vacc1xGHIJ = vacc0xGHIJ;
91 int32x4_t vacc1xKLMN = vacc0xKLMN;
92 int32x4_t vacc1xOPQR = vacc0xOPQR;
93 int32x4_t vacc1xSTUV = vacc0xSTUV;
94 int32x4_t vacc2x0123 = vacc0x0123;
95 int32x4_t vacc2x4567 = vacc0x4567;
96 int32x4_t vacc2x89AB = vacc0x89AB;
97 int32x4_t vacc2xCDEF = vacc0xCDEF;
98 int32x4_t vacc2xGHIJ = vacc0xGHIJ;
99 int32x4_t vacc2xKLMN = vacc0xKLMN;
100 int32x4_t vacc2xOPQR = vacc0xOPQR;
101 int32x4_t vacc2xSTUV = vacc0xSTUV;
102 int32x4_t vacc3x0123 = vacc0x0123;
103 int32x4_t vacc3x4567 = vacc0x4567;
104 int32x4_t vacc3x89AB = vacc0x89AB;
105 int32x4_t vacc3xCDEF = vacc0xCDEF;
106 int32x4_t vacc3xGHIJ = vacc0xGHIJ;
107 int32x4_t vacc3xKLMN = vacc0xKLMN;
108 int32x4_t vacc3xOPQR = vacc0xOPQR;
109 int32x4_t vacc3xSTUV = vacc0xSTUV;
110 int32x4_t vacc4x0123 = vacc0x0123;
111 int32x4_t vacc4x4567 = vacc0x4567;
112 int32x4_t vacc4x89AB = vacc0x89AB;
113 int32x4_t vacc4xCDEF = vacc0xCDEF;
114 int32x4_t vacc4xGHIJ = vacc0xGHIJ;
115 int32x4_t vacc4xKLMN = vacc0xKLMN;
116 int32x4_t vacc4xOPQR = vacc0xOPQR;
117 int32x4_t vacc4xSTUV = vacc0xSTUV;
118 int32x4_t vacc5x0123 = vacc0x0123;
119 int32x4_t vacc5x4567 = vacc0x4567;
120 int32x4_t vacc5x89AB = vacc0x89AB;
121 int32x4_t vacc5xCDEF = vacc0xCDEF;
122 int32x4_t vacc5xGHIJ = vacc0xGHIJ;
123 int32x4_t vacc5xKLMN = vacc0xKLMN;
124 int32x4_t vacc5xOPQR = vacc0xOPQR;
125 int32x4_t vacc5xSTUV = vacc0xSTUV;
126
127 size_t p = ks;
128 do {
129 const int8_t* restrict a0 = a[0];
130 if XNN_UNPREDICTABLE(a0 != zero) {
131 a0 = (const int8_t*) ((uintptr_t) a0 + a_offset);
132 } else {
133 a0 = zero_data;
134 }
135 const int8_t* restrict a1 = a[1];
136 if XNN_UNPREDICTABLE(a1 != zero) {
137 a1 = (const int8_t*) ((uintptr_t) a1 + a_offset);
138 } else {
139 a1 = zero_data;
140 }
141 const int8_t* restrict a2 = a[2];
142 if XNN_UNPREDICTABLE(a2 != zero) {
143 a2 = (const int8_t*) ((uintptr_t) a2 + a_offset);
144 } else {
145 a2 = zero_data;
146 }
147 const int8_t* restrict a3 = a[3];
148 if XNN_UNPREDICTABLE(a3 != zero) {
149 a3 = (const int8_t*) ((uintptr_t) a3 + a_offset);
150 } else {
151 a3 = zero_data;
152 }
153 const int8_t* restrict a4 = a[4];
154 if XNN_UNPREDICTABLE(a4 != zero) {
155 a4 = (const int8_t*) ((uintptr_t) a4 + a_offset);
156 } else {
157 a4 = zero_data;
158 }
159 const int8_t* restrict a5 = a[5];
160 if XNN_UNPREDICTABLE(a5 != zero) {
161 a5 = (const int8_t*) ((uintptr_t) a5 + a_offset);
162 } else {
163 a5 = zero_data;
164 }
165 a += 6;
166
167 // Inner accumulation loop along the 32 columns.
168 size_t k = kc;
169 // 2x partial unrolled loop to load 8 bytes at a time.
170 while (k >= 8 * sizeof(int8_t)) {
171 // Load a 6x8 block of activations.
172 const int8x8_t va0x01234567 = vld1_s8(a0); a0 += 8;
173 const int8x8_t va1x01234567 = vld1_s8(a1); a1 += 8;
174 const int8x8_t va2x01234567 = vld1_s8(a2); a2 += 8;
175 const int8x8_t va3x01234567 = vld1_s8(a3); a3 += 8;
176 const int8x8_t va4x01234567 = vld1_s8(a4); a4 += 8;
177 const int8x8_t va5x01234567 = vld1_s8(a5); a5 += 8;
178
179 // Load a 8x32 block of weights.
180 const int8x16_t vb0123x0123 = vld1q_s8(w); w = (const int8_t*) w + 16;
181 const int8x16_t vb0123x4567 = vld1q_s8(w); w = (const int8_t*) w + 16;
182 const int8x16_t vb0123x89AB = vld1q_s8(w); w = (const int8_t*) w + 16;
183 const int8x16_t vb0123xCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
184 const int8x16_t vb0123xGHIJ = vld1q_s8(w); w = (const int8_t*) w + 16;
185 const int8x16_t vb0123xKLMN = vld1q_s8(w); w = (const int8_t*) w + 16;
186 const int8x16_t vb0123xOPQR = vld1q_s8(w); w = (const int8_t*) w + 16;
187 const int8x16_t vb0123xSTUV = vld1q_s8(w); w = (const int8_t*) w + 16;
188 const int8x16_t vb4567x0123 = vld1q_s8(w); w = (const int8_t*) w + 16;
189 const int8x16_t vb4567x4567 = vld1q_s8(w); w = (const int8_t*) w + 16;
190 const int8x16_t vb4567x89AB = vld1q_s8(w); w = (const int8_t*) w + 16;
191 const int8x16_t vb4567xCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
192 const int8x16_t vb4567xGHIJ = vld1q_s8(w); w = (const int8_t*) w + 16;
193 const int8x16_t vb4567xKLMN = vld1q_s8(w); w = (const int8_t*) w + 16;
194 const int8x16_t vb4567xOPQR = vld1q_s8(w); w = (const int8_t*) w + 16;
195 const int8x16_t vb4567xSTUV = vld1q_s8(w); w = (const int8_t*) w + 16;
196
197 // Multiply-accumulate: 6x8 * 8x32 --> 6x32.
198 vacc0x0123 = vdotq_lane_s32(vacc0x0123, vb0123x0123, va0x01234567, 0);
199 vacc0x4567 = vdotq_lane_s32(vacc0x4567, vb0123x4567, va0x01234567, 0);
200 vacc0x89AB = vdotq_lane_s32(vacc0x89AB, vb0123x89AB, va0x01234567, 0);
201 vacc0xCDEF = vdotq_lane_s32(vacc0xCDEF, vb0123xCDEF, va0x01234567, 0);
202 vacc0xGHIJ = vdotq_lane_s32(vacc0xGHIJ, vb0123xGHIJ, va0x01234567, 0);
203 vacc0xKLMN = vdotq_lane_s32(vacc0xKLMN, vb0123xKLMN, va0x01234567, 0);
204 vacc0xOPQR = vdotq_lane_s32(vacc0xOPQR, vb0123xOPQR, va0x01234567, 0);
205 vacc0xSTUV = vdotq_lane_s32(vacc0xSTUV, vb0123xSTUV, va0x01234567, 0);
206 vacc1x0123 = vdotq_lane_s32(vacc1x0123, vb0123x0123, va1x01234567, 0);
207 vacc1x4567 = vdotq_lane_s32(vacc1x4567, vb0123x4567, va1x01234567, 0);
208 vacc1x89AB = vdotq_lane_s32(vacc1x89AB, vb0123x89AB, va1x01234567, 0);
209 vacc1xCDEF = vdotq_lane_s32(vacc1xCDEF, vb0123xCDEF, va1x01234567, 0);
210 vacc1xGHIJ = vdotq_lane_s32(vacc1xGHIJ, vb0123xGHIJ, va1x01234567, 0);
211 vacc1xKLMN = vdotq_lane_s32(vacc1xKLMN, vb0123xKLMN, va1x01234567, 0);
212 vacc1xOPQR = vdotq_lane_s32(vacc1xOPQR, vb0123xOPQR, va1x01234567, 0);
213 vacc1xSTUV = vdotq_lane_s32(vacc1xSTUV, vb0123xSTUV, va1x01234567, 0);
214 vacc2x0123 = vdotq_lane_s32(vacc2x0123, vb0123x0123, va2x01234567, 0);
215 vacc2x4567 = vdotq_lane_s32(vacc2x4567, vb0123x4567, va2x01234567, 0);
216 vacc2x89AB = vdotq_lane_s32(vacc2x89AB, vb0123x89AB, va2x01234567, 0);
217 vacc2xCDEF = vdotq_lane_s32(vacc2xCDEF, vb0123xCDEF, va2x01234567, 0);
218 vacc2xGHIJ = vdotq_lane_s32(vacc2xGHIJ, vb0123xGHIJ, va2x01234567, 0);
219 vacc2xKLMN = vdotq_lane_s32(vacc2xKLMN, vb0123xKLMN, va2x01234567, 0);
220 vacc2xOPQR = vdotq_lane_s32(vacc2xOPQR, vb0123xOPQR, va2x01234567, 0);
221 vacc2xSTUV = vdotq_lane_s32(vacc2xSTUV, vb0123xSTUV, va2x01234567, 0);
222 vacc3x0123 = vdotq_lane_s32(vacc3x0123, vb0123x0123, va3x01234567, 0);
223 vacc3x4567 = vdotq_lane_s32(vacc3x4567, vb0123x4567, va3x01234567, 0);
224 vacc3x89AB = vdotq_lane_s32(vacc3x89AB, vb0123x89AB, va3x01234567, 0);
225 vacc3xCDEF = vdotq_lane_s32(vacc3xCDEF, vb0123xCDEF, va3x01234567, 0);
226 vacc3xGHIJ = vdotq_lane_s32(vacc3xGHIJ, vb0123xGHIJ, va3x01234567, 0);
227 vacc3xKLMN = vdotq_lane_s32(vacc3xKLMN, vb0123xKLMN, va3x01234567, 0);
228 vacc3xOPQR = vdotq_lane_s32(vacc3xOPQR, vb0123xOPQR, va3x01234567, 0);
229 vacc3xSTUV = vdotq_lane_s32(vacc3xSTUV, vb0123xSTUV, va3x01234567, 0);
230 vacc4x0123 = vdotq_lane_s32(vacc4x0123, vb0123x0123, va4x01234567, 0);
231 vacc4x4567 = vdotq_lane_s32(vacc4x4567, vb0123x4567, va4x01234567, 0);
232 vacc4x89AB = vdotq_lane_s32(vacc4x89AB, vb0123x89AB, va4x01234567, 0);
233 vacc4xCDEF = vdotq_lane_s32(vacc4xCDEF, vb0123xCDEF, va4x01234567, 0);
234 vacc4xGHIJ = vdotq_lane_s32(vacc4xGHIJ, vb0123xGHIJ, va4x01234567, 0);
235 vacc4xKLMN = vdotq_lane_s32(vacc4xKLMN, vb0123xKLMN, va4x01234567, 0);
236 vacc4xOPQR = vdotq_lane_s32(vacc4xOPQR, vb0123xOPQR, va4x01234567, 0);
237 vacc4xSTUV = vdotq_lane_s32(vacc4xSTUV, vb0123xSTUV, va4x01234567, 0);
238 vacc5x0123 = vdotq_lane_s32(vacc5x0123, vb0123x0123, va5x01234567, 0);
239 vacc5x4567 = vdotq_lane_s32(vacc5x4567, vb0123x4567, va5x01234567, 0);
240 vacc5x89AB = vdotq_lane_s32(vacc5x89AB, vb0123x89AB, va5x01234567, 0);
241 vacc5xCDEF = vdotq_lane_s32(vacc5xCDEF, vb0123xCDEF, va5x01234567, 0);
242 vacc5xGHIJ = vdotq_lane_s32(vacc5xGHIJ, vb0123xGHIJ, va5x01234567, 0);
243 vacc5xKLMN = vdotq_lane_s32(vacc5xKLMN, vb0123xKLMN, va5x01234567, 0);
244 vacc5xOPQR = vdotq_lane_s32(vacc5xOPQR, vb0123xOPQR, va5x01234567, 0);
245 vacc5xSTUV = vdotq_lane_s32(vacc5xSTUV, vb0123xSTUV, va5x01234567, 0);
246 vacc0x0123 = vdotq_lane_s32(vacc0x0123, vb4567x0123, va0x01234567, 1);
247 vacc0x4567 = vdotq_lane_s32(vacc0x4567, vb4567x4567, va0x01234567, 1);
248 vacc0x89AB = vdotq_lane_s32(vacc0x89AB, vb4567x89AB, va0x01234567, 1);
249 vacc0xCDEF = vdotq_lane_s32(vacc0xCDEF, vb4567xCDEF, va0x01234567, 1);
250 vacc0xGHIJ = vdotq_lane_s32(vacc0xGHIJ, vb4567xGHIJ, va0x01234567, 1);
251 vacc0xKLMN = vdotq_lane_s32(vacc0xKLMN, vb4567xKLMN, va0x01234567, 1);
252 vacc0xOPQR = vdotq_lane_s32(vacc0xOPQR, vb4567xOPQR, va0x01234567, 1);
253 vacc0xSTUV = vdotq_lane_s32(vacc0xSTUV, vb4567xSTUV, va0x01234567, 1);
254 vacc1x0123 = vdotq_lane_s32(vacc1x0123, vb4567x0123, va1x01234567, 1);
255 vacc1x4567 = vdotq_lane_s32(vacc1x4567, vb4567x4567, va1x01234567, 1);
256 vacc1x89AB = vdotq_lane_s32(vacc1x89AB, vb4567x89AB, va1x01234567, 1);
257 vacc1xCDEF = vdotq_lane_s32(vacc1xCDEF, vb4567xCDEF, va1x01234567, 1);
258 vacc1xGHIJ = vdotq_lane_s32(vacc1xGHIJ, vb4567xGHIJ, va1x01234567, 1);
259 vacc1xKLMN = vdotq_lane_s32(vacc1xKLMN, vb4567xKLMN, va1x01234567, 1);
260 vacc1xOPQR = vdotq_lane_s32(vacc1xOPQR, vb4567xOPQR, va1x01234567, 1);
261 vacc1xSTUV = vdotq_lane_s32(vacc1xSTUV, vb4567xSTUV, va1x01234567, 1);
262 vacc2x0123 = vdotq_lane_s32(vacc2x0123, vb4567x0123, va2x01234567, 1);
263 vacc2x4567 = vdotq_lane_s32(vacc2x4567, vb4567x4567, va2x01234567, 1);
264 vacc2x89AB = vdotq_lane_s32(vacc2x89AB, vb4567x89AB, va2x01234567, 1);
265 vacc2xCDEF = vdotq_lane_s32(vacc2xCDEF, vb4567xCDEF, va2x01234567, 1);
266 vacc2xGHIJ = vdotq_lane_s32(vacc2xGHIJ, vb4567xGHIJ, va2x01234567, 1);
267 vacc2xKLMN = vdotq_lane_s32(vacc2xKLMN, vb4567xKLMN, va2x01234567, 1);
268 vacc2xOPQR = vdotq_lane_s32(vacc2xOPQR, vb4567xOPQR, va2x01234567, 1);
269 vacc2xSTUV = vdotq_lane_s32(vacc2xSTUV, vb4567xSTUV, va2x01234567, 1);
270 vacc3x0123 = vdotq_lane_s32(vacc3x0123, vb4567x0123, va3x01234567, 1);
271 vacc3x4567 = vdotq_lane_s32(vacc3x4567, vb4567x4567, va3x01234567, 1);
272 vacc3x89AB = vdotq_lane_s32(vacc3x89AB, vb4567x89AB, va3x01234567, 1);
273 vacc3xCDEF = vdotq_lane_s32(vacc3xCDEF, vb4567xCDEF, va3x01234567, 1);
274 vacc3xGHIJ = vdotq_lane_s32(vacc3xGHIJ, vb4567xGHIJ, va3x01234567, 1);
275 vacc3xKLMN = vdotq_lane_s32(vacc3xKLMN, vb4567xKLMN, va3x01234567, 1);
276 vacc3xOPQR = vdotq_lane_s32(vacc3xOPQR, vb4567xOPQR, va3x01234567, 1);
277 vacc3xSTUV = vdotq_lane_s32(vacc3xSTUV, vb4567xSTUV, va3x01234567, 1);
278 vacc4x0123 = vdotq_lane_s32(vacc4x0123, vb4567x0123, va4x01234567, 1);
279 vacc4x4567 = vdotq_lane_s32(vacc4x4567, vb4567x4567, va4x01234567, 1);
280 vacc4x89AB = vdotq_lane_s32(vacc4x89AB, vb4567x89AB, va4x01234567, 1);
281 vacc4xCDEF = vdotq_lane_s32(vacc4xCDEF, vb4567xCDEF, va4x01234567, 1);
282 vacc4xGHIJ = vdotq_lane_s32(vacc4xGHIJ, vb4567xGHIJ, va4x01234567, 1);
283 vacc4xKLMN = vdotq_lane_s32(vacc4xKLMN, vb4567xKLMN, va4x01234567, 1);
284 vacc4xOPQR = vdotq_lane_s32(vacc4xOPQR, vb4567xOPQR, va4x01234567, 1);
285 vacc4xSTUV = vdotq_lane_s32(vacc4xSTUV, vb4567xSTUV, va4x01234567, 1);
286 vacc5x0123 = vdotq_lane_s32(vacc5x0123, vb4567x0123, va5x01234567, 1);
287 vacc5x4567 = vdotq_lane_s32(vacc5x4567, vb4567x4567, va5x01234567, 1);
288 vacc5x89AB = vdotq_lane_s32(vacc5x89AB, vb4567x89AB, va5x01234567, 1);
289 vacc5xCDEF = vdotq_lane_s32(vacc5xCDEF, vb4567xCDEF, va5x01234567, 1);
290 vacc5xGHIJ = vdotq_lane_s32(vacc5xGHIJ, vb4567xGHIJ, va5x01234567, 1);
291 vacc5xKLMN = vdotq_lane_s32(vacc5xKLMN, vb4567xKLMN, va5x01234567, 1);
292 vacc5xOPQR = vdotq_lane_s32(vacc5xOPQR, vb4567xOPQR, va5x01234567, 1);
293 vacc5xSTUV = vdotq_lane_s32(vacc5xSTUV, vb4567xSTUV, va5x01234567, 1);
294
295 k -= 8 * sizeof(int8_t);
296 }
297 // Handle up to 4 final positions of `k`
298 if XNN_UNLIKELY(k != 0) {
299 // Load a 6x4 block of activations.
300 const int8x8_t va0x01234567 = vld1_s8(a0);
301 const int8x8_t va1x01234567 = vld1_s8(a1);
302 const int8x8_t va2x01234567 = vld1_s8(a2);
303 const int8x8_t va3x01234567 = vld1_s8(a3);
304 const int8x8_t va4x01234567 = vld1_s8(a4);
305 const int8x8_t va5x01234567 = vld1_s8(a5);
306
307 // Load a 4x32 block of weights.
308 const int8x16_t vb0123x0123 = vld1q_s8(w); w = (const int8_t*) w + 16;
309 const int8x16_t vb0123x4567 = vld1q_s8(w); w = (const int8_t*) w + 16;
310 const int8x16_t vb0123x89AB = vld1q_s8(w); w = (const int8_t*) w + 16;
311 const int8x16_t vb0123xCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
312 const int8x16_t vb0123xGHIJ = vld1q_s8(w); w = (const int8_t*) w + 16;
313 const int8x16_t vb0123xKLMN = vld1q_s8(w); w = (const int8_t*) w + 16;
314 const int8x16_t vb0123xOPQR = vld1q_s8(w); w = (const int8_t*) w + 16;
315 const int8x16_t vb0123xSTUV = vld1q_s8(w); w = (const int8_t*) w + 16;
316
317 // Multiply-accumulate: 6x4 * 4x32 --> 6x32.
318 vacc0x0123 = vdotq_lane_s32(vacc0x0123, vb0123x0123, va0x01234567, 0);
319 vacc0x4567 = vdotq_lane_s32(vacc0x4567, vb0123x4567, va0x01234567, 0);
320 vacc0x89AB = vdotq_lane_s32(vacc0x89AB, vb0123x89AB, va0x01234567, 0);
321 vacc0xCDEF = vdotq_lane_s32(vacc0xCDEF, vb0123xCDEF, va0x01234567, 0);
322 vacc0xGHIJ = vdotq_lane_s32(vacc0xGHIJ, vb0123xGHIJ, va0x01234567, 0);
323 vacc0xKLMN = vdotq_lane_s32(vacc0xKLMN, vb0123xKLMN, va0x01234567, 0);
324 vacc0xOPQR = vdotq_lane_s32(vacc0xOPQR, vb0123xOPQR, va0x01234567, 0);
325 vacc0xSTUV = vdotq_lane_s32(vacc0xSTUV, vb0123xSTUV, va0x01234567, 0);
326 vacc1x0123 = vdotq_lane_s32(vacc1x0123, vb0123x0123, va1x01234567, 0);
327 vacc1x4567 = vdotq_lane_s32(vacc1x4567, vb0123x4567, va1x01234567, 0);
328 vacc1x89AB = vdotq_lane_s32(vacc1x89AB, vb0123x89AB, va1x01234567, 0);
329 vacc1xCDEF = vdotq_lane_s32(vacc1xCDEF, vb0123xCDEF, va1x01234567, 0);
330 vacc1xGHIJ = vdotq_lane_s32(vacc1xGHIJ, vb0123xGHIJ, va1x01234567, 0);
331 vacc1xKLMN = vdotq_lane_s32(vacc1xKLMN, vb0123xKLMN, va1x01234567, 0);
332 vacc1xOPQR = vdotq_lane_s32(vacc1xOPQR, vb0123xOPQR, va1x01234567, 0);
333 vacc1xSTUV = vdotq_lane_s32(vacc1xSTUV, vb0123xSTUV, va1x01234567, 0);
334 vacc2x0123 = vdotq_lane_s32(vacc2x0123, vb0123x0123, va2x01234567, 0);
335 vacc2x4567 = vdotq_lane_s32(vacc2x4567, vb0123x4567, va2x01234567, 0);
336 vacc2x89AB = vdotq_lane_s32(vacc2x89AB, vb0123x89AB, va2x01234567, 0);
337 vacc2xCDEF = vdotq_lane_s32(vacc2xCDEF, vb0123xCDEF, va2x01234567, 0);
338 vacc2xGHIJ = vdotq_lane_s32(vacc2xGHIJ, vb0123xGHIJ, va2x01234567, 0);
339 vacc2xKLMN = vdotq_lane_s32(vacc2xKLMN, vb0123xKLMN, va2x01234567, 0);
340 vacc2xOPQR = vdotq_lane_s32(vacc2xOPQR, vb0123xOPQR, va2x01234567, 0);
341 vacc2xSTUV = vdotq_lane_s32(vacc2xSTUV, vb0123xSTUV, va2x01234567, 0);
342 vacc3x0123 = vdotq_lane_s32(vacc3x0123, vb0123x0123, va3x01234567, 0);
343 vacc3x4567 = vdotq_lane_s32(vacc3x4567, vb0123x4567, va3x01234567, 0);
344 vacc3x89AB = vdotq_lane_s32(vacc3x89AB, vb0123x89AB, va3x01234567, 0);
345 vacc3xCDEF = vdotq_lane_s32(vacc3xCDEF, vb0123xCDEF, va3x01234567, 0);
346 vacc3xGHIJ = vdotq_lane_s32(vacc3xGHIJ, vb0123xGHIJ, va3x01234567, 0);
347 vacc3xKLMN = vdotq_lane_s32(vacc3xKLMN, vb0123xKLMN, va3x01234567, 0);
348 vacc3xOPQR = vdotq_lane_s32(vacc3xOPQR, vb0123xOPQR, va3x01234567, 0);
349 vacc3xSTUV = vdotq_lane_s32(vacc3xSTUV, vb0123xSTUV, va3x01234567, 0);
350 vacc4x0123 = vdotq_lane_s32(vacc4x0123, vb0123x0123, va4x01234567, 0);
351 vacc4x4567 = vdotq_lane_s32(vacc4x4567, vb0123x4567, va4x01234567, 0);
352 vacc4x89AB = vdotq_lane_s32(vacc4x89AB, vb0123x89AB, va4x01234567, 0);
353 vacc4xCDEF = vdotq_lane_s32(vacc4xCDEF, vb0123xCDEF, va4x01234567, 0);
354 vacc4xGHIJ = vdotq_lane_s32(vacc4xGHIJ, vb0123xGHIJ, va4x01234567, 0);
355 vacc4xKLMN = vdotq_lane_s32(vacc4xKLMN, vb0123xKLMN, va4x01234567, 0);
356 vacc4xOPQR = vdotq_lane_s32(vacc4xOPQR, vb0123xOPQR, va4x01234567, 0);
357 vacc4xSTUV = vdotq_lane_s32(vacc4xSTUV, vb0123xSTUV, va4x01234567, 0);
358 vacc5x0123 = vdotq_lane_s32(vacc5x0123, vb0123x0123, va5x01234567, 0);
359 vacc5x4567 = vdotq_lane_s32(vacc5x4567, vb0123x4567, va5x01234567, 0);
360 vacc5x89AB = vdotq_lane_s32(vacc5x89AB, vb0123x89AB, va5x01234567, 0);
361 vacc5xCDEF = vdotq_lane_s32(vacc5xCDEF, vb0123xCDEF, va5x01234567, 0);
362 vacc5xGHIJ = vdotq_lane_s32(vacc5xGHIJ, vb0123xGHIJ, va5x01234567, 0);
363 vacc5xKLMN = vdotq_lane_s32(vacc5xKLMN, vb0123xKLMN, va5x01234567, 0);
364 vacc5xOPQR = vdotq_lane_s32(vacc5xOPQR, vb0123xOPQR, va5x01234567, 0);
365 vacc5xSTUV = vdotq_lane_s32(vacc5xSTUV, vb0123xSTUV, va5x01234567, 0);
366 }
367 p -= 6 * sizeof(void*);
368 } while (p != 0);
369
370 float32x4_t vout0x0123 = vcvtq_f32_s32(vacc0x0123);
371 float32x4_t vout0x4567 = vcvtq_f32_s32(vacc0x4567);
372 float32x4_t vout0x89AB = vcvtq_f32_s32(vacc0x89AB);
373 float32x4_t vout0xCDEF = vcvtq_f32_s32(vacc0xCDEF);
374 float32x4_t vout0xGHIJ = vcvtq_f32_s32(vacc0xGHIJ);
375 float32x4_t vout0xKLMN = vcvtq_f32_s32(vacc0xKLMN);
376 float32x4_t vout0xOPQR = vcvtq_f32_s32(vacc0xOPQR);
377 float32x4_t vout0xSTUV = vcvtq_f32_s32(vacc0xSTUV);
378 float32x4_t vout1x0123 = vcvtq_f32_s32(vacc1x0123);
379 float32x4_t vout1x4567 = vcvtq_f32_s32(vacc1x4567);
380 float32x4_t vout1x89AB = vcvtq_f32_s32(vacc1x89AB);
381 float32x4_t vout1xCDEF = vcvtq_f32_s32(vacc1xCDEF);
382 float32x4_t vout1xGHIJ = vcvtq_f32_s32(vacc1xGHIJ);
383 float32x4_t vout1xKLMN = vcvtq_f32_s32(vacc1xKLMN);
384 float32x4_t vout1xOPQR = vcvtq_f32_s32(vacc1xOPQR);
385 float32x4_t vout1xSTUV = vcvtq_f32_s32(vacc1xSTUV);
386 float32x4_t vout2x0123 = vcvtq_f32_s32(vacc2x0123);
387 float32x4_t vout2x4567 = vcvtq_f32_s32(vacc2x4567);
388 float32x4_t vout2x89AB = vcvtq_f32_s32(vacc2x89AB);
389 float32x4_t vout2xCDEF = vcvtq_f32_s32(vacc2xCDEF);
390 float32x4_t vout2xGHIJ = vcvtq_f32_s32(vacc2xGHIJ);
391 float32x4_t vout2xKLMN = vcvtq_f32_s32(vacc2xKLMN);
392 float32x4_t vout2xOPQR = vcvtq_f32_s32(vacc2xOPQR);
393 float32x4_t vout2xSTUV = vcvtq_f32_s32(vacc2xSTUV);
394 float32x4_t vout3x0123 = vcvtq_f32_s32(vacc3x0123);
395 float32x4_t vout3x4567 = vcvtq_f32_s32(vacc3x4567);
396 float32x4_t vout3x89AB = vcvtq_f32_s32(vacc3x89AB);
397 float32x4_t vout3xCDEF = vcvtq_f32_s32(vacc3xCDEF);
398 float32x4_t vout3xGHIJ = vcvtq_f32_s32(vacc3xGHIJ);
399 float32x4_t vout3xKLMN = vcvtq_f32_s32(vacc3xKLMN);
400 float32x4_t vout3xOPQR = vcvtq_f32_s32(vacc3xOPQR);
401 float32x4_t vout3xSTUV = vcvtq_f32_s32(vacc3xSTUV);
402 float32x4_t vout4x0123 = vcvtq_f32_s32(vacc4x0123);
403 float32x4_t vout4x4567 = vcvtq_f32_s32(vacc4x4567);
404 float32x4_t vout4x89AB = vcvtq_f32_s32(vacc4x89AB);
405 float32x4_t vout4xCDEF = vcvtq_f32_s32(vacc4xCDEF);
406 float32x4_t vout4xGHIJ = vcvtq_f32_s32(vacc4xGHIJ);
407 float32x4_t vout4xKLMN = vcvtq_f32_s32(vacc4xKLMN);
408 float32x4_t vout4xOPQR = vcvtq_f32_s32(vacc4xOPQR);
409 float32x4_t vout4xSTUV = vcvtq_f32_s32(vacc4xSTUV);
410 float32x4_t vout5x0123 = vcvtq_f32_s32(vacc5x0123);
411 float32x4_t vout5x4567 = vcvtq_f32_s32(vacc5x4567);
412 float32x4_t vout5x89AB = vcvtq_f32_s32(vacc5x89AB);
413 float32x4_t vout5xCDEF = vcvtq_f32_s32(vacc5xCDEF);
414 float32x4_t vout5xGHIJ = vcvtq_f32_s32(vacc5xGHIJ);
415 float32x4_t vout5xKLMN = vcvtq_f32_s32(vacc5xKLMN);
416 float32x4_t vout5xOPQR = vcvtq_f32_s32(vacc5xOPQR);
417 float32x4_t vout5xSTUV = vcvtq_f32_s32(vacc5xSTUV);
418 const float32x4_t vinput_scale = vld1q_dup_f32(&quantization_params->inv_scale);
419 vout0x0123 = vmulq_f32(vout0x0123, vinput_scale);
420 vout0x4567 = vmulq_f32(vout0x4567, vinput_scale);
421 vout0x89AB = vmulq_f32(vout0x89AB, vinput_scale);
422 vout0xCDEF = vmulq_f32(vout0xCDEF, vinput_scale);
423 vout0xGHIJ = vmulq_f32(vout0xGHIJ, vinput_scale);
424 vout0xKLMN = vmulq_f32(vout0xKLMN, vinput_scale);
425 vout0xOPQR = vmulq_f32(vout0xOPQR, vinput_scale);
426 vout0xSTUV = vmulq_f32(vout0xSTUV, vinput_scale);
427 vout1x0123 = vmulq_f32(vout1x0123, vinput_scale);
428 vout1x4567 = vmulq_f32(vout1x4567, vinput_scale);
429 vout1x89AB = vmulq_f32(vout1x89AB, vinput_scale);
430 vout1xCDEF = vmulq_f32(vout1xCDEF, vinput_scale);
431 vout1xGHIJ = vmulq_f32(vout1xGHIJ, vinput_scale);
432 vout1xKLMN = vmulq_f32(vout1xKLMN, vinput_scale);
433 vout1xOPQR = vmulq_f32(vout1xOPQR, vinput_scale);
434 vout1xSTUV = vmulq_f32(vout1xSTUV, vinput_scale);
435 vout2x0123 = vmulq_f32(vout2x0123, vinput_scale);
436 vout2x4567 = vmulq_f32(vout2x4567, vinput_scale);
437 vout2x89AB = vmulq_f32(vout2x89AB, vinput_scale);
438 vout2xCDEF = vmulq_f32(vout2xCDEF, vinput_scale);
439 vout2xGHIJ = vmulq_f32(vout2xGHIJ, vinput_scale);
440 vout2xKLMN = vmulq_f32(vout2xKLMN, vinput_scale);
441 vout2xOPQR = vmulq_f32(vout2xOPQR, vinput_scale);
442 vout2xSTUV = vmulq_f32(vout2xSTUV, vinput_scale);
443 vout3x0123 = vmulq_f32(vout3x0123, vinput_scale);
444 vout3x4567 = vmulq_f32(vout3x4567, vinput_scale);
445 vout3x89AB = vmulq_f32(vout3x89AB, vinput_scale);
446 vout3xCDEF = vmulq_f32(vout3xCDEF, vinput_scale);
447 vout3xGHIJ = vmulq_f32(vout3xGHIJ, vinput_scale);
448 vout3xKLMN = vmulq_f32(vout3xKLMN, vinput_scale);
449 vout3xOPQR = vmulq_f32(vout3xOPQR, vinput_scale);
450 vout3xSTUV = vmulq_f32(vout3xSTUV, vinput_scale);
451 vout4x0123 = vmulq_f32(vout4x0123, vinput_scale);
452 vout4x4567 = vmulq_f32(vout4x4567, vinput_scale);
453 vout4x89AB = vmulq_f32(vout4x89AB, vinput_scale);
454 vout4xCDEF = vmulq_f32(vout4xCDEF, vinput_scale);
455 vout4xGHIJ = vmulq_f32(vout4xGHIJ, vinput_scale);
456 vout4xKLMN = vmulq_f32(vout4xKLMN, vinput_scale);
457 vout4xOPQR = vmulq_f32(vout4xOPQR, vinput_scale);
458 vout4xSTUV = vmulq_f32(vout4xSTUV, vinput_scale);
459 vout5x0123 = vmulq_f32(vout5x0123, vinput_scale);
460 vout5x4567 = vmulq_f32(vout5x4567, vinput_scale);
461 vout5x89AB = vmulq_f32(vout5x89AB, vinput_scale);
462 vout5xCDEF = vmulq_f32(vout5xCDEF, vinput_scale);
463 vout5xGHIJ = vmulq_f32(vout5xGHIJ, vinput_scale);
464 vout5xKLMN = vmulq_f32(vout5xKLMN, vinput_scale);
465 vout5xOPQR = vmulq_f32(vout5xOPQR, vinput_scale);
466 vout5xSTUV = vmulq_f32(vout5xSTUV, vinput_scale);
467
468 const float32x4_t vfilter_output_scale0123 = vld1q_f32(w); w = (const float*) w + 4;
469 const float32x4_t vfilter_output_scale4567 = vld1q_f32(w); w = (const float*) w + 4;
470 const float32x4_t vfilter_output_scale89AB = vld1q_f32(w); w = (const float*) w + 4;
471 const float32x4_t vfilter_output_scaleCDEF = vld1q_f32(w); w = (const float*) w + 4;
472 const float32x4_t vfilter_output_scaleGHIJ = vld1q_f32(w); w = (const float*) w + 4;
473 const float32x4_t vfilter_output_scaleKLMN = vld1q_f32(w); w = (const float*) w + 4;
474 const float32x4_t vfilter_output_scaleOPQR = vld1q_f32(w); w = (const float*) w + 4;
475 const float32x4_t vfilter_output_scaleSTUV = vld1q_f32(w); w = (const float*) w + 4;
476
477 const float32x4_t vbias0123 = vld1q_f32(w); w = (const float*) w + 4;
478 #if XNN_ARCH_ARM64
479 vout0x0123 = vfmaq_f32(vbias0123, vout0x0123, vfilter_output_scale0123);
480 vout1x0123 = vfmaq_f32(vbias0123, vout1x0123, vfilter_output_scale0123);
481 vout2x0123 = vfmaq_f32(vbias0123, vout2x0123, vfilter_output_scale0123);
482 vout3x0123 = vfmaq_f32(vbias0123, vout3x0123, vfilter_output_scale0123);
483 vout4x0123 = vfmaq_f32(vbias0123, vout4x0123, vfilter_output_scale0123);
484 vout5x0123 = vfmaq_f32(vbias0123, vout5x0123, vfilter_output_scale0123);
485 #else
486 vout0x0123 = vmlaq_f32(vbias0123, vout0x0123, vfilter_output_scale0123);
487 vout1x0123 = vmlaq_f32(vbias0123, vout1x0123, vfilter_output_scale0123);
488 vout2x0123 = vmlaq_f32(vbias0123, vout2x0123, vfilter_output_scale0123);
489 vout3x0123 = vmlaq_f32(vbias0123, vout3x0123, vfilter_output_scale0123);
490 vout4x0123 = vmlaq_f32(vbias0123, vout4x0123, vfilter_output_scale0123);
491 vout5x0123 = vmlaq_f32(vbias0123, vout5x0123, vfilter_output_scale0123);
492 #endif
493 const float32x4_t vbias4567 = vld1q_f32(w); w = (const float*) w + 4;
494 #if XNN_ARCH_ARM64
495 vout0x4567 = vfmaq_f32(vbias4567, vout0x4567, vfilter_output_scale4567);
496 vout1x4567 = vfmaq_f32(vbias4567, vout1x4567, vfilter_output_scale4567);
497 vout2x4567 = vfmaq_f32(vbias4567, vout2x4567, vfilter_output_scale4567);
498 vout3x4567 = vfmaq_f32(vbias4567, vout3x4567, vfilter_output_scale4567);
499 vout4x4567 = vfmaq_f32(vbias4567, vout4x4567, vfilter_output_scale4567);
500 vout5x4567 = vfmaq_f32(vbias4567, vout5x4567, vfilter_output_scale4567);
501 #else
502 vout0x4567 = vmlaq_f32(vbias4567, vout0x4567, vfilter_output_scale4567);
503 vout1x4567 = vmlaq_f32(vbias4567, vout1x4567, vfilter_output_scale4567);
504 vout2x4567 = vmlaq_f32(vbias4567, vout2x4567, vfilter_output_scale4567);
505 vout3x4567 = vmlaq_f32(vbias4567, vout3x4567, vfilter_output_scale4567);
506 vout4x4567 = vmlaq_f32(vbias4567, vout4x4567, vfilter_output_scale4567);
507 vout5x4567 = vmlaq_f32(vbias4567, vout5x4567, vfilter_output_scale4567);
508 #endif
509 const float32x4_t vbias89AB = vld1q_f32(w); w = (const float*) w + 4;
510 #if XNN_ARCH_ARM64
511 vout0x89AB = vfmaq_f32(vbias89AB, vout0x89AB, vfilter_output_scale89AB);
512 vout1x89AB = vfmaq_f32(vbias89AB, vout1x89AB, vfilter_output_scale89AB);
513 vout2x89AB = vfmaq_f32(vbias89AB, vout2x89AB, vfilter_output_scale89AB);
514 vout3x89AB = vfmaq_f32(vbias89AB, vout3x89AB, vfilter_output_scale89AB);
515 vout4x89AB = vfmaq_f32(vbias89AB, vout4x89AB, vfilter_output_scale89AB);
516 vout5x89AB = vfmaq_f32(vbias89AB, vout5x89AB, vfilter_output_scale89AB);
517 #else
518 vout0x89AB = vmlaq_f32(vbias89AB, vout0x89AB, vfilter_output_scale89AB);
519 vout1x89AB = vmlaq_f32(vbias89AB, vout1x89AB, vfilter_output_scale89AB);
520 vout2x89AB = vmlaq_f32(vbias89AB, vout2x89AB, vfilter_output_scale89AB);
521 vout3x89AB = vmlaq_f32(vbias89AB, vout3x89AB, vfilter_output_scale89AB);
522 vout4x89AB = vmlaq_f32(vbias89AB, vout4x89AB, vfilter_output_scale89AB);
523 vout5x89AB = vmlaq_f32(vbias89AB, vout5x89AB, vfilter_output_scale89AB);
524 #endif
525 const float32x4_t vbiasCDEF = vld1q_f32(w); w = (const float*) w + 4;
526 #if XNN_ARCH_ARM64
527 vout0xCDEF = vfmaq_f32(vbiasCDEF, vout0xCDEF, vfilter_output_scaleCDEF);
528 vout1xCDEF = vfmaq_f32(vbiasCDEF, vout1xCDEF, vfilter_output_scaleCDEF);
529 vout2xCDEF = vfmaq_f32(vbiasCDEF, vout2xCDEF, vfilter_output_scaleCDEF);
530 vout3xCDEF = vfmaq_f32(vbiasCDEF, vout3xCDEF, vfilter_output_scaleCDEF);
531 vout4xCDEF = vfmaq_f32(vbiasCDEF, vout4xCDEF, vfilter_output_scaleCDEF);
532 vout5xCDEF = vfmaq_f32(vbiasCDEF, vout5xCDEF, vfilter_output_scaleCDEF);
533 #else
534 vout0xCDEF = vmlaq_f32(vbiasCDEF, vout0xCDEF, vfilter_output_scaleCDEF);
535 vout1xCDEF = vmlaq_f32(vbiasCDEF, vout1xCDEF, vfilter_output_scaleCDEF);
536 vout2xCDEF = vmlaq_f32(vbiasCDEF, vout2xCDEF, vfilter_output_scaleCDEF);
537 vout3xCDEF = vmlaq_f32(vbiasCDEF, vout3xCDEF, vfilter_output_scaleCDEF);
538 vout4xCDEF = vmlaq_f32(vbiasCDEF, vout4xCDEF, vfilter_output_scaleCDEF);
539 vout5xCDEF = vmlaq_f32(vbiasCDEF, vout5xCDEF, vfilter_output_scaleCDEF);
540 #endif
541 const float32x4_t vbiasGHIJ = vld1q_f32(w); w = (const float*) w + 4;
542 #if XNN_ARCH_ARM64
543 vout0xGHIJ = vfmaq_f32(vbiasGHIJ, vout0xGHIJ, vfilter_output_scaleGHIJ);
544 vout1xGHIJ = vfmaq_f32(vbiasGHIJ, vout1xGHIJ, vfilter_output_scaleGHIJ);
545 vout2xGHIJ = vfmaq_f32(vbiasGHIJ, vout2xGHIJ, vfilter_output_scaleGHIJ);
546 vout3xGHIJ = vfmaq_f32(vbiasGHIJ, vout3xGHIJ, vfilter_output_scaleGHIJ);
547 vout4xGHIJ = vfmaq_f32(vbiasGHIJ, vout4xGHIJ, vfilter_output_scaleGHIJ);
548 vout5xGHIJ = vfmaq_f32(vbiasGHIJ, vout5xGHIJ, vfilter_output_scaleGHIJ);
549 #else
550 vout0xGHIJ = vmlaq_f32(vbiasGHIJ, vout0xGHIJ, vfilter_output_scaleGHIJ);
551 vout1xGHIJ = vmlaq_f32(vbiasGHIJ, vout1xGHIJ, vfilter_output_scaleGHIJ);
552 vout2xGHIJ = vmlaq_f32(vbiasGHIJ, vout2xGHIJ, vfilter_output_scaleGHIJ);
553 vout3xGHIJ = vmlaq_f32(vbiasGHIJ, vout3xGHIJ, vfilter_output_scaleGHIJ);
554 vout4xGHIJ = vmlaq_f32(vbiasGHIJ, vout4xGHIJ, vfilter_output_scaleGHIJ);
555 vout5xGHIJ = vmlaq_f32(vbiasGHIJ, vout5xGHIJ, vfilter_output_scaleGHIJ);
556 #endif
557 const float32x4_t vbiasKLMN = vld1q_f32(w); w = (const float*) w + 4;
558 #if XNN_ARCH_ARM64
559 vout0xKLMN = vfmaq_f32(vbiasKLMN, vout0xKLMN, vfilter_output_scaleKLMN);
560 vout1xKLMN = vfmaq_f32(vbiasKLMN, vout1xKLMN, vfilter_output_scaleKLMN);
561 vout2xKLMN = vfmaq_f32(vbiasKLMN, vout2xKLMN, vfilter_output_scaleKLMN);
562 vout3xKLMN = vfmaq_f32(vbiasKLMN, vout3xKLMN, vfilter_output_scaleKLMN);
563 vout4xKLMN = vfmaq_f32(vbiasKLMN, vout4xKLMN, vfilter_output_scaleKLMN);
564 vout5xKLMN = vfmaq_f32(vbiasKLMN, vout5xKLMN, vfilter_output_scaleKLMN);
565 #else
566 vout0xKLMN = vmlaq_f32(vbiasKLMN, vout0xKLMN, vfilter_output_scaleKLMN);
567 vout1xKLMN = vmlaq_f32(vbiasKLMN, vout1xKLMN, vfilter_output_scaleKLMN);
568 vout2xKLMN = vmlaq_f32(vbiasKLMN, vout2xKLMN, vfilter_output_scaleKLMN);
569 vout3xKLMN = vmlaq_f32(vbiasKLMN, vout3xKLMN, vfilter_output_scaleKLMN);
570 vout4xKLMN = vmlaq_f32(vbiasKLMN, vout4xKLMN, vfilter_output_scaleKLMN);
571 vout5xKLMN = vmlaq_f32(vbiasKLMN, vout5xKLMN, vfilter_output_scaleKLMN);
572 #endif
573 const float32x4_t vbiasOPQR = vld1q_f32(w); w = (const float*) w + 4;
574 #if XNN_ARCH_ARM64
575 vout0xOPQR = vfmaq_f32(vbiasOPQR, vout0xOPQR, vfilter_output_scaleOPQR);
576 vout1xOPQR = vfmaq_f32(vbiasOPQR, vout1xOPQR, vfilter_output_scaleOPQR);
577 vout2xOPQR = vfmaq_f32(vbiasOPQR, vout2xOPQR, vfilter_output_scaleOPQR);
578 vout3xOPQR = vfmaq_f32(vbiasOPQR, vout3xOPQR, vfilter_output_scaleOPQR);
579 vout4xOPQR = vfmaq_f32(vbiasOPQR, vout4xOPQR, vfilter_output_scaleOPQR);
580 vout5xOPQR = vfmaq_f32(vbiasOPQR, vout5xOPQR, vfilter_output_scaleOPQR);
581 #else
582 vout0xOPQR = vmlaq_f32(vbiasOPQR, vout0xOPQR, vfilter_output_scaleOPQR);
583 vout1xOPQR = vmlaq_f32(vbiasOPQR, vout1xOPQR, vfilter_output_scaleOPQR);
584 vout2xOPQR = vmlaq_f32(vbiasOPQR, vout2xOPQR, vfilter_output_scaleOPQR);
585 vout3xOPQR = vmlaq_f32(vbiasOPQR, vout3xOPQR, vfilter_output_scaleOPQR);
586 vout4xOPQR = vmlaq_f32(vbiasOPQR, vout4xOPQR, vfilter_output_scaleOPQR);
587 vout5xOPQR = vmlaq_f32(vbiasOPQR, vout5xOPQR, vfilter_output_scaleOPQR);
588 #endif
589 const float32x4_t vbiasSTUV = vld1q_f32(w); w = (const float*) w + 4;
590 #if XNN_ARCH_ARM64
591 vout0xSTUV = vfmaq_f32(vbiasSTUV, vout0xSTUV, vfilter_output_scaleSTUV);
592 vout1xSTUV = vfmaq_f32(vbiasSTUV, vout1xSTUV, vfilter_output_scaleSTUV);
593 vout2xSTUV = vfmaq_f32(vbiasSTUV, vout2xSTUV, vfilter_output_scaleSTUV);
594 vout3xSTUV = vfmaq_f32(vbiasSTUV, vout3xSTUV, vfilter_output_scaleSTUV);
595 vout4xSTUV = vfmaq_f32(vbiasSTUV, vout4xSTUV, vfilter_output_scaleSTUV);
596 vout5xSTUV = vfmaq_f32(vbiasSTUV, vout5xSTUV, vfilter_output_scaleSTUV);
597 #else
598 vout0xSTUV = vmlaq_f32(vbiasSTUV, vout0xSTUV, vfilter_output_scaleSTUV);
599 vout1xSTUV = vmlaq_f32(vbiasSTUV, vout1xSTUV, vfilter_output_scaleSTUV);
600 vout2xSTUV = vmlaq_f32(vbiasSTUV, vout2xSTUV, vfilter_output_scaleSTUV);
601 vout3xSTUV = vmlaq_f32(vbiasSTUV, vout3xSTUV, vfilter_output_scaleSTUV);
602 vout4xSTUV = vmlaq_f32(vbiasSTUV, vout4xSTUV, vfilter_output_scaleSTUV);
603 vout5xSTUV = vmlaq_f32(vbiasSTUV, vout5xSTUV, vfilter_output_scaleSTUV);
604 #endif
605
606 const float32x4_t voutput_min = vld1q_dup_f32(&params->scalar.min);
607 vout0x0123 = vmaxq_f32(vout0x0123, voutput_min);
608 vout0x4567 = vmaxq_f32(vout0x4567, voutput_min);
609 vout0x89AB = vmaxq_f32(vout0x89AB, voutput_min);
610 vout0xCDEF = vmaxq_f32(vout0xCDEF, voutput_min);
611 vout0xGHIJ = vmaxq_f32(vout0xGHIJ, voutput_min);
612 vout0xKLMN = vmaxq_f32(vout0xKLMN, voutput_min);
613 vout0xOPQR = vmaxq_f32(vout0xOPQR, voutput_min);
614 vout0xSTUV = vmaxq_f32(vout0xSTUV, voutput_min);
615 vout1x0123 = vmaxq_f32(vout1x0123, voutput_min);
616 vout1x4567 = vmaxq_f32(vout1x4567, voutput_min);
617 vout1x89AB = vmaxq_f32(vout1x89AB, voutput_min);
618 vout1xCDEF = vmaxq_f32(vout1xCDEF, voutput_min);
619 vout1xGHIJ = vmaxq_f32(vout1xGHIJ, voutput_min);
620 vout1xKLMN = vmaxq_f32(vout1xKLMN, voutput_min);
621 vout1xOPQR = vmaxq_f32(vout1xOPQR, voutput_min);
622 vout1xSTUV = vmaxq_f32(vout1xSTUV, voutput_min);
623 vout2x0123 = vmaxq_f32(vout2x0123, voutput_min);
624 vout2x4567 = vmaxq_f32(vout2x4567, voutput_min);
625 vout2x89AB = vmaxq_f32(vout2x89AB, voutput_min);
626 vout2xCDEF = vmaxq_f32(vout2xCDEF, voutput_min);
627 vout2xGHIJ = vmaxq_f32(vout2xGHIJ, voutput_min);
628 vout2xKLMN = vmaxq_f32(vout2xKLMN, voutput_min);
629 vout2xOPQR = vmaxq_f32(vout2xOPQR, voutput_min);
630 vout2xSTUV = vmaxq_f32(vout2xSTUV, voutput_min);
631 vout3x0123 = vmaxq_f32(vout3x0123, voutput_min);
632 vout3x4567 = vmaxq_f32(vout3x4567, voutput_min);
633 vout3x89AB = vmaxq_f32(vout3x89AB, voutput_min);
634 vout3xCDEF = vmaxq_f32(vout3xCDEF, voutput_min);
635 vout3xGHIJ = vmaxq_f32(vout3xGHIJ, voutput_min);
636 vout3xKLMN = vmaxq_f32(vout3xKLMN, voutput_min);
637 vout3xOPQR = vmaxq_f32(vout3xOPQR, voutput_min);
638 vout3xSTUV = vmaxq_f32(vout3xSTUV, voutput_min);
639 vout4x0123 = vmaxq_f32(vout4x0123, voutput_min);
640 vout4x4567 = vmaxq_f32(vout4x4567, voutput_min);
641 vout4x89AB = vmaxq_f32(vout4x89AB, voutput_min);
642 vout4xCDEF = vmaxq_f32(vout4xCDEF, voutput_min);
643 vout4xGHIJ = vmaxq_f32(vout4xGHIJ, voutput_min);
644 vout4xKLMN = vmaxq_f32(vout4xKLMN, voutput_min);
645 vout4xOPQR = vmaxq_f32(vout4xOPQR, voutput_min);
646 vout4xSTUV = vmaxq_f32(vout4xSTUV, voutput_min);
647 vout5x0123 = vmaxq_f32(vout5x0123, voutput_min);
648 vout5x4567 = vmaxq_f32(vout5x4567, voutput_min);
649 vout5x89AB = vmaxq_f32(vout5x89AB, voutput_min);
650 vout5xCDEF = vmaxq_f32(vout5xCDEF, voutput_min);
651 vout5xGHIJ = vmaxq_f32(vout5xGHIJ, voutput_min);
652 vout5xKLMN = vmaxq_f32(vout5xKLMN, voutput_min);
653 vout5xOPQR = vmaxq_f32(vout5xOPQR, voutput_min);
654 vout5xSTUV = vmaxq_f32(vout5xSTUV, voutput_min);
655
656 const float32x4_t voutput_max = vld1q_dup_f32(&params->scalar.max);
657 vout0x0123 = vminq_f32(vout0x0123, voutput_max);
658 vout0x4567 = vminq_f32(vout0x4567, voutput_max);
659 vout0x89AB = vminq_f32(vout0x89AB, voutput_max);
660 vout0xCDEF = vminq_f32(vout0xCDEF, voutput_max);
661 vout0xGHIJ = vminq_f32(vout0xGHIJ, voutput_max);
662 vout0xKLMN = vminq_f32(vout0xKLMN, voutput_max);
663 vout0xOPQR = vminq_f32(vout0xOPQR, voutput_max);
664 vout0xSTUV = vminq_f32(vout0xSTUV, voutput_max);
665 vout1x0123 = vminq_f32(vout1x0123, voutput_max);
666 vout1x4567 = vminq_f32(vout1x4567, voutput_max);
667 vout1x89AB = vminq_f32(vout1x89AB, voutput_max);
668 vout1xCDEF = vminq_f32(vout1xCDEF, voutput_max);
669 vout1xGHIJ = vminq_f32(vout1xGHIJ, voutput_max);
670 vout1xKLMN = vminq_f32(vout1xKLMN, voutput_max);
671 vout1xOPQR = vminq_f32(vout1xOPQR, voutput_max);
672 vout1xSTUV = vminq_f32(vout1xSTUV, voutput_max);
673 vout2x0123 = vminq_f32(vout2x0123, voutput_max);
674 vout2x4567 = vminq_f32(vout2x4567, voutput_max);
675 vout2x89AB = vminq_f32(vout2x89AB, voutput_max);
676 vout2xCDEF = vminq_f32(vout2xCDEF, voutput_max);
677 vout2xGHIJ = vminq_f32(vout2xGHIJ, voutput_max);
678 vout2xKLMN = vminq_f32(vout2xKLMN, voutput_max);
679 vout2xOPQR = vminq_f32(vout2xOPQR, voutput_max);
680 vout2xSTUV = vminq_f32(vout2xSTUV, voutput_max);
681 vout3x0123 = vminq_f32(vout3x0123, voutput_max);
682 vout3x4567 = vminq_f32(vout3x4567, voutput_max);
683 vout3x89AB = vminq_f32(vout3x89AB, voutput_max);
684 vout3xCDEF = vminq_f32(vout3xCDEF, voutput_max);
685 vout3xGHIJ = vminq_f32(vout3xGHIJ, voutput_max);
686 vout3xKLMN = vminq_f32(vout3xKLMN, voutput_max);
687 vout3xOPQR = vminq_f32(vout3xOPQR, voutput_max);
688 vout3xSTUV = vminq_f32(vout3xSTUV, voutput_max);
689 vout4x0123 = vminq_f32(vout4x0123, voutput_max);
690 vout4x4567 = vminq_f32(vout4x4567, voutput_max);
691 vout4x89AB = vminq_f32(vout4x89AB, voutput_max);
692 vout4xCDEF = vminq_f32(vout4xCDEF, voutput_max);
693 vout4xGHIJ = vminq_f32(vout4xGHIJ, voutput_max);
694 vout4xKLMN = vminq_f32(vout4xKLMN, voutput_max);
695 vout4xOPQR = vminq_f32(vout4xOPQR, voutput_max);
696 vout4xSTUV = vminq_f32(vout4xSTUV, voutput_max);
697 vout5x0123 = vminq_f32(vout5x0123, voutput_max);
698 vout5x4567 = vminq_f32(vout5x4567, voutput_max);
699 vout5x89AB = vminq_f32(vout5x89AB, voutput_max);
700 vout5xCDEF = vminq_f32(vout5xCDEF, voutput_max);
701 vout5xGHIJ = vminq_f32(vout5xGHIJ, voutput_max);
702 vout5xKLMN = vminq_f32(vout5xKLMN, voutput_max);
703 vout5xOPQR = vminq_f32(vout5xOPQR, voutput_max);
704 vout5xSTUV = vminq_f32(vout5xSTUV, voutput_max);
705
706 if XNN_LIKELY(nc >= 32) {
707 vst1q_f32(c5, vout5x0123);
708 vst1q_f32(c5 + 4, vout5x4567);
709 vst1q_f32(c5 + 8, vout5x89AB);
710 vst1q_f32(c5 + 12, vout5xCDEF);
711 vst1q_f32(c5 + 16, vout5xGHIJ);
712 vst1q_f32(c5 + 20, vout5xKLMN);
713 vst1q_f32(c5 + 24, vout5xOPQR);
714 vst1q_f32(c5 + 28, vout5xSTUV);
715 vst1q_f32(c4, vout4x0123);
716 vst1q_f32(c4 + 4, vout4x4567);
717 vst1q_f32(c4 + 8, vout4x89AB);
718 vst1q_f32(c4 + 12, vout4xCDEF);
719 vst1q_f32(c4 + 16, vout4xGHIJ);
720 vst1q_f32(c4 + 20, vout4xKLMN);
721 vst1q_f32(c4 + 24, vout4xOPQR);
722 vst1q_f32(c4 + 28, vout4xSTUV);
723 vst1q_f32(c3, vout3x0123);
724 vst1q_f32(c3 + 4, vout3x4567);
725 vst1q_f32(c3 + 8, vout3x89AB);
726 vst1q_f32(c3 + 12, vout3xCDEF);
727 vst1q_f32(c3 + 16, vout3xGHIJ);
728 vst1q_f32(c3 + 20, vout3xKLMN);
729 vst1q_f32(c3 + 24, vout3xOPQR);
730 vst1q_f32(c3 + 28, vout3xSTUV);
731 vst1q_f32(c2, vout2x0123);
732 vst1q_f32(c2 + 4, vout2x4567);
733 vst1q_f32(c2 + 8, vout2x89AB);
734 vst1q_f32(c2 + 12, vout2xCDEF);
735 vst1q_f32(c2 + 16, vout2xGHIJ);
736 vst1q_f32(c2 + 20, vout2xKLMN);
737 vst1q_f32(c2 + 24, vout2xOPQR);
738 vst1q_f32(c2 + 28, vout2xSTUV);
739 vst1q_f32(c1, vout1x0123);
740 vst1q_f32(c1 + 4, vout1x4567);
741 vst1q_f32(c1 + 8, vout1x89AB);
742 vst1q_f32(c1 + 12, vout1xCDEF);
743 vst1q_f32(c1 + 16, vout1xGHIJ);
744 vst1q_f32(c1 + 20, vout1xKLMN);
745 vst1q_f32(c1 + 24, vout1xOPQR);
746 vst1q_f32(c1 + 28, vout1xSTUV);
747 vst1q_f32(c0, vout0x0123);
748 vst1q_f32(c0 + 4, vout0x4567);
749 vst1q_f32(c0 + 8, vout0x89AB);
750 vst1q_f32(c0 + 12, vout0xCDEF);
751 vst1q_f32(c0 + 16, vout0xGHIJ);
752 vst1q_f32(c0 + 20, vout0xKLMN);
753 vst1q_f32(c0 + 24, vout0xOPQR);
754 vst1q_f32(c0 + 28, vout0xSTUV);
755
756 a = (const int8_t**restrict) ((uintptr_t) a - ks);
757
758 c0 = (float*) ((uintptr_t) c0 + cn_stride);
759 c1 = (float*) ((uintptr_t) c1 + cn_stride);
760 c2 = (float*) ((uintptr_t) c2 + cn_stride);
761 c3 = (float*) ((uintptr_t) c3 + cn_stride);
762 c4 = (float*) ((uintptr_t) c4 + cn_stride);
763 c5 = (float*) ((uintptr_t) c5 + cn_stride);
764
765 nc -= 32;
766 } else {
767 if (nc & 16) {
768 vst1q_f32(c5, vout5x0123); c5 += 4;
769 vout5x0123 = vout5xGHIJ;
770 vst1q_f32(c4, vout4x0123); c4 += 4;
771 vout4x0123 = vout4xGHIJ;
772 vst1q_f32(c3, vout3x0123); c3 += 4;
773 vout3x0123 = vout3xGHIJ;
774 vst1q_f32(c2, vout2x0123); c2 += 4;
775 vout2x0123 = vout2xGHIJ;
776 vst1q_f32(c1, vout1x0123); c1 += 4;
777 vout1x0123 = vout1xGHIJ;
778 vst1q_f32(c0, vout0x0123); c0 += 4;
779 vout0x0123 = vout0xGHIJ;
780 vst1q_f32(c5, vout5x4567); c5 += 4;
781 vout5x4567 = vout5xKLMN;
782 vst1q_f32(c4, vout4x4567); c4 += 4;
783 vout4x4567 = vout4xKLMN;
784 vst1q_f32(c3, vout3x4567); c3 += 4;
785 vout3x4567 = vout3xKLMN;
786 vst1q_f32(c2, vout2x4567); c2 += 4;
787 vout2x4567 = vout2xKLMN;
788 vst1q_f32(c1, vout1x4567); c1 += 4;
789 vout1x4567 = vout1xKLMN;
790 vst1q_f32(c0, vout0x4567); c0 += 4;
791 vout0x4567 = vout0xKLMN;
792 vst1q_f32(c5, vout5x89AB); c5 += 4;
793 vout5x89AB = vout5xOPQR;
794 vst1q_f32(c4, vout4x89AB); c4 += 4;
795 vout4x89AB = vout4xOPQR;
796 vst1q_f32(c3, vout3x89AB); c3 += 4;
797 vout3x89AB = vout3xOPQR;
798 vst1q_f32(c2, vout2x89AB); c2 += 4;
799 vout2x89AB = vout2xOPQR;
800 vst1q_f32(c1, vout1x89AB); c1 += 4;
801 vout1x89AB = vout1xOPQR;
802 vst1q_f32(c0, vout0x89AB); c0 += 4;
803 vout0x89AB = vout0xOPQR;
804 vst1q_f32(c5, vout5xCDEF); c5 += 4;
805 vout5xCDEF = vout5xSTUV;
806 vst1q_f32(c4, vout4xCDEF); c4 += 4;
807 vout4xCDEF = vout4xSTUV;
808 vst1q_f32(c3, vout3xCDEF); c3 += 4;
809 vout3xCDEF = vout3xSTUV;
810 vst1q_f32(c2, vout2xCDEF); c2 += 4;
811 vout2xCDEF = vout2xSTUV;
812 vst1q_f32(c1, vout1xCDEF); c1 += 4;
813 vout1xCDEF = vout1xSTUV;
814 vst1q_f32(c0, vout0xCDEF); c0 += 4;
815 vout0xCDEF = vout0xSTUV;
816 }
817 if (nc & 8) {
818 vst1q_f32(c5, vout5x0123); c5 += 4;
819 vout5x0123 = vout5x89AB;
820 vst1q_f32(c4, vout4x0123); c4 += 4;
821 vout4x0123 = vout4x89AB;
822 vst1q_f32(c3, vout3x0123); c3 += 4;
823 vout3x0123 = vout3x89AB;
824 vst1q_f32(c2, vout2x0123); c2 += 4;
825 vout2x0123 = vout2x89AB;
826 vst1q_f32(c1, vout1x0123); c1 += 4;
827 vout1x0123 = vout1x89AB;
828 vst1q_f32(c0, vout0x0123); c0 += 4;
829 vout0x0123 = vout0x89AB;
830 vst1q_f32(c5, vout5x4567); c5 += 4;
831 vout5x4567 = vout5xCDEF;
832 vst1q_f32(c4, vout4x4567); c4 += 4;
833 vout4x4567 = vout4xCDEF;
834 vst1q_f32(c3, vout3x4567); c3 += 4;
835 vout3x4567 = vout3xCDEF;
836 vst1q_f32(c2, vout2x4567); c2 += 4;
837 vout2x4567 = vout2xCDEF;
838 vst1q_f32(c1, vout1x4567); c1 += 4;
839 vout1x4567 = vout1xCDEF;
840 vst1q_f32(c0, vout0x4567); c0 += 4;
841 vout0x4567 = vout0xCDEF;
842 }
843 if (nc & 4) {
844 vst1q_f32(c5, vout5x0123); c5 += 4;
845 vout5x0123 = vout5x4567;
846 vst1q_f32(c4, vout4x0123); c4 += 4;
847 vout4x0123 = vout4x4567;
848 vst1q_f32(c3, vout3x0123); c3 += 4;
849 vout3x0123 = vout3x4567;
850 vst1q_f32(c2, vout2x0123); c2 += 4;
851 vout2x0123 = vout2x4567;
852 vst1q_f32(c1, vout1x0123); c1 += 4;
853 vout1x0123 = vout1x4567;
854 vst1q_f32(c0, vout0x0123); c0 += 4;
855 vout0x0123 = vout0x4567;
856 }
857 float32x2_t vout5x01 = vget_low_f32(vout5x0123);
858 float32x2_t vout4x01 = vget_low_f32(vout4x0123);
859 float32x2_t vout3x01 = vget_low_f32(vout3x0123);
860 float32x2_t vout2x01 = vget_low_f32(vout2x0123);
861 float32x2_t vout1x01 = vget_low_f32(vout1x0123);
862 float32x2_t vout0x01 = vget_low_f32(vout0x0123);
863 if (nc & 2) {
864 vst1_f32(c5, vout5x01); c5 += 2;
865 vst1_f32(c4, vout4x01); c4 += 2;
866 vst1_f32(c3, vout3x01); c3 += 2;
867 vst1_f32(c2, vout2x01); c2 += 2;
868 vst1_f32(c1, vout1x01); c1 += 2;
869 vst1_f32(c0, vout0x01); c0 += 2;
870 vout5x01 = vget_high_f32(vout5x0123);
871 vout4x01 = vget_high_f32(vout4x0123);
872 vout3x01 = vget_high_f32(vout3x0123);
873 vout2x01 = vget_high_f32(vout2x0123);
874 vout1x01 = vget_high_f32(vout1x0123);
875 vout0x01 = vget_high_f32(vout0x0123);
876 }
877 if (nc & 1) {
878 vst1_lane_f32(c5, vout5x01, 0);
879 vst1_lane_f32(c4, vout4x01, 0);
880 vst1_lane_f32(c3, vout3x01, 0);
881 vst1_lane_f32(c2, vout2x01, 0);
882 vst1_lane_f32(c1, vout1x01, 0);
883 vst1_lane_f32(c0, vout0x01, 0);
884 }
885 nc = 0;
886 }
887 } while (nc != 0);
888 }