Debian Codegraph @

src/qd8-f32-qc8w-gemm/gen/qd8-f32-qc8w-gemm-8x16c8-minmax-neoni8mm.c

raw
1 // Auto-generated file. Do not edit!
2 // Template: src/qs8-gemm/c8-neoni8mm.c.in
3 // Generator: tools/xngen
4 //
5 // Copyright 2023 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/gemm.h"
15 #include "xnnpack/math.h"
16
17
18 void xnn_qd8_f32_qc8w_gemm_minmax_ukernel_8x16c8__neoni8mm(
19 size_t mr,
20 size_t nc,
21 size_t kc,
22 const int8_t* restrict a,
23 size_t a_stride,
24 const void* restrict w,
25 float* restrict c,
26 size_t cm_stride,
27 size_t cn_stride,
28 const union xnn_f32_minmax_params params[restrict XNN_MIN_ELEMENTS(1)],
29 const struct xnn_qd8_quantization_params quantization_params[restrict XNN_MIN_ELEMENTS(1)]) XNN_OOB_READS
30 {
31 assert(mr != 0);
32 assert(mr <= 8);
33 assert(nc != 0);
34 assert(kc != 0);
35 assert(kc % sizeof(int8_t) == 0);
36 assert(a != NULL);
37 assert(w != NULL);
38 assert(c != NULL);
39
40 kc = round_up_po2(kc, 8 * sizeof(int8_t));
41 const int8_t* a0 = a;
42 float* c0 = c;
43 const int8_t* a1 = (const int8_t*) ((uintptr_t) a0 + a_stride);
44 float* c1 = (float*) ((uintptr_t) c0 + cm_stride);
45 if XNN_UNPREDICTABLE(mr < 2) {
46 a1 = a0;
47 c1 = c0;
48 }
49 const int8_t* a2 = (const int8_t*) ((uintptr_t) a1 + a_stride);
50 float* c2 = (float*) ((uintptr_t) c1 + cm_stride);
51 if XNN_UNPREDICTABLE(mr <= 2) {
52 a2 = a1;
53 c2 = c1;
54 }
55 const int8_t* a3 = (const int8_t*) ((uintptr_t) a2 + a_stride);
56 float* c3 = (float*) ((uintptr_t) c2 + cm_stride);
57 if XNN_UNPREDICTABLE(mr < 4) {
58 a3 = a2;
59 c3 = c2;
60 }
61 const int8_t* a4 = (const int8_t*) ((uintptr_t) a3 + a_stride);
62 float* c4 = (float*) ((uintptr_t) c3 + cm_stride);
63 if XNN_UNPREDICTABLE(mr <= 4) {
64 a4 = a3;
65 c4 = c3;
66 }
67 const int8_t* a5 = (const int8_t*) ((uintptr_t) a4 + a_stride);
68 float* c5 = (float*) ((uintptr_t) c4 + cm_stride);
69 if XNN_UNPREDICTABLE(mr < 6) {
70 a5 = a4;
71 c5 = c4;
72 }
73 const int8_t* a6 = (const int8_t*) ((uintptr_t) a5 + a_stride);
74 float* c6 = (float*) ((uintptr_t) c5 + cm_stride);
75 if XNN_UNPREDICTABLE(mr <= 6) {
76 a6 = a5;
77 c6 = c5;
78 }
79 const int8_t* a7 = (const int8_t*) ((uintptr_t) a6 + a_stride);
80 float* c7 = (float*) ((uintptr_t) c6 + cm_stride);
81 if XNN_UNPREDICTABLE(mr != 8) {
82 a7 = a6;
83 c7 = c6;
84 }
85
86 // Loop over groups of 16 columns.
87 do {
88 // Initialize accumulators with bias. 16 bias values are loaded from the
89 // weight matrix, at the start of the group of 16 columns.
90 const int32x4_t vinput_zero_point01 = vld1q_s32(&quantization_params[0].zero_point);
91 const int32x4_t vksum0123 = vld1q_s32(w); w = (const int32_t*) w + 4;
92 const int32x4_t vksumzp0x0123 = vmulq_lane_s32(vksum0123, vget_low_s32(vinput_zero_point01), 0);
93 const int32x4_t vksumzp1x0123 = vmulq_lane_s32(vksum0123, vget_high_s32(vinput_zero_point01), 0);
94 const int32x4_t vksum4567 = vld1q_s32(w); w = (const int32_t*) w + 4;
95 const int32x4_t vksumzp0x4567 = vmulq_lane_s32(vksum4567, vget_low_s32(vinput_zero_point01), 0);
96 const int32x4_t vksumzp1x4567 = vmulq_lane_s32(vksum4567, vget_high_s32(vinput_zero_point01), 0);
97 const int32x4_t vksum89AB = vld1q_s32(w); w = (const int32_t*) w + 4;
98 const int32x4_t vksumzp0x89AB = vmulq_lane_s32(vksum89AB, vget_low_s32(vinput_zero_point01), 0);
99 const int32x4_t vksumzp1x89AB = vmulq_lane_s32(vksum89AB, vget_high_s32(vinput_zero_point01), 0);
100 const int32x4_t vksumCDEF = vld1q_s32(w); w = (const int32_t*) w + 4;
101 const int32x4_t vksumzp0xCDEF = vmulq_lane_s32(vksumCDEF, vget_low_s32(vinput_zero_point01), 0);
102 const int32x4_t vksumzp1xCDEF = vmulq_lane_s32(vksumCDEF, vget_high_s32(vinput_zero_point01), 0);
103 const int32x4_t vinput_zero_point23 = vld1q_s32(&quantization_params[2].zero_point);
104 const int32x4_t vksumzp2x0123 = vmulq_lane_s32(vksum0123, vget_low_s32(vinput_zero_point23), 0);
105 const int32x4_t vksumzp3x0123 = vmulq_lane_s32(vksum0123, vget_high_s32(vinput_zero_point23), 0);
106 const int32x4_t vksumzp2x4567 = vmulq_lane_s32(vksum4567, vget_low_s32(vinput_zero_point23), 0);
107 const int32x4_t vksumzp3x4567 = vmulq_lane_s32(vksum4567, vget_high_s32(vinput_zero_point23), 0);
108 const int32x4_t vksumzp2x89AB = vmulq_lane_s32(vksum89AB, vget_low_s32(vinput_zero_point23), 0);
109 const int32x4_t vksumzp3x89AB = vmulq_lane_s32(vksum89AB, vget_high_s32(vinput_zero_point23), 0);
110 const int32x4_t vksumzp2xCDEF = vmulq_lane_s32(vksumCDEF, vget_low_s32(vinput_zero_point23), 0);
111 const int32x4_t vksumzp3xCDEF = vmulq_lane_s32(vksumCDEF, vget_high_s32(vinput_zero_point23), 0);
112 const int32x4_t vinput_zero_point45 = vld1q_s32(&quantization_params[4].zero_point);
113 const int32x4_t vksumzp4x0123 = vmulq_lane_s32(vksum0123, vget_low_s32(vinput_zero_point45), 0);
114 const int32x4_t vksumzp5x0123 = vmulq_lane_s32(vksum0123, vget_high_s32(vinput_zero_point45), 0);
115 const int32x4_t vksumzp4x4567 = vmulq_lane_s32(vksum4567, vget_low_s32(vinput_zero_point45), 0);
116 const int32x4_t vksumzp5x4567 = vmulq_lane_s32(vksum4567, vget_high_s32(vinput_zero_point45), 0);
117 const int32x4_t vksumzp4x89AB = vmulq_lane_s32(vksum89AB, vget_low_s32(vinput_zero_point45), 0);
118 const int32x4_t vksumzp5x89AB = vmulq_lane_s32(vksum89AB, vget_high_s32(vinput_zero_point45), 0);
119 const int32x4_t vksumzp4xCDEF = vmulq_lane_s32(vksumCDEF, vget_low_s32(vinput_zero_point45), 0);
120 const int32x4_t vksumzp5xCDEF = vmulq_lane_s32(vksumCDEF, vget_high_s32(vinput_zero_point45), 0);
121 const int32x4_t vinput_zero_point67 = vld1q_s32(&quantization_params[6].zero_point);
122 const int32x4_t vksumzp6x0123 = vmulq_lane_s32(vksum0123, vget_low_s32(vinput_zero_point67), 0);
123 const int32x4_t vksumzp7x0123 = vmulq_lane_s32(vksum0123, vget_high_s32(vinput_zero_point67), 0);
124 const int32x4_t vksumzp6x4567 = vmulq_lane_s32(vksum4567, vget_low_s32(vinput_zero_point67), 0);
125 const int32x4_t vksumzp7x4567 = vmulq_lane_s32(vksum4567, vget_high_s32(vinput_zero_point67), 0);
126 const int32x4_t vksumzp6x89AB = vmulq_lane_s32(vksum89AB, vget_low_s32(vinput_zero_point67), 0);
127 const int32x4_t vksumzp7x89AB = vmulq_lane_s32(vksum89AB, vget_high_s32(vinput_zero_point67), 0);
128 const int32x4_t vksumzp6xCDEF = vmulq_lane_s32(vksumCDEF, vget_low_s32(vinput_zero_point67), 0);
129 const int32x4_t vksumzp7xCDEF = vmulq_lane_s32(vksumCDEF, vget_high_s32(vinput_zero_point67), 0);
130
131 int32x4_t vacc01x01 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp0x0123), vreinterpretq_u64_s32(vksumzp1x0123)));
132 int32x4_t vacc01x23 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp0x0123), vreinterpretq_u64_s32(vksumzp1x0123)));
133 int32x4_t vacc01x45 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp0x4567), vreinterpretq_u64_s32(vksumzp1x4567)));
134 int32x4_t vacc01x67 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp0x4567), vreinterpretq_u64_s32(vksumzp1x4567)));
135 int32x4_t vacc01x89 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp0x89AB), vreinterpretq_u64_s32(vksumzp1x89AB)));
136 int32x4_t vacc01xAB = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp0x89AB), vreinterpretq_u64_s32(vksumzp1x89AB)));
137 int32x4_t vacc01xCD = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp0xCDEF), vreinterpretq_u64_s32(vksumzp1xCDEF)));
138 int32x4_t vacc01xEF = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp0xCDEF), vreinterpretq_u64_s32(vksumzp1xCDEF)));
139 int32x4_t vacc23x01 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp2x0123), vreinterpretq_u64_s32(vksumzp3x0123)));
140 int32x4_t vacc23x23 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp2x0123), vreinterpretq_u64_s32(vksumzp3x0123)));
141 int32x4_t vacc23x45 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp2x4567), vreinterpretq_u64_s32(vksumzp3x4567)));
142 int32x4_t vacc23x67 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp2x4567), vreinterpretq_u64_s32(vksumzp3x4567)));
143 int32x4_t vacc23x89 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp2x89AB), vreinterpretq_u64_s32(vksumzp3x89AB)));
144 int32x4_t vacc23xAB = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp2x89AB), vreinterpretq_u64_s32(vksumzp3x89AB)));
145 int32x4_t vacc23xCD = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp2xCDEF), vreinterpretq_u64_s32(vksumzp3xCDEF)));
146 int32x4_t vacc23xEF = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp2xCDEF), vreinterpretq_u64_s32(vksumzp3xCDEF)));
147 int32x4_t vacc45x01 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp4x0123), vreinterpretq_u64_s32(vksumzp5x0123)));
148 int32x4_t vacc45x23 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp4x0123), vreinterpretq_u64_s32(vksumzp5x0123)));
149 int32x4_t vacc45x45 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp4x4567), vreinterpretq_u64_s32(vksumzp5x4567)));
150 int32x4_t vacc45x67 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp4x4567), vreinterpretq_u64_s32(vksumzp5x4567)));
151 int32x4_t vacc45x89 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp4x89AB), vreinterpretq_u64_s32(vksumzp5x89AB)));
152 int32x4_t vacc45xAB = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp4x89AB), vreinterpretq_u64_s32(vksumzp5x89AB)));
153 int32x4_t vacc45xCD = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp4xCDEF), vreinterpretq_u64_s32(vksumzp5xCDEF)));
154 int32x4_t vacc45xEF = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp4xCDEF), vreinterpretq_u64_s32(vksumzp5xCDEF)));
155 int32x4_t vacc67x01 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp6x0123), vreinterpretq_u64_s32(vksumzp7x0123)));
156 int32x4_t vacc67x23 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp6x0123), vreinterpretq_u64_s32(vksumzp7x0123)));
157 int32x4_t vacc67x45 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp6x4567), vreinterpretq_u64_s32(vksumzp7x4567)));
158 int32x4_t vacc67x67 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp6x4567), vreinterpretq_u64_s32(vksumzp7x4567)));
159 int32x4_t vacc67x89 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp6x89AB), vreinterpretq_u64_s32(vksumzp7x89AB)));
160 int32x4_t vacc67xAB = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp6x89AB), vreinterpretq_u64_s32(vksumzp7x89AB)));
161 int32x4_t vacc67xCD = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp6xCDEF), vreinterpretq_u64_s32(vksumzp7xCDEF)));
162 int32x4_t vacc67xEF = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp6xCDEF), vreinterpretq_u64_s32(vksumzp7xCDEF)));
163
164 // Inner accumulation loop along the 16 columns.
165 size_t k = kc;
166 // 2x partial unrolled loop to load 8 bytes at a time.
167
168 uint64x2x2_t va01x0123456789ABCDEF;
169 va01x0123456789ABCDEF.val[0] = vdupq_n_u64(0);
170 va01x0123456789ABCDEF.val[1] = vdupq_n_u64(0);
171 uint64x2x2_t va23x0123456789ABCDEF;
172 va23x0123456789ABCDEF.val[0] = vdupq_n_u64(0);
173 va23x0123456789ABCDEF.val[1] = vdupq_n_u64(0);
174 uint64x2x2_t va45x0123456789ABCDEF;
175 va45x0123456789ABCDEF.val[0] = vdupq_n_u64(0);
176 va45x0123456789ABCDEF.val[1] = vdupq_n_u64(0);
177 uint64x2x2_t va67x0123456789ABCDEF;
178 va67x0123456789ABCDEF.val[0] = vdupq_n_u64(0);
179 va67x0123456789ABCDEF.val[1] = vdupq_n_u64(0);
180
181 while (k >= 16 * sizeof(int8_t)) {
182 // Load a 8x16 block of activations.
183 va01x0123456789ABCDEF = vld2q_lane_u64((const void*) a0, va01x0123456789ABCDEF, 0); a0 += 16;
184 va23x0123456789ABCDEF = vld2q_lane_u64((const void*) a2, va23x0123456789ABCDEF, 0); a2 += 16;
185 va45x0123456789ABCDEF = vld2q_lane_u64((const void*) a4, va45x0123456789ABCDEF, 0); a4 += 16;
186 va67x0123456789ABCDEF = vld2q_lane_u64((const void*) a6, va67x0123456789ABCDEF, 0); a6 += 16;
187 va01x0123456789ABCDEF = vld2q_lane_u64((const void*) a1, va01x0123456789ABCDEF, 1); a1 += 16;
188 va23x0123456789ABCDEF = vld2q_lane_u64((const void*) a3, va23x0123456789ABCDEF, 1); a3 += 16;
189 va45x0123456789ABCDEF = vld2q_lane_u64((const void*) a5, va45x0123456789ABCDEF, 1); a5 += 16;
190 va67x0123456789ABCDEF = vld2q_lane_u64((const void*) a7, va67x0123456789ABCDEF, 1); a7 += 16;
191
192 const int8x16_t va01x01234567 = vreinterpretq_s8_u64(va01x0123456789ABCDEF.val[0]);
193 const int8x16_t va01x89ABCDEF = vreinterpretq_s8_u64(va01x0123456789ABCDEF.val[1]);
194 const int8x16_t va23x01234567 = vreinterpretq_s8_u64(va23x0123456789ABCDEF.val[0]);
195 const int8x16_t va23x89ABCDEF = vreinterpretq_s8_u64(va23x0123456789ABCDEF.val[1]);
196 const int8x16_t va45x01234567 = vreinterpretq_s8_u64(va45x0123456789ABCDEF.val[0]);
197 const int8x16_t va45x89ABCDEF = vreinterpretq_s8_u64(va45x0123456789ABCDEF.val[1]);
198 const int8x16_t va67x01234567 = vreinterpretq_s8_u64(va67x0123456789ABCDEF.val[0]);
199 const int8x16_t va67x89ABCDEF = vreinterpretq_s8_u64(va67x0123456789ABCDEF.val[1]);
200
201 // Load a 16x16 block of weights.
202 const int8x16_t vb01x01234567 = vld1q_s8(w); w = (const int8_t*) w + 16;
203 const int8x16_t vb23x01234567 = vld1q_s8(w); w = (const int8_t*) w + 16;
204 const int8x16_t vb45x01234567 = vld1q_s8(w); w = (const int8_t*) w + 16;
205 const int8x16_t vb67x01234567 = vld1q_s8(w); w = (const int8_t*) w + 16;
206 const int8x16_t vb89x01234567 = vld1q_s8(w); w = (const int8_t*) w + 16;
207 const int8x16_t vbABx01234567 = vld1q_s8(w); w = (const int8_t*) w + 16;
208 const int8x16_t vbCDx01234567 = vld1q_s8(w); w = (const int8_t*) w + 16;
209 const int8x16_t vbEFx01234567 = vld1q_s8(w); w = (const int8_t*) w + 16;
210 const int8x16_t vb01x89ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
211 const int8x16_t vb23x89ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
212 const int8x16_t vb45x89ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
213 const int8x16_t vb67x89ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
214 const int8x16_t vb89x89ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
215 const int8x16_t vbABx89ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
216 const int8x16_t vbCDx89ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
217 const int8x16_t vbEFx89ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
218
219 // Multiply-accumulate: 8x8 * 8x16 --> 8x16.
220 vacc01x01 = vmmlaq_s32(vacc01x01, va01x01234567, vb01x01234567);
221 vacc01x23 = vmmlaq_s32(vacc01x23, va01x01234567, vb23x01234567);
222 vacc01x45 = vmmlaq_s32(vacc01x45, va01x01234567, vb45x01234567);
223 vacc01x67 = vmmlaq_s32(vacc01x67, va01x01234567, vb67x01234567);
224 vacc01x89 = vmmlaq_s32(vacc01x89, va01x01234567, vb89x01234567);
225 vacc01xAB = vmmlaq_s32(vacc01xAB, va01x01234567, vbABx01234567);
226 vacc01xCD = vmmlaq_s32(vacc01xCD, va01x01234567, vbCDx01234567);
227 vacc01xEF = vmmlaq_s32(vacc01xEF, va01x01234567, vbEFx01234567);
228 vacc23x01 = vmmlaq_s32(vacc23x01, va23x01234567, vb01x01234567);
229 vacc23x23 = vmmlaq_s32(vacc23x23, va23x01234567, vb23x01234567);
230 vacc23x45 = vmmlaq_s32(vacc23x45, va23x01234567, vb45x01234567);
231 vacc23x67 = vmmlaq_s32(vacc23x67, va23x01234567, vb67x01234567);
232 vacc23x89 = vmmlaq_s32(vacc23x89, va23x01234567, vb89x01234567);
233 vacc23xAB = vmmlaq_s32(vacc23xAB, va23x01234567, vbABx01234567);
234 vacc23xCD = vmmlaq_s32(vacc23xCD, va23x01234567, vbCDx01234567);
235 vacc23xEF = vmmlaq_s32(vacc23xEF, va23x01234567, vbEFx01234567);
236 vacc45x01 = vmmlaq_s32(vacc45x01, va45x01234567, vb01x01234567);
237 vacc45x23 = vmmlaq_s32(vacc45x23, va45x01234567, vb23x01234567);
238 vacc45x45 = vmmlaq_s32(vacc45x45, va45x01234567, vb45x01234567);
239 vacc45x67 = vmmlaq_s32(vacc45x67, va45x01234567, vb67x01234567);
240 vacc45x89 = vmmlaq_s32(vacc45x89, va45x01234567, vb89x01234567);
241 vacc45xAB = vmmlaq_s32(vacc45xAB, va45x01234567, vbABx01234567);
242 vacc45xCD = vmmlaq_s32(vacc45xCD, va45x01234567, vbCDx01234567);
243 vacc45xEF = vmmlaq_s32(vacc45xEF, va45x01234567, vbEFx01234567);
244 vacc67x01 = vmmlaq_s32(vacc67x01, va67x01234567, vb01x01234567);
245 vacc67x23 = vmmlaq_s32(vacc67x23, va67x01234567, vb23x01234567);
246 vacc67x45 = vmmlaq_s32(vacc67x45, va67x01234567, vb45x01234567);
247 vacc67x67 = vmmlaq_s32(vacc67x67, va67x01234567, vb67x01234567);
248 vacc67x89 = vmmlaq_s32(vacc67x89, va67x01234567, vb89x01234567);
249 vacc67xAB = vmmlaq_s32(vacc67xAB, va67x01234567, vbABx01234567);
250 vacc67xCD = vmmlaq_s32(vacc67xCD, va67x01234567, vbCDx01234567);
251 vacc67xEF = vmmlaq_s32(vacc67xEF, va67x01234567, vbEFx01234567);
252 vacc01x01 = vmmlaq_s32(vacc01x01, va01x89ABCDEF, vb01x89ABCDEF);
253 vacc01x23 = vmmlaq_s32(vacc01x23, va01x89ABCDEF, vb23x89ABCDEF);
254 vacc01x45 = vmmlaq_s32(vacc01x45, va01x89ABCDEF, vb45x89ABCDEF);
255 vacc01x67 = vmmlaq_s32(vacc01x67, va01x89ABCDEF, vb67x89ABCDEF);
256 vacc01x89 = vmmlaq_s32(vacc01x89, va01x89ABCDEF, vb89x89ABCDEF);
257 vacc01xAB = vmmlaq_s32(vacc01xAB, va01x89ABCDEF, vbABx89ABCDEF);
258 vacc01xCD = vmmlaq_s32(vacc01xCD, va01x89ABCDEF, vbCDx89ABCDEF);
259 vacc01xEF = vmmlaq_s32(vacc01xEF, va01x89ABCDEF, vbEFx89ABCDEF);
260 vacc23x01 = vmmlaq_s32(vacc23x01, va23x89ABCDEF, vb01x89ABCDEF);
261 vacc23x23 = vmmlaq_s32(vacc23x23, va23x89ABCDEF, vb23x89ABCDEF);
262 vacc23x45 = vmmlaq_s32(vacc23x45, va23x89ABCDEF, vb45x89ABCDEF);
263 vacc23x67 = vmmlaq_s32(vacc23x67, va23x89ABCDEF, vb67x89ABCDEF);
264 vacc23x89 = vmmlaq_s32(vacc23x89, va23x89ABCDEF, vb89x89ABCDEF);
265 vacc23xAB = vmmlaq_s32(vacc23xAB, va23x89ABCDEF, vbABx89ABCDEF);
266 vacc23xCD = vmmlaq_s32(vacc23xCD, va23x89ABCDEF, vbCDx89ABCDEF);
267 vacc23xEF = vmmlaq_s32(vacc23xEF, va23x89ABCDEF, vbEFx89ABCDEF);
268 vacc45x01 = vmmlaq_s32(vacc45x01, va45x89ABCDEF, vb01x89ABCDEF);
269 vacc45x23 = vmmlaq_s32(vacc45x23, va45x89ABCDEF, vb23x89ABCDEF);
270 vacc45x45 = vmmlaq_s32(vacc45x45, va45x89ABCDEF, vb45x89ABCDEF);
271 vacc45x67 = vmmlaq_s32(vacc45x67, va45x89ABCDEF, vb67x89ABCDEF);
272 vacc45x89 = vmmlaq_s32(vacc45x89, va45x89ABCDEF, vb89x89ABCDEF);
273 vacc45xAB = vmmlaq_s32(vacc45xAB, va45x89ABCDEF, vbABx89ABCDEF);
274 vacc45xCD = vmmlaq_s32(vacc45xCD, va45x89ABCDEF, vbCDx89ABCDEF);
275 vacc45xEF = vmmlaq_s32(vacc45xEF, va45x89ABCDEF, vbEFx89ABCDEF);
276 vacc67x01 = vmmlaq_s32(vacc67x01, va67x89ABCDEF, vb01x89ABCDEF);
277 vacc67x23 = vmmlaq_s32(vacc67x23, va67x89ABCDEF, vb23x89ABCDEF);
278 vacc67x45 = vmmlaq_s32(vacc67x45, va67x89ABCDEF, vb45x89ABCDEF);
279 vacc67x67 = vmmlaq_s32(vacc67x67, va67x89ABCDEF, vb67x89ABCDEF);
280 vacc67x89 = vmmlaq_s32(vacc67x89, va67x89ABCDEF, vb89x89ABCDEF);
281 vacc67xAB = vmmlaq_s32(vacc67xAB, va67x89ABCDEF, vbABx89ABCDEF);
282 vacc67xCD = vmmlaq_s32(vacc67xCD, va67x89ABCDEF, vbCDx89ABCDEF);
283 vacc67xEF = vmmlaq_s32(vacc67xEF, va67x89ABCDEF, vbEFx89ABCDEF);
284
285 k -= 16 * sizeof(int8_t);
286 }
287 // Handle up to 8 final positions of `k`
288 if XNN_UNLIKELY(k != 0) {
289 // Load a 8x8 block of activations.
290 uint64x2_t va01x01234567 = vld1q_dup_u64((const void*) a0); a0 += 8;
291 uint64x2_t va23x01234567 = vld1q_dup_u64((const void*) a2); a2 += 8;
292 uint64x2_t va45x01234567 = vld1q_dup_u64((const void*) a4); a4 += 8;
293 uint64x2_t va67x01234567 = vld1q_dup_u64((const void*) a6); a6 += 8;
294 va01x01234567 = vld1q_lane_u64((const void*) a1, va01x01234567, 1); a1 += 8;
295 va23x01234567 = vld1q_lane_u64((const void*) a3, va23x01234567, 1); a3 += 8;
296 va45x01234567 = vld1q_lane_u64((const void*) a5, va45x01234567, 1); a5 += 8;
297 va67x01234567 = vld1q_lane_u64((const void*) a7, va67x01234567, 1); a7 += 8;
298
299 // Load a 16x16 block of weights.
300 const int8x16_t vb01x01234567 = vld1q_s8(w); w = (const int8_t*) w + 16;
301 const int8x16_t vb23x01234567 = vld1q_s8(w); w = (const int8_t*) w + 16;
302 const int8x16_t vb45x01234567 = vld1q_s8(w); w = (const int8_t*) w + 16;
303 const int8x16_t vb67x01234567 = vld1q_s8(w); w = (const int8_t*) w + 16;
304 const int8x16_t vb89x01234567 = vld1q_s8(w); w = (const int8_t*) w + 16;
305 const int8x16_t vbABx01234567 = vld1q_s8(w); w = (const int8_t*) w + 16;
306 const int8x16_t vbCDx01234567 = vld1q_s8(w); w = (const int8_t*) w + 16;
307 const int8x16_t vbEFx01234567 = vld1q_s8(w); w = (const int8_t*) w + 16;
308
309 // Multiply-accumulate: 8x4 * 4x16 --> 8x16.
310 vacc01x01 = vmmlaq_s32(vacc01x01, vreinterpretq_s8_u64(va01x01234567), vb01x01234567);
311 vacc01x23 = vmmlaq_s32(vacc01x23, vreinterpretq_s8_u64(va01x01234567), vb23x01234567);
312 vacc01x45 = vmmlaq_s32(vacc01x45, vreinterpretq_s8_u64(va01x01234567), vb45x01234567);
313 vacc01x67 = vmmlaq_s32(vacc01x67, vreinterpretq_s8_u64(va01x01234567), vb67x01234567);
314 vacc01x89 = vmmlaq_s32(vacc01x89, vreinterpretq_s8_u64(va01x01234567), vb89x01234567);
315 vacc01xAB = vmmlaq_s32(vacc01xAB, vreinterpretq_s8_u64(va01x01234567), vbABx01234567);
316 vacc01xCD = vmmlaq_s32(vacc01xCD, vreinterpretq_s8_u64(va01x01234567), vbCDx01234567);
317 vacc01xEF = vmmlaq_s32(vacc01xEF, vreinterpretq_s8_u64(va01x01234567), vbEFx01234567);
318 vacc23x01 = vmmlaq_s32(vacc23x01, vreinterpretq_s8_u64(va23x01234567), vb01x01234567);
319 vacc23x23 = vmmlaq_s32(vacc23x23, vreinterpretq_s8_u64(va23x01234567), vb23x01234567);
320 vacc23x45 = vmmlaq_s32(vacc23x45, vreinterpretq_s8_u64(va23x01234567), vb45x01234567);
321 vacc23x67 = vmmlaq_s32(vacc23x67, vreinterpretq_s8_u64(va23x01234567), vb67x01234567);
322 vacc23x89 = vmmlaq_s32(vacc23x89, vreinterpretq_s8_u64(va23x01234567), vb89x01234567);
323 vacc23xAB = vmmlaq_s32(vacc23xAB, vreinterpretq_s8_u64(va23x01234567), vbABx01234567);
324 vacc23xCD = vmmlaq_s32(vacc23xCD, vreinterpretq_s8_u64(va23x01234567), vbCDx01234567);
325 vacc23xEF = vmmlaq_s32(vacc23xEF, vreinterpretq_s8_u64(va23x01234567), vbEFx01234567);
326 vacc45x01 = vmmlaq_s32(vacc45x01, vreinterpretq_s8_u64(va45x01234567), vb01x01234567);
327 vacc45x23 = vmmlaq_s32(vacc45x23, vreinterpretq_s8_u64(va45x01234567), vb23x01234567);
328 vacc45x45 = vmmlaq_s32(vacc45x45, vreinterpretq_s8_u64(va45x01234567), vb45x01234567);
329 vacc45x67 = vmmlaq_s32(vacc45x67, vreinterpretq_s8_u64(va45x01234567), vb67x01234567);
330 vacc45x89 = vmmlaq_s32(vacc45x89, vreinterpretq_s8_u64(va45x01234567), vb89x01234567);
331 vacc45xAB = vmmlaq_s32(vacc45xAB, vreinterpretq_s8_u64(va45x01234567), vbABx01234567);
332 vacc45xCD = vmmlaq_s32(vacc45xCD, vreinterpretq_s8_u64(va45x01234567), vbCDx01234567);
333 vacc45xEF = vmmlaq_s32(vacc45xEF, vreinterpretq_s8_u64(va45x01234567), vbEFx01234567);
334 vacc67x01 = vmmlaq_s32(vacc67x01, vreinterpretq_s8_u64(va67x01234567), vb01x01234567);
335 vacc67x23 = vmmlaq_s32(vacc67x23, vreinterpretq_s8_u64(va67x01234567), vb23x01234567);
336 vacc67x45 = vmmlaq_s32(vacc67x45, vreinterpretq_s8_u64(va67x01234567), vb45x01234567);
337 vacc67x67 = vmmlaq_s32(vacc67x67, vreinterpretq_s8_u64(va67x01234567), vb67x01234567);
338 vacc67x89 = vmmlaq_s32(vacc67x89, vreinterpretq_s8_u64(va67x01234567), vb89x01234567);
339 vacc67xAB = vmmlaq_s32(vacc67xAB, vreinterpretq_s8_u64(va67x01234567), vbABx01234567);
340 vacc67xCD = vmmlaq_s32(vacc67xCD, vreinterpretq_s8_u64(va67x01234567), vbCDx01234567);
341 vacc67xEF = vmmlaq_s32(vacc67xEF, vreinterpretq_s8_u64(va67x01234567), vbEFx01234567);
342 }
343
344 int32x4_t vacc0x0123 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01x01), vreinterpretq_u64_s32(vacc01x23)));
345 int32x4_t vacc1x0123 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01x01), vreinterpretq_u64_s32(vacc01x23)));
346 int32x4_t vacc0x4567 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01x45), vreinterpretq_u64_s32(vacc01x67)));
347 int32x4_t vacc1x4567 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01x45), vreinterpretq_u64_s32(vacc01x67)));
348 int32x4_t vacc0x89AB = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01x89), vreinterpretq_u64_s32(vacc01xAB)));
349 int32x4_t vacc1x89AB = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01x89), vreinterpretq_u64_s32(vacc01xAB)));
350 int32x4_t vacc0xCDEF = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01xCD), vreinterpretq_u64_s32(vacc01xEF)));
351 int32x4_t vacc1xCDEF = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01xCD), vreinterpretq_u64_s32(vacc01xEF)));
352 int32x4_t vacc2x0123 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23x01), vreinterpretq_u64_s32(vacc23x23)));
353 int32x4_t vacc3x0123 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc23x01), vreinterpretq_u64_s32(vacc23x23)));
354 int32x4_t vacc2x4567 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23x45), vreinterpretq_u64_s32(vacc23x67)));
355 int32x4_t vacc3x4567 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc23x45), vreinterpretq_u64_s32(vacc23x67)));
356 int32x4_t vacc2x89AB = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23x89), vreinterpretq_u64_s32(vacc23xAB)));
357 int32x4_t vacc3x89AB = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc23x89), vreinterpretq_u64_s32(vacc23xAB)));
358 int32x4_t vacc2xCDEF = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23xCD), vreinterpretq_u64_s32(vacc23xEF)));
359 int32x4_t vacc3xCDEF = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc23xCD), vreinterpretq_u64_s32(vacc23xEF)));
360 int32x4_t vacc4x0123 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc45x01), vreinterpretq_u64_s32(vacc45x23)));
361 int32x4_t vacc5x0123 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc45x01), vreinterpretq_u64_s32(vacc45x23)));
362 int32x4_t vacc4x4567 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc45x45), vreinterpretq_u64_s32(vacc45x67)));
363 int32x4_t vacc5x4567 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc45x45), vreinterpretq_u64_s32(vacc45x67)));
364 int32x4_t vacc4x89AB = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc45x89), vreinterpretq_u64_s32(vacc45xAB)));
365 int32x4_t vacc5x89AB = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc45x89), vreinterpretq_u64_s32(vacc45xAB)));
366 int32x4_t vacc4xCDEF = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc45xCD), vreinterpretq_u64_s32(vacc45xEF)));
367 int32x4_t vacc5xCDEF = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc45xCD), vreinterpretq_u64_s32(vacc45xEF)));
368 int32x4_t vacc6x0123 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc67x01), vreinterpretq_u64_s32(vacc67x23)));
369 int32x4_t vacc7x0123 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc67x01), vreinterpretq_u64_s32(vacc67x23)));
370 int32x4_t vacc6x4567 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc67x45), vreinterpretq_u64_s32(vacc67x67)));
371 int32x4_t vacc7x4567 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc67x45), vreinterpretq_u64_s32(vacc67x67)));
372 int32x4_t vacc6x89AB = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc67x89), vreinterpretq_u64_s32(vacc67xAB)));
373 int32x4_t vacc7x89AB = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc67x89), vreinterpretq_u64_s32(vacc67xAB)));
374 int32x4_t vacc6xCDEF = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc67xCD), vreinterpretq_u64_s32(vacc67xEF)));
375 int32x4_t vacc7xCDEF = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc67xCD), vreinterpretq_u64_s32(vacc67xEF)));
376 float32x4_t vout0x0123 = vcvtq_f32_s32(vacc0x0123);
377 float32x4_t vout0x4567 = vcvtq_f32_s32(vacc0x4567);
378 float32x4_t vout0x89AB = vcvtq_f32_s32(vacc0x89AB);
379 float32x4_t vout0xCDEF = vcvtq_f32_s32(vacc0xCDEF);
380 float32x4_t vout1x0123 = vcvtq_f32_s32(vacc1x0123);
381 float32x4_t vout1x4567 = vcvtq_f32_s32(vacc1x4567);
382 float32x4_t vout1x89AB = vcvtq_f32_s32(vacc1x89AB);
383 float32x4_t vout1xCDEF = vcvtq_f32_s32(vacc1xCDEF);
384 float32x4_t vout2x0123 = vcvtq_f32_s32(vacc2x0123);
385 float32x4_t vout2x4567 = vcvtq_f32_s32(vacc2x4567);
386 float32x4_t vout2x89AB = vcvtq_f32_s32(vacc2x89AB);
387 float32x4_t vout2xCDEF = vcvtq_f32_s32(vacc2xCDEF);
388 float32x4_t vout3x0123 = vcvtq_f32_s32(vacc3x0123);
389 float32x4_t vout3x4567 = vcvtq_f32_s32(vacc3x4567);
390 float32x4_t vout3x89AB = vcvtq_f32_s32(vacc3x89AB);
391 float32x4_t vout3xCDEF = vcvtq_f32_s32(vacc3xCDEF);
392 float32x4_t vout4x0123 = vcvtq_f32_s32(vacc4x0123);
393 float32x4_t vout4x4567 = vcvtq_f32_s32(vacc4x4567);
394 float32x4_t vout4x89AB = vcvtq_f32_s32(vacc4x89AB);
395 float32x4_t vout4xCDEF = vcvtq_f32_s32(vacc4xCDEF);
396 float32x4_t vout5x0123 = vcvtq_f32_s32(vacc5x0123);
397 float32x4_t vout5x4567 = vcvtq_f32_s32(vacc5x4567);
398 float32x4_t vout5x89AB = vcvtq_f32_s32(vacc5x89AB);
399 float32x4_t vout5xCDEF = vcvtq_f32_s32(vacc5xCDEF);
400 float32x4_t vout6x0123 = vcvtq_f32_s32(vacc6x0123);
401 float32x4_t vout6x4567 = vcvtq_f32_s32(vacc6x4567);
402 float32x4_t vout6x89AB = vcvtq_f32_s32(vacc6x89AB);
403 float32x4_t vout6xCDEF = vcvtq_f32_s32(vacc6xCDEF);
404 float32x4_t vout7x0123 = vcvtq_f32_s32(vacc7x0123);
405 float32x4_t vout7x4567 = vcvtq_f32_s32(vacc7x4567);
406 float32x4_t vout7x89AB = vcvtq_f32_s32(vacc7x89AB);
407 float32x4_t vout7xCDEF = vcvtq_f32_s32(vacc7xCDEF);
408
409 const float32x4_t vinput_scale01 = vreinterpretq_f32_s32(vld1q_s32(&quantization_params[0].zero_point));
410 vout0x0123 = vmulq_lane_f32(vout0x0123, vget_low_f32(vinput_scale01), 1);
411 vout1x0123 = vmulq_lane_f32(vout1x0123, vget_high_f32(vinput_scale01), 1);
412 vout0x4567 = vmulq_lane_f32(vout0x4567, vget_low_f32(vinput_scale01), 1);
413 vout1x4567 = vmulq_lane_f32(vout1x4567, vget_high_f32(vinput_scale01), 1);
414 vout0x89AB = vmulq_lane_f32(vout0x89AB, vget_low_f32(vinput_scale01), 1);
415 vout1x89AB = vmulq_lane_f32(vout1x89AB, vget_high_f32(vinput_scale01), 1);
416 vout0xCDEF = vmulq_lane_f32(vout0xCDEF, vget_low_f32(vinput_scale01), 1);
417 vout1xCDEF = vmulq_lane_f32(vout1xCDEF, vget_high_f32(vinput_scale01), 1);
418 const float32x4_t vinput_scale23 = vreinterpretq_f32_s32(vld1q_s32(&quantization_params[2].zero_point));
419 vout2x0123 = vmulq_lane_f32(vout2x0123, vget_low_f32(vinput_scale23), 1);
420 vout3x0123 = vmulq_lane_f32(vout3x0123, vget_high_f32(vinput_scale23), 1);
421 vout2x4567 = vmulq_lane_f32(vout2x4567, vget_low_f32(vinput_scale23), 1);
422 vout3x4567 = vmulq_lane_f32(vout3x4567, vget_high_f32(vinput_scale23), 1);
423 vout2x89AB = vmulq_lane_f32(vout2x89AB, vget_low_f32(vinput_scale23), 1);
424 vout3x89AB = vmulq_lane_f32(vout3x89AB, vget_high_f32(vinput_scale23), 1);
425 vout2xCDEF = vmulq_lane_f32(vout2xCDEF, vget_low_f32(vinput_scale23), 1);
426 vout3xCDEF = vmulq_lane_f32(vout3xCDEF, vget_high_f32(vinput_scale23), 1);
427 const float32x4_t vinput_scale45 = vreinterpretq_f32_s32(vld1q_s32(&quantization_params[4].zero_point));
428 vout4x0123 = vmulq_lane_f32(vout4x0123, vget_low_f32(vinput_scale45), 1);
429 vout5x0123 = vmulq_lane_f32(vout5x0123, vget_high_f32(vinput_scale45), 1);
430 vout4x4567 = vmulq_lane_f32(vout4x4567, vget_low_f32(vinput_scale45), 1);
431 vout5x4567 = vmulq_lane_f32(vout5x4567, vget_high_f32(vinput_scale45), 1);
432 vout4x89AB = vmulq_lane_f32(vout4x89AB, vget_low_f32(vinput_scale45), 1);
433 vout5x89AB = vmulq_lane_f32(vout5x89AB, vget_high_f32(vinput_scale45), 1);
434 vout4xCDEF = vmulq_lane_f32(vout4xCDEF, vget_low_f32(vinput_scale45), 1);
435 vout5xCDEF = vmulq_lane_f32(vout5xCDEF, vget_high_f32(vinput_scale45), 1);
436 const float32x4_t vinput_scale67 = vreinterpretq_f32_s32(vld1q_s32(&quantization_params[6].zero_point));
437 vout6x0123 = vmulq_lane_f32(vout6x0123, vget_low_f32(vinput_scale67), 1);
438 vout7x0123 = vmulq_lane_f32(vout7x0123, vget_high_f32(vinput_scale67), 1);
439 vout6x4567 = vmulq_lane_f32(vout6x4567, vget_low_f32(vinput_scale67), 1);
440 vout7x4567 = vmulq_lane_f32(vout7x4567, vget_high_f32(vinput_scale67), 1);
441 vout6x89AB = vmulq_lane_f32(vout6x89AB, vget_low_f32(vinput_scale67), 1);
442 vout7x89AB = vmulq_lane_f32(vout7x89AB, vget_high_f32(vinput_scale67), 1);
443 vout6xCDEF = vmulq_lane_f32(vout6xCDEF, vget_low_f32(vinput_scale67), 1);
444 vout7xCDEF = vmulq_lane_f32(vout7xCDEF, vget_high_f32(vinput_scale67), 1);
445
446 const float32x4_t vfilter_output_scale0123 = vld1q_f32(w); w = (const float*) w + 4;
447 const float32x4_t vfilter_output_scale4567 = vld1q_f32(w); w = (const float*) w + 4;
448 const float32x4_t vfilter_output_scale89AB = vld1q_f32(w); w = (const float*) w + 4;
449 const float32x4_t vfilter_output_scaleCDEF = vld1q_f32(w); w = (const float*) w + 4;
450
451 const float32x4_t vbias0123 = vld1q_f32(w); w = (const float*) w + 4;
452 vout0x0123 = vfmaq_f32(vbias0123, vout0x0123, vfilter_output_scale0123);
453 vout1x0123 = vfmaq_f32(vbias0123, vout1x0123, vfilter_output_scale0123);
454 vout2x0123 = vfmaq_f32(vbias0123, vout2x0123, vfilter_output_scale0123);
455 vout3x0123 = vfmaq_f32(vbias0123, vout3x0123, vfilter_output_scale0123);
456 vout4x0123 = vfmaq_f32(vbias0123, vout4x0123, vfilter_output_scale0123);
457 vout5x0123 = vfmaq_f32(vbias0123, vout5x0123, vfilter_output_scale0123);
458 vout6x0123 = vfmaq_f32(vbias0123, vout6x0123, vfilter_output_scale0123);
459 vout7x0123 = vfmaq_f32(vbias0123, vout7x0123, vfilter_output_scale0123);
460 const float32x4_t vbias4567 = vld1q_f32(w); w = (const float*) w + 4;
461 vout0x4567 = vfmaq_f32(vbias4567, vout0x4567, vfilter_output_scale4567);
462 vout1x4567 = vfmaq_f32(vbias4567, vout1x4567, vfilter_output_scale4567);
463 vout2x4567 = vfmaq_f32(vbias4567, vout2x4567, vfilter_output_scale4567);
464 vout3x4567 = vfmaq_f32(vbias4567, vout3x4567, vfilter_output_scale4567);
465 vout4x4567 = vfmaq_f32(vbias4567, vout4x4567, vfilter_output_scale4567);
466 vout5x4567 = vfmaq_f32(vbias4567, vout5x4567, vfilter_output_scale4567);
467 vout6x4567 = vfmaq_f32(vbias4567, vout6x4567, vfilter_output_scale4567);
468 vout7x4567 = vfmaq_f32(vbias4567, vout7x4567, vfilter_output_scale4567);
469 const float32x4_t vbias89AB = vld1q_f32(w); w = (const float*) w + 4;
470 vout0x89AB = vfmaq_f32(vbias89AB, vout0x89AB, vfilter_output_scale89AB);
471 vout1x89AB = vfmaq_f32(vbias89AB, vout1x89AB, vfilter_output_scale89AB);
472 vout2x89AB = vfmaq_f32(vbias89AB, vout2x89AB, vfilter_output_scale89AB);
473 vout3x89AB = vfmaq_f32(vbias89AB, vout3x89AB, vfilter_output_scale89AB);
474 vout4x89AB = vfmaq_f32(vbias89AB, vout4x89AB, vfilter_output_scale89AB);
475 vout5x89AB = vfmaq_f32(vbias89AB, vout5x89AB, vfilter_output_scale89AB);
476 vout6x89AB = vfmaq_f32(vbias89AB, vout6x89AB, vfilter_output_scale89AB);
477 vout7x89AB = vfmaq_f32(vbias89AB, vout7x89AB, vfilter_output_scale89AB);
478 const float32x4_t vbiasCDEF = vld1q_f32(w); w = (const float*) w + 4;
479 vout0xCDEF = vfmaq_f32(vbiasCDEF, vout0xCDEF, vfilter_output_scaleCDEF);
480 vout1xCDEF = vfmaq_f32(vbiasCDEF, vout1xCDEF, vfilter_output_scaleCDEF);
481 vout2xCDEF = vfmaq_f32(vbiasCDEF, vout2xCDEF, vfilter_output_scaleCDEF);
482 vout3xCDEF = vfmaq_f32(vbiasCDEF, vout3xCDEF, vfilter_output_scaleCDEF);
483 vout4xCDEF = vfmaq_f32(vbiasCDEF, vout4xCDEF, vfilter_output_scaleCDEF);
484 vout5xCDEF = vfmaq_f32(vbiasCDEF, vout5xCDEF, vfilter_output_scaleCDEF);
485 vout6xCDEF = vfmaq_f32(vbiasCDEF, vout6xCDEF, vfilter_output_scaleCDEF);
486 vout7xCDEF = vfmaq_f32(vbiasCDEF, vout7xCDEF, vfilter_output_scaleCDEF);
487
488 const float32x4_t voutput_min = vld1q_dup_f32(&params->scalar.min);
489 vout0x0123 = vmaxq_f32(vout0x0123, voutput_min);
490 vout0x4567 = vmaxq_f32(vout0x4567, voutput_min);
491 vout0x89AB = vmaxq_f32(vout0x89AB, voutput_min);
492 vout0xCDEF = vmaxq_f32(vout0xCDEF, voutput_min);
493 vout1x0123 = vmaxq_f32(vout1x0123, voutput_min);
494 vout1x4567 = vmaxq_f32(vout1x4567, voutput_min);
495 vout1x89AB = vmaxq_f32(vout1x89AB, voutput_min);
496 vout1xCDEF = vmaxq_f32(vout1xCDEF, voutput_min);
497 vout2x0123 = vmaxq_f32(vout2x0123, voutput_min);
498 vout2x4567 = vmaxq_f32(vout2x4567, voutput_min);
499 vout2x89AB = vmaxq_f32(vout2x89AB, voutput_min);
500 vout2xCDEF = vmaxq_f32(vout2xCDEF, voutput_min);
501 vout3x0123 = vmaxq_f32(vout3x0123, voutput_min);
502 vout3x4567 = vmaxq_f32(vout3x4567, voutput_min);
503 vout3x89AB = vmaxq_f32(vout3x89AB, voutput_min);
504 vout3xCDEF = vmaxq_f32(vout3xCDEF, voutput_min);
505 vout4x0123 = vmaxq_f32(vout4x0123, voutput_min);
506 vout4x4567 = vmaxq_f32(vout4x4567, voutput_min);
507 vout4x89AB = vmaxq_f32(vout4x89AB, voutput_min);
508 vout4xCDEF = vmaxq_f32(vout4xCDEF, voutput_min);
509 vout5x0123 = vmaxq_f32(vout5x0123, voutput_min);
510 vout5x4567 = vmaxq_f32(vout5x4567, voutput_min);
511 vout5x89AB = vmaxq_f32(vout5x89AB, voutput_min);
512 vout5xCDEF = vmaxq_f32(vout5xCDEF, voutput_min);
513 vout6x0123 = vmaxq_f32(vout6x0123, voutput_min);
514 vout6x4567 = vmaxq_f32(vout6x4567, voutput_min);
515 vout6x89AB = vmaxq_f32(vout6x89AB, voutput_min);
516 vout6xCDEF = vmaxq_f32(vout6xCDEF, voutput_min);
517 vout7x0123 = vmaxq_f32(vout7x0123, voutput_min);
518 vout7x4567 = vmaxq_f32(vout7x4567, voutput_min);
519 vout7x89AB = vmaxq_f32(vout7x89AB, voutput_min);
520 vout7xCDEF = vmaxq_f32(vout7xCDEF, voutput_min);
521
522 const float32x4_t voutput_max = vld1q_dup_f32(&params->scalar.max);
523 vout0x0123 = vminq_f32(vout0x0123, voutput_max);
524 vout0x4567 = vminq_f32(vout0x4567, voutput_max);
525 vout0x89AB = vminq_f32(vout0x89AB, voutput_max);
526 vout0xCDEF = vminq_f32(vout0xCDEF, voutput_max);
527 vout1x0123 = vminq_f32(vout1x0123, voutput_max);
528 vout1x4567 = vminq_f32(vout1x4567, voutput_max);
529 vout1x89AB = vminq_f32(vout1x89AB, voutput_max);
530 vout1xCDEF = vminq_f32(vout1xCDEF, voutput_max);
531 vout2x0123 = vminq_f32(vout2x0123, voutput_max);
532 vout2x4567 = vminq_f32(vout2x4567, voutput_max);
533 vout2x89AB = vminq_f32(vout2x89AB, voutput_max);
534 vout2xCDEF = vminq_f32(vout2xCDEF, voutput_max);
535 vout3x0123 = vminq_f32(vout3x0123, voutput_max);
536 vout3x4567 = vminq_f32(vout3x4567, voutput_max);
537 vout3x89AB = vminq_f32(vout3x89AB, voutput_max);
538 vout3xCDEF = vminq_f32(vout3xCDEF, voutput_max);
539 vout4x0123 = vminq_f32(vout4x0123, voutput_max);
540 vout4x4567 = vminq_f32(vout4x4567, voutput_max);
541 vout4x89AB = vminq_f32(vout4x89AB, voutput_max);
542 vout4xCDEF = vminq_f32(vout4xCDEF, voutput_max);
543 vout5x0123 = vminq_f32(vout5x0123, voutput_max);
544 vout5x4567 = vminq_f32(vout5x4567, voutput_max);
545 vout5x89AB = vminq_f32(vout5x89AB, voutput_max);
546 vout5xCDEF = vminq_f32(vout5xCDEF, voutput_max);
547 vout6x0123 = vminq_f32(vout6x0123, voutput_max);
548 vout6x4567 = vminq_f32(vout6x4567, voutput_max);
549 vout6x89AB = vminq_f32(vout6x89AB, voutput_max);
550 vout6xCDEF = vminq_f32(vout6xCDEF, voutput_max);
551 vout7x0123 = vminq_f32(vout7x0123, voutput_max);
552 vout7x4567 = vminq_f32(vout7x4567, voutput_max);
553 vout7x89AB = vminq_f32(vout7x89AB, voutput_max);
554 vout7xCDEF = vminq_f32(vout7xCDEF, voutput_max);
555
556 if XNN_LIKELY(nc >= 16) {
557 vst1q_f32(c0, vout0x0123);
558 vst1q_f32(c0 + 4, vout0x4567);
559 vst1q_f32(c0 + 8, vout0x89AB);
560 vst1q_f32(c0 + 12, vout0xCDEF);
561 vst1q_f32(c1, vout1x0123);
562 vst1q_f32(c1 + 4, vout1x4567);
563 vst1q_f32(c1 + 8, vout1x89AB);
564 vst1q_f32(c1 + 12, vout1xCDEF);
565 vst1q_f32(c2, vout2x0123);
566 vst1q_f32(c2 + 4, vout2x4567);
567 vst1q_f32(c2 + 8, vout2x89AB);
568 vst1q_f32(c2 + 12, vout2xCDEF);
569 vst1q_f32(c3, vout3x0123);
570 vst1q_f32(c3 + 4, vout3x4567);
571 vst1q_f32(c3 + 8, vout3x89AB);
572 vst1q_f32(c3 + 12, vout3xCDEF);
573 vst1q_f32(c4, vout4x0123);
574 vst1q_f32(c4 + 4, vout4x4567);
575 vst1q_f32(c4 + 8, vout4x89AB);
576 vst1q_f32(c4 + 12, vout4xCDEF);
577 vst1q_f32(c5, vout5x0123);
578 vst1q_f32(c5 + 4, vout5x4567);
579 vst1q_f32(c5 + 8, vout5x89AB);
580 vst1q_f32(c5 + 12, vout5xCDEF);
581 vst1q_f32(c6, vout6x0123);
582 vst1q_f32(c6 + 4, vout6x4567);
583 vst1q_f32(c6 + 8, vout6x89AB);
584 vst1q_f32(c6 + 12, vout6xCDEF);
585 vst1q_f32(c7, vout7x0123);
586 vst1q_f32(c7 + 4, vout7x4567);
587 vst1q_f32(c7 + 8, vout7x89AB);
588 vst1q_f32(c7 + 12, vout7xCDEF);
589
590 a0 = (const int8_t*) ((uintptr_t) a0 - kc);
591 a1 = (const int8_t*) ((uintptr_t) a1 - kc);
592 a2 = (const int8_t*) ((uintptr_t) a2 - kc);
593 a3 = (const int8_t*) ((uintptr_t) a3 - kc);
594 a4 = (const int8_t*) ((uintptr_t) a4 - kc);
595 a5 = (const int8_t*) ((uintptr_t) a5 - kc);
596 a6 = (const int8_t*) ((uintptr_t) a6 - kc);
597 a7 = (const int8_t*) ((uintptr_t) a7 - kc);
598
599 c0 = (float*) ((uintptr_t) c0 + cn_stride);
600 c1 = (float*) ((uintptr_t) c1 + cn_stride);
601 c2 = (float*) ((uintptr_t) c2 + cn_stride);
602 c3 = (float*) ((uintptr_t) c3 + cn_stride);
603 c4 = (float*) ((uintptr_t) c4 + cn_stride);
604 c5 = (float*) ((uintptr_t) c5 + cn_stride);
605 c6 = (float*) ((uintptr_t) c6 + cn_stride);
606 c7 = (float*) ((uintptr_t) c7 + cn_stride);
607
608 nc -= 16;
609 } else {
610 if (nc & 8) {
611 vst1q_f32(c0, vout0x0123); c0 += 4;
612 vout0x0123 = vout0x89AB;
613 vst1q_f32(c1, vout1x0123); c1 += 4;
614 vout1x0123 = vout1x89AB;
615 vst1q_f32(c2, vout2x0123); c2 += 4;
616 vout2x0123 = vout2x89AB;
617 vst1q_f32(c3, vout3x0123); c3 += 4;
618 vout3x0123 = vout3x89AB;
619 vst1q_f32(c4, vout4x0123); c4 += 4;
620 vout4x0123 = vout4x89AB;
621 vst1q_f32(c5, vout5x0123); c5 += 4;
622 vout5x0123 = vout5x89AB;
623 vst1q_f32(c6, vout6x0123); c6 += 4;
624 vout6x0123 = vout6x89AB;
625 vst1q_f32(c7, vout7x0123); c7 += 4;
626 vout7x0123 = vout7x89AB;
627 vst1q_f32(c0, vout0x4567); c0 += 4;
628 vout0x4567 = vout0xCDEF;
629 vst1q_f32(c1, vout1x4567); c1 += 4;
630 vout1x4567 = vout1xCDEF;
631 vst1q_f32(c2, vout2x4567); c2 += 4;
632 vout2x4567 = vout2xCDEF;
633 vst1q_f32(c3, vout3x4567); c3 += 4;
634 vout3x4567 = vout3xCDEF;
635 vst1q_f32(c4, vout4x4567); c4 += 4;
636 vout4x4567 = vout4xCDEF;
637 vst1q_f32(c5, vout5x4567); c5 += 4;
638 vout5x4567 = vout5xCDEF;
639 vst1q_f32(c6, vout6x4567); c6 += 4;
640 vout6x4567 = vout6xCDEF;
641 vst1q_f32(c7, vout7x4567); c7 += 4;
642 vout7x4567 = vout7xCDEF;
643 }
644 if (nc & 4) {
645 vst1q_f32(c0, vout0x0123); c0 += 4;
646 vout0x0123 = vout0x4567;
647 vst1q_f32(c1, vout1x0123); c1 += 4;
648 vout1x0123 = vout1x4567;
649 vst1q_f32(c2, vout2x0123); c2 += 4;
650 vout2x0123 = vout2x4567;
651 vst1q_f32(c3, vout3x0123); c3 += 4;
652 vout3x0123 = vout3x4567;
653 vst1q_f32(c4, vout4x0123); c4 += 4;
654 vout4x0123 = vout4x4567;
655 vst1q_f32(c5, vout5x0123); c5 += 4;
656 vout5x0123 = vout5x4567;
657 vst1q_f32(c6, vout6x0123); c6 += 4;
658 vout6x0123 = vout6x4567;
659 vst1q_f32(c7, vout7x0123); c7 += 4;
660 vout7x0123 = vout7x4567;
661 }
662 float32x2_t vout0x01 = vget_low_f32(vout0x0123);
663 float32x2_t vout1x01 = vget_low_f32(vout1x0123);
664 float32x2_t vout2x01 = vget_low_f32(vout2x0123);
665 float32x2_t vout3x01 = vget_low_f32(vout3x0123);
666 float32x2_t vout4x01 = vget_low_f32(vout4x0123);
667 float32x2_t vout5x01 = vget_low_f32(vout5x0123);
668 float32x2_t vout6x01 = vget_low_f32(vout6x0123);
669 float32x2_t vout7x01 = vget_low_f32(vout7x0123);
670 if (nc & 2) {
671 vst1_f32(c0, vout0x01); c0 += 2;
672 vst1_f32(c1, vout1x01); c1 += 2;
673 vst1_f32(c2, vout2x01); c2 += 2;
674 vst1_f32(c3, vout3x01); c3 += 2;
675 vst1_f32(c4, vout4x01); c4 += 2;
676 vst1_f32(c5, vout5x01); c5 += 2;
677 vst1_f32(c6, vout6x01); c6 += 2;
678 vst1_f32(c7, vout7x01); c7 += 2;
679 vout0x01 = vget_high_f32(vout0x0123);
680 vout1x01 = vget_high_f32(vout1x0123);
681 vout2x01 = vget_high_f32(vout2x0123);
682 vout3x01 = vget_high_f32(vout3x0123);
683 vout4x01 = vget_high_f32(vout4x0123);
684 vout5x01 = vget_high_f32(vout5x0123);
685 vout6x01 = vget_high_f32(vout6x0123);
686 vout7x01 = vget_high_f32(vout7x0123);
687 }
688 if (nc & 1) {
689 vst1_lane_f32(c0, vout0x01, 0);
690 vst1_lane_f32(c1, vout1x01, 0);
691 vst1_lane_f32(c2, vout2x01, 0);
692 vst1_lane_f32(c3, vout3x01, 0);
693 vst1_lane_f32(c4, vout4x01, 0);
694 vst1_lane_f32(c5, vout5x01, 0);
695 vst1_lane_f32(c6, vout6x01, 0);
696 vst1_lane_f32(c7, vout7x01, 0);
697 }
698 nc = 0;
699 }
700 } while (nc != 0);
701 }