Debian Codegraph @

src/qd8-f32-qc4w-gemm/gen/qd8-f32-qc4w-gemm-6x8c8-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_qc4w_gemm_minmax_ukernel_6x8c8__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 struct xnn_f32_qc4w_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 <= 6);
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 int8x16_t vmask = vmovq_n_s8(INT8_C(0xF0));
74
75 // Loop over groups of 8 columns.
76 do {
77 // Initialize accumulators with bias. 8 bias values are loaded from the
78 // weight matrix, at the start of the group of 8 columns.
79 const int32x4_t vinput_zero_point01 = vld1q_s32(&quantization_params[0].zero_point);
80 const int32x4_t vksum0123 = vld1q_s32(w); w = (const int32_t*) w + 4;
81 const int32x4_t vksumzp0x0123 = vmulq_lane_s32(vksum0123, vget_low_s32(vinput_zero_point01), 0);
82 const int32x4_t vksumzp1x0123 = vmulq_lane_s32(vksum0123, vget_high_s32(vinput_zero_point01), 0);
83 const int32x4_t vksum4567 = vld1q_s32(w); w = (const int32_t*) w + 4;
84 const int32x4_t vksumzp0x4567 = vmulq_lane_s32(vksum4567, vget_low_s32(vinput_zero_point01), 0);
85 const int32x4_t vksumzp1x4567 = vmulq_lane_s32(vksum4567, vget_high_s32(vinput_zero_point01), 0);
86 const int32x4_t vinput_zero_point23 = vld1q_s32(&quantization_params[2].zero_point);
87 const int32x4_t vksumzp2x0123 = vmulq_lane_s32(vksum0123, vget_low_s32(vinput_zero_point23), 0);
88 const int32x4_t vksumzp3x0123 = vmulq_lane_s32(vksum0123, vget_high_s32(vinput_zero_point23), 0);
89 const int32x4_t vksumzp2x4567 = vmulq_lane_s32(vksum4567, vget_low_s32(vinput_zero_point23), 0);
90 const int32x4_t vksumzp3x4567 = vmulq_lane_s32(vksum4567, vget_high_s32(vinput_zero_point23), 0);
91 const int32x4_t vinput_zero_point45 = vld1q_s32(&quantization_params[4].zero_point);
92 const int32x4_t vksumzp4x0123 = vmulq_lane_s32(vksum0123, vget_low_s32(vinput_zero_point45), 0);
93 const int32x4_t vksumzp5x0123 = vmulq_lane_s32(vksum0123, vget_high_s32(vinput_zero_point45), 0);
94 const int32x4_t vksumzp4x4567 = vmulq_lane_s32(vksum4567, vget_low_s32(vinput_zero_point45), 0);
95 const int32x4_t vksumzp5x4567 = vmulq_lane_s32(vksum4567, vget_high_s32(vinput_zero_point45), 0);
96
97 int32x4_t vacc01x01 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp0x0123), vreinterpretq_u64_s32(vksumzp1x0123)));
98 int32x4_t vacc01x23 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp0x0123), vreinterpretq_u64_s32(vksumzp1x0123)));
99 int32x4_t vacc01x45 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp0x4567), vreinterpretq_u64_s32(vksumzp1x4567)));
100 int32x4_t vacc01x67 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp0x4567), vreinterpretq_u64_s32(vksumzp1x4567)));
101 int32x4_t vacc23x01 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp2x0123), vreinterpretq_u64_s32(vksumzp3x0123)));
102 int32x4_t vacc23x23 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp2x0123), vreinterpretq_u64_s32(vksumzp3x0123)));
103 int32x4_t vacc23x45 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp2x4567), vreinterpretq_u64_s32(vksumzp3x4567)));
104 int32x4_t vacc23x67 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp2x4567), vreinterpretq_u64_s32(vksumzp3x4567)));
105 int32x4_t vacc45x01 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp4x0123), vreinterpretq_u64_s32(vksumzp5x0123)));
106 int32x4_t vacc45x23 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp4x0123), vreinterpretq_u64_s32(vksumzp5x0123)));
107 int32x4_t vacc45x45 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vksumzp4x4567), vreinterpretq_u64_s32(vksumzp5x4567)));
108 int32x4_t vacc45x67 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vksumzp4x4567), vreinterpretq_u64_s32(vksumzp5x4567)));
109
110 // Inner accumulation loop along the 8 columns.
111 size_t k = kc;
112 // 2x partial unrolled loop to load 8 bytes at a time.
113
114 uint64x2x2_t va01x0123456789ABCDEF;
115 va01x0123456789ABCDEF.val[0] = vdupq_n_u64(0);
116 va01x0123456789ABCDEF.val[1] = vdupq_n_u64(0);
117 uint64x2x2_t va23x0123456789ABCDEF;
118 va23x0123456789ABCDEF.val[0] = vdupq_n_u64(0);
119 va23x0123456789ABCDEF.val[1] = vdupq_n_u64(0);
120 uint64x2x2_t va45x0123456789ABCDEF;
121 va45x0123456789ABCDEF.val[0] = vdupq_n_u64(0);
122 va45x0123456789ABCDEF.val[1] = vdupq_n_u64(0);
123
124 while (k >= 16 * sizeof(int8_t)) {
125 // Load a 6x16 block of activations.
126 va01x0123456789ABCDEF = vld2q_lane_u64((const void*) a0, va01x0123456789ABCDEF, 0); a0 += 16;
127 va23x0123456789ABCDEF = vld2q_lane_u64((const void*) a2, va23x0123456789ABCDEF, 0); a2 += 16;
128 va45x0123456789ABCDEF = vld2q_lane_u64((const void*) a4, va45x0123456789ABCDEF, 0); a4 += 16;
129 va01x0123456789ABCDEF = vld2q_lane_u64((const void*) a1, va01x0123456789ABCDEF, 1); a1 += 16;
130 va23x0123456789ABCDEF = vld2q_lane_u64((const void*) a3, va23x0123456789ABCDEF, 1); a3 += 16;
131 va45x0123456789ABCDEF = vld2q_lane_u64((const void*) a5, va45x0123456789ABCDEF, 1); a5 += 16;
132
133 const int8x16_t va01x01234567 = vreinterpretq_s8_u64(va01x0123456789ABCDEF.val[0]);
134 const int8x16_t va01x89ABCDEF = vreinterpretq_s8_u64(va01x0123456789ABCDEF.val[1]);
135 const int8x16_t va23x01234567 = vreinterpretq_s8_u64(va23x0123456789ABCDEF.val[0]);
136 const int8x16_t va23x89ABCDEF = vreinterpretq_s8_u64(va23x0123456789ABCDEF.val[1]);
137 const int8x16_t va45x01234567 = vreinterpretq_s8_u64(va45x0123456789ABCDEF.val[0]);
138 const int8x16_t va45x89ABCDEF = vreinterpretq_s8_u64(va45x0123456789ABCDEF.val[1]);
139
140 // Load a 16x8 block of weights.
141 const int8x16_t vb01x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
142 const int8x16_t vb23x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
143 const int8x16_t vb45x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
144 const int8x16_t vb67x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
145 const int8x16_t vb01x01234567 = vshlq_n_s8(vb01x0123456789ABCDEF, 4);
146 const int8x16_t vb23x01234567 = vshlq_n_s8(vb23x0123456789ABCDEF, 4);
147 const int8x16_t vb45x01234567 = vshlq_n_s8(vb45x0123456789ABCDEF, 4);
148 const int8x16_t vb67x01234567 = vshlq_n_s8(vb67x0123456789ABCDEF, 4);
149 const int8x16_t vb01x89ABCDEF = vandq_s8(vb01x0123456789ABCDEF, vmask);
150 const int8x16_t vb23x89ABCDEF = vandq_s8(vb23x0123456789ABCDEF, vmask);
151 const int8x16_t vb45x89ABCDEF = vandq_s8(vb45x0123456789ABCDEF, vmask);
152 const int8x16_t vb67x89ABCDEF = vandq_s8(vb67x0123456789ABCDEF, vmask);
153
154 // Multiply-accumulate: 6x8 * 8x8 --> 6x8.
155 vacc01x01 = vmmlaq_s32(vacc01x01, va01x01234567, vb01x01234567);
156 vacc01x23 = vmmlaq_s32(vacc01x23, va01x01234567, vb23x01234567);
157 vacc01x45 = vmmlaq_s32(vacc01x45, va01x01234567, vb45x01234567);
158 vacc01x67 = vmmlaq_s32(vacc01x67, va01x01234567, vb67x01234567);
159 vacc23x01 = vmmlaq_s32(vacc23x01, va23x01234567, vb01x01234567);
160 vacc23x23 = vmmlaq_s32(vacc23x23, va23x01234567, vb23x01234567);
161 vacc23x45 = vmmlaq_s32(vacc23x45, va23x01234567, vb45x01234567);
162 vacc23x67 = vmmlaq_s32(vacc23x67, va23x01234567, vb67x01234567);
163 vacc45x01 = vmmlaq_s32(vacc45x01, va45x01234567, vb01x01234567);
164 vacc45x23 = vmmlaq_s32(vacc45x23, va45x01234567, vb23x01234567);
165 vacc45x45 = vmmlaq_s32(vacc45x45, va45x01234567, vb45x01234567);
166 vacc45x67 = vmmlaq_s32(vacc45x67, va45x01234567, vb67x01234567);
167 vacc01x01 = vmmlaq_s32(vacc01x01, va01x89ABCDEF, vb01x89ABCDEF);
168 vacc01x23 = vmmlaq_s32(vacc01x23, va01x89ABCDEF, vb23x89ABCDEF);
169 vacc01x45 = vmmlaq_s32(vacc01x45, va01x89ABCDEF, vb45x89ABCDEF);
170 vacc01x67 = vmmlaq_s32(vacc01x67, va01x89ABCDEF, vb67x89ABCDEF);
171 vacc23x01 = vmmlaq_s32(vacc23x01, va23x89ABCDEF, vb01x89ABCDEF);
172 vacc23x23 = vmmlaq_s32(vacc23x23, va23x89ABCDEF, vb23x89ABCDEF);
173 vacc23x45 = vmmlaq_s32(vacc23x45, va23x89ABCDEF, vb45x89ABCDEF);
174 vacc23x67 = vmmlaq_s32(vacc23x67, va23x89ABCDEF, vb67x89ABCDEF);
175 vacc45x01 = vmmlaq_s32(vacc45x01, va45x89ABCDEF, vb01x89ABCDEF);
176 vacc45x23 = vmmlaq_s32(vacc45x23, va45x89ABCDEF, vb23x89ABCDEF);
177 vacc45x45 = vmmlaq_s32(vacc45x45, va45x89ABCDEF, vb45x89ABCDEF);
178 vacc45x67 = vmmlaq_s32(vacc45x67, va45x89ABCDEF, vb67x89ABCDEF);
179
180 k -= 16 * sizeof(int8_t);
181 }
182 // Handle up to 8 final positions of `k`
183 if XNN_UNLIKELY(k != 0) {
184 // Load a 6x8 block of activations.
185 uint64x2_t va01x01234567 = vld1q_dup_u64((const void*) a0); a0 += 8;
186 uint64x2_t va23x01234567 = vld1q_dup_u64((const void*) a2); a2 += 8;
187 uint64x2_t va45x01234567 = vld1q_dup_u64((const void*) a4); a4 += 8;
188 va01x01234567 = vld1q_lane_u64((const void*) a1, va01x01234567, 1); a1 += 8;
189 va23x01234567 = vld1q_lane_u64((const void*) a3, va23x01234567, 1); a3 += 8;
190 va45x01234567 = vld1q_lane_u64((const void*) a5, va45x01234567, 1); a5 += 8;
191
192 // Load a 16x8 block of weights.
193 const int8x16_t vb01x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
194 const int8x16_t vb23x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
195 const int8x16_t vb45x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
196 const int8x16_t vb67x0123456789ABCDEF = vld1q_s8(w); w = (const int8_t*) w + 16;
197 const int8x16_t vb01x01234567 = vshlq_n_s8(vb01x0123456789ABCDEF, 4);
198 const int8x16_t vb23x01234567 = vshlq_n_s8(vb23x0123456789ABCDEF, 4);
199 const int8x16_t vb45x01234567 = vshlq_n_s8(vb45x0123456789ABCDEF, 4);
200 const int8x16_t vb67x01234567 = vshlq_n_s8(vb67x0123456789ABCDEF, 4);
201
202 // Multiply-accumulate: 6x4 * 4x8 --> 6x8.
203 vacc01x01 = vmmlaq_s32(vacc01x01, vreinterpretq_s8_u64(va01x01234567), vb01x01234567);
204 vacc01x23 = vmmlaq_s32(vacc01x23, vreinterpretq_s8_u64(va01x01234567), vb23x01234567);
205 vacc01x45 = vmmlaq_s32(vacc01x45, vreinterpretq_s8_u64(va01x01234567), vb45x01234567);
206 vacc01x67 = vmmlaq_s32(vacc01x67, vreinterpretq_s8_u64(va01x01234567), vb67x01234567);
207 vacc23x01 = vmmlaq_s32(vacc23x01, vreinterpretq_s8_u64(va23x01234567), vb01x01234567);
208 vacc23x23 = vmmlaq_s32(vacc23x23, vreinterpretq_s8_u64(va23x01234567), vb23x01234567);
209 vacc23x45 = vmmlaq_s32(vacc23x45, vreinterpretq_s8_u64(va23x01234567), vb45x01234567);
210 vacc23x67 = vmmlaq_s32(vacc23x67, vreinterpretq_s8_u64(va23x01234567), vb67x01234567);
211 vacc45x01 = vmmlaq_s32(vacc45x01, vreinterpretq_s8_u64(va45x01234567), vb01x01234567);
212 vacc45x23 = vmmlaq_s32(vacc45x23, vreinterpretq_s8_u64(va45x01234567), vb23x01234567);
213 vacc45x45 = vmmlaq_s32(vacc45x45, vreinterpretq_s8_u64(va45x01234567), vb45x01234567);
214 vacc45x67 = vmmlaq_s32(vacc45x67, vreinterpretq_s8_u64(va45x01234567), vb67x01234567);
215 }
216
217 int32x4_t vacc0x0123 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01x01), vreinterpretq_u64_s32(vacc01x23)));
218 int32x4_t vacc1x0123 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01x01), vreinterpretq_u64_s32(vacc01x23)));
219 int32x4_t vacc0x4567 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc01x45), vreinterpretq_u64_s32(vacc01x67)));
220 int32x4_t vacc1x4567 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc01x45), vreinterpretq_u64_s32(vacc01x67)));
221 int32x4_t vacc2x0123 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23x01), vreinterpretq_u64_s32(vacc23x23)));
222 int32x4_t vacc3x0123 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc23x01), vreinterpretq_u64_s32(vacc23x23)));
223 int32x4_t vacc2x4567 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc23x45), vreinterpretq_u64_s32(vacc23x67)));
224 int32x4_t vacc3x4567 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc23x45), vreinterpretq_u64_s32(vacc23x67)));
225 int32x4_t vacc4x0123 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc45x01), vreinterpretq_u64_s32(vacc45x23)));
226 int32x4_t vacc5x0123 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc45x01), vreinterpretq_u64_s32(vacc45x23)));
227 int32x4_t vacc4x4567 = vreinterpretq_s32_u64(vtrn1q_u64(vreinterpretq_u64_s32(vacc45x45), vreinterpretq_u64_s32(vacc45x67)));
228 int32x4_t vacc5x4567 = vreinterpretq_s32_u64(vtrn2q_u64(vreinterpretq_u64_s32(vacc45x45), vreinterpretq_u64_s32(vacc45x67)));
229 float32x4_t vout0x0123 = vcvtq_n_f32_s32(vacc0x0123, 4);
230 float32x4_t vout0x4567 = vcvtq_n_f32_s32(vacc0x4567, 4);
231 float32x4_t vout1x0123 = vcvtq_n_f32_s32(vacc1x0123, 4);
232 float32x4_t vout1x4567 = vcvtq_n_f32_s32(vacc1x4567, 4);
233 float32x4_t vout2x0123 = vcvtq_n_f32_s32(vacc2x0123, 4);
234 float32x4_t vout2x4567 = vcvtq_n_f32_s32(vacc2x4567, 4);
235 float32x4_t vout3x0123 = vcvtq_n_f32_s32(vacc3x0123, 4);
236 float32x4_t vout3x4567 = vcvtq_n_f32_s32(vacc3x4567, 4);
237 float32x4_t vout4x0123 = vcvtq_n_f32_s32(vacc4x0123, 4);
238 float32x4_t vout4x4567 = vcvtq_n_f32_s32(vacc4x4567, 4);
239 float32x4_t vout5x0123 = vcvtq_n_f32_s32(vacc5x0123, 4);
240 float32x4_t vout5x4567 = vcvtq_n_f32_s32(vacc5x4567, 4);
241
242 const float32x4_t vinput_scale01 = vreinterpretq_f32_s32(vld1q_s32(&quantization_params[0].zero_point));
243 vout0x0123 = vmulq_lane_f32(vout0x0123, vget_low_f32(vinput_scale01), 1);
244 vout1x0123 = vmulq_lane_f32(vout1x0123, vget_high_f32(vinput_scale01), 1);
245 vout0x4567 = vmulq_lane_f32(vout0x4567, vget_low_f32(vinput_scale01), 1);
246 vout1x4567 = vmulq_lane_f32(vout1x4567, vget_high_f32(vinput_scale01), 1);
247 const float32x4_t vinput_scale23 = vreinterpretq_f32_s32(vld1q_s32(&quantization_params[2].zero_point));
248 vout2x0123 = vmulq_lane_f32(vout2x0123, vget_low_f32(vinput_scale23), 1);
249 vout3x0123 = vmulq_lane_f32(vout3x0123, vget_high_f32(vinput_scale23), 1);
250 vout2x4567 = vmulq_lane_f32(vout2x4567, vget_low_f32(vinput_scale23), 1);
251 vout3x4567 = vmulq_lane_f32(vout3x4567, vget_high_f32(vinput_scale23), 1);
252 const float32x4_t vinput_scale45 = vreinterpretq_f32_s32(vld1q_s32(&quantization_params[4].zero_point));
253 vout4x0123 = vmulq_lane_f32(vout4x0123, vget_low_f32(vinput_scale45), 1);
254 vout5x0123 = vmulq_lane_f32(vout5x0123, vget_high_f32(vinput_scale45), 1);
255 vout4x4567 = vmulq_lane_f32(vout4x4567, vget_low_f32(vinput_scale45), 1);
256 vout5x4567 = vmulq_lane_f32(vout5x4567, vget_high_f32(vinput_scale45), 1);
257
258 const float32x4_t vfilter_output_scale0123 = vld1q_f32(w); w = (const float*) w + 4;
259 const float32x4_t vfilter_output_scale4567 = vld1q_f32(w); w = (const float*) w + 4;
260
261 const float32x4_t vbias0123 = vld1q_f32(w); w = (const float*) w + 4;
262 vout0x0123 = vfmaq_f32(vbias0123, vout0x0123, vfilter_output_scale0123);
263 vout1x0123 = vfmaq_f32(vbias0123, vout1x0123, vfilter_output_scale0123);
264 vout2x0123 = vfmaq_f32(vbias0123, vout2x0123, vfilter_output_scale0123);
265 vout3x0123 = vfmaq_f32(vbias0123, vout3x0123, vfilter_output_scale0123);
266 vout4x0123 = vfmaq_f32(vbias0123, vout4x0123, vfilter_output_scale0123);
267 vout5x0123 = vfmaq_f32(vbias0123, vout5x0123, vfilter_output_scale0123);
268 const float32x4_t vbias4567 = vld1q_f32(w); w = (const float*) w + 4;
269 vout0x4567 = vfmaq_f32(vbias4567, vout0x4567, vfilter_output_scale4567);
270 vout1x4567 = vfmaq_f32(vbias4567, vout1x4567, vfilter_output_scale4567);
271 vout2x4567 = vfmaq_f32(vbias4567, vout2x4567, vfilter_output_scale4567);
272 vout3x4567 = vfmaq_f32(vbias4567, vout3x4567, vfilter_output_scale4567);
273 vout4x4567 = vfmaq_f32(vbias4567, vout4x4567, vfilter_output_scale4567);
274 vout5x4567 = vfmaq_f32(vbias4567, vout5x4567, vfilter_output_scale4567);
275
276 const float32x4_t voutput_min = vld1q_dup_f32(&params->scalar.min);
277 vout0x0123 = vmaxq_f32(vout0x0123, voutput_min);
278 vout0x4567 = vmaxq_f32(vout0x4567, voutput_min);
279 vout1x0123 = vmaxq_f32(vout1x0123, voutput_min);
280 vout1x4567 = vmaxq_f32(vout1x4567, voutput_min);
281 vout2x0123 = vmaxq_f32(vout2x0123, voutput_min);
282 vout2x4567 = vmaxq_f32(vout2x4567, voutput_min);
283 vout3x0123 = vmaxq_f32(vout3x0123, voutput_min);
284 vout3x4567 = vmaxq_f32(vout3x4567, voutput_min);
285 vout4x0123 = vmaxq_f32(vout4x0123, voutput_min);
286 vout4x4567 = vmaxq_f32(vout4x4567, voutput_min);
287 vout5x0123 = vmaxq_f32(vout5x0123, voutput_min);
288 vout5x4567 = vmaxq_f32(vout5x4567, voutput_min);
289
290 const float32x4_t voutput_max = vld1q_dup_f32(&params->scalar.max);
291 vout0x0123 = vminq_f32(vout0x0123, voutput_max);
292 vout0x4567 = vminq_f32(vout0x4567, voutput_max);
293 vout1x0123 = vminq_f32(vout1x0123, voutput_max);
294 vout1x4567 = vminq_f32(vout1x4567, voutput_max);
295 vout2x0123 = vminq_f32(vout2x0123, voutput_max);
296 vout2x4567 = vminq_f32(vout2x4567, voutput_max);
297 vout3x0123 = vminq_f32(vout3x0123, voutput_max);
298 vout3x4567 = vminq_f32(vout3x4567, voutput_max);
299 vout4x0123 = vminq_f32(vout4x0123, voutput_max);
300 vout4x4567 = vminq_f32(vout4x4567, voutput_max);
301 vout5x0123 = vminq_f32(vout5x0123, voutput_max);
302 vout5x4567 = vminq_f32(vout5x4567, voutput_max);
303
304 if XNN_LIKELY(nc >= 8) {
305 vst1q_f32(c0, vout0x0123);
306 vst1q_f32(c0 + 4, vout0x4567);
307 vst1q_f32(c1, vout1x0123);
308 vst1q_f32(c1 + 4, vout1x4567);
309 vst1q_f32(c2, vout2x0123);
310 vst1q_f32(c2 + 4, vout2x4567);
311 vst1q_f32(c3, vout3x0123);
312 vst1q_f32(c3 + 4, vout3x4567);
313 vst1q_f32(c4, vout4x0123);
314 vst1q_f32(c4 + 4, vout4x4567);
315 vst1q_f32(c5, vout5x0123);
316 vst1q_f32(c5 + 4, vout5x4567);
317
318 a0 = (const int8_t*) ((uintptr_t) a0 - kc);
319 a1 = (const int8_t*) ((uintptr_t) a1 - kc);
320 a2 = (const int8_t*) ((uintptr_t) a2 - kc);
321 a3 = (const int8_t*) ((uintptr_t) a3 - kc);
322 a4 = (const int8_t*) ((uintptr_t) a4 - kc);
323 a5 = (const int8_t*) ((uintptr_t) a5 - kc);
324
325 c0 = (float*) ((uintptr_t) c0 + cn_stride);
326 c1 = (float*) ((uintptr_t) c1 + cn_stride);
327 c2 = (float*) ((uintptr_t) c2 + cn_stride);
328 c3 = (float*) ((uintptr_t) c3 + cn_stride);
329 c4 = (float*) ((uintptr_t) c4 + cn_stride);
330 c5 = (float*) ((uintptr_t) c5 + cn_stride);
331
332 nc -= 8;
333 } else {
334 if (nc & 4) {
335 vst1q_f32(c0, vout0x0123); c0 += 4;
336 vout0x0123 = vout0x4567;
337 vst1q_f32(c1, vout1x0123); c1 += 4;
338 vout1x0123 = vout1x4567;
339 vst1q_f32(c2, vout2x0123); c2 += 4;
340 vout2x0123 = vout2x4567;
341 vst1q_f32(c3, vout3x0123); c3 += 4;
342 vout3x0123 = vout3x4567;
343 vst1q_f32(c4, vout4x0123); c4 += 4;
344 vout4x0123 = vout4x4567;
345 vst1q_f32(c5, vout5x0123); c5 += 4;
346 vout5x0123 = vout5x4567;
347 }
348 float32x2_t vout0x01 = vget_low_f32(vout0x0123);
349 float32x2_t vout1x01 = vget_low_f32(vout1x0123);
350 float32x2_t vout2x01 = vget_low_f32(vout2x0123);
351 float32x2_t vout3x01 = vget_low_f32(vout3x0123);
352 float32x2_t vout4x01 = vget_low_f32(vout4x0123);
353 float32x2_t vout5x01 = vget_low_f32(vout5x0123);
354 if (nc & 2) {
355 vst1_f32(c0, vout0x01); c0 += 2;
356 vst1_f32(c1, vout1x01); c1 += 2;
357 vst1_f32(c2, vout2x01); c2 += 2;
358 vst1_f32(c3, vout3x01); c3 += 2;
359 vst1_f32(c4, vout4x01); c4 += 2;
360 vst1_f32(c5, vout5x01); c5 += 2;
361 vout0x01 = vget_high_f32(vout0x0123);
362 vout1x01 = vget_high_f32(vout1x0123);
363 vout2x01 = vget_high_f32(vout2x0123);
364 vout3x01 = vget_high_f32(vout3x0123);
365 vout4x01 = vget_high_f32(vout4x0123);
366 vout5x01 = vget_high_f32(vout5x0123);
367 }
368 if (nc & 1) {
369 vst1_lane_f32(c0, vout0x01, 0);
370 vst1_lane_f32(c1, vout1x01, 0);
371 vst1_lane_f32(c2, vout2x01, 0);
372 vst1_lane_f32(c3, vout3x01, 0);
373 vst1_lane_f32(c4, vout4x01, 0);
374 vst1_lane_f32(c5, vout5x01, 0);
375 }
376 nc = 0;
377 }
378 } while (nc != 0);
379 }