Process 7 input rows / 3 output rows at a time in 5x5p2 chw dwconv. ~10% speedup.
PiperOrigin-RevId: 281362836
diff --git a/src/f32-dwconv-spchw/5x5p2-neonfma.c b/src/f32-dwconv-spchw/5x5p2-neonfma.c
index c41926b..271b483 100644
--- a/src/f32-dwconv-spchw/5x5p2-neonfma.c
+++ b/src/f32-dwconv-spchw/5x5p2-neonfma.c
@@ -29,7 +29,7 @@
const float32x4_t vmax = vld1q_dup_f32(¶ms->neon.max);
const float32x4_t vmin = vld1q_dup_f32(¶ms->neon.min);
- const size_t input_width_increment_double = 2 * input_width_stride - round_up_po2(n, 4) / 4 * input_tuple_stride;
+ const size_t input_width_increment_triple = 3 * input_width_stride - round_up_po2(n, 4) / 4 * input_tuple_stride;
const size_t output_width_increment_single = output_width_stride - (n - 1) / 4 * output_tuple_stride;
// No vertical padding.
@@ -39,9 +39,11 @@
const float* i3 = (const float*) ((uintptr_t) i2 + input_width_stride);
const float* i4 = (const float*) ((uintptr_t) i3 + input_width_stride);
const float* i5 = (const float*) ((uintptr_t) i4 + input_width_stride);
+ const float* i6 = (const float*) ((uintptr_t) i5 + input_width_stride);
float* output0 = output;
float* output1 = (float *)((uintptr_t) output0 + output_width_stride);
+ float* output2 = (float *)((uintptr_t) output1 + output_width_stride);
const float32x4_t vw0123 = vld1q_f32(weights);
const float32x4_t vw4567 = vld1q_f32(weights + 4);
@@ -51,7 +53,594 @@
const float32x4_t vwKLMN = vld1q_f32(weights + 20);
const float32x2_t vwOP = vld1_f32( weights + 24);
- while (m >= 2) {
+ while (m >= 3) {
+ float32x4_t vi0x0123 = vmovq_n_f32(0.0f);
+ float32x4_t vi1x0123 = vmovq_n_f32(0.0f);
+ float32x4_t vi2x0123 = vmovq_n_f32(0.0f);
+ float32x4_t vi3x0123 = vmovq_n_f32(0.0f);
+ float32x4_t vi4x0123 = vmovq_n_f32(0.0f);
+ float32x4_t vi5x0123 = vmovq_n_f32(0.0f);
+ float32x4_t vi6x0123 = vmovq_n_f32(0.0f);
+ float32x4_t vi0x4567 = vld1q_f32(i0); i0 = (const float*) ((uintptr_t) i0 + input_tuple_stride);
+ float32x4_t vi1x4567 = vld1q_f32(i1); i1 = (const float*) ((uintptr_t) i1 + input_tuple_stride);
+ float32x4_t vi2x4567 = vld1q_f32(i2); i2 = (const float*) ((uintptr_t) i2 + input_tuple_stride);
+ float32x4_t vi3x4567 = vld1q_f32(i3); i3 = (const float*) ((uintptr_t) i3 + input_tuple_stride);
+ float32x4_t vi4x4567 = vld1q_f32(i4); i4 = (const float*) ((uintptr_t) i4 + input_tuple_stride);
+ float32x4_t vi5x4567 = vld1q_f32(i5); i5 = (const float*) ((uintptr_t) i5 + input_tuple_stride);
+ float32x4_t vi6x4567 = vld1q_f32(i6); i6 = (const float*) ((uintptr_t) i6 + input_tuple_stride);
+
+ size_t k = n;
+ for (; k > 8; k -= 4) {
+ float32x4_t vo4567p00 = vdupq_laneq_f32(vw0123, 0);
+ float32x4_t vo4567p10 = vdupq_laneq_f32(vw0123, 0);
+ float32x4_t vo4567p20 = vdupq_laneq_f32(vw0123, 0);
+
+ const float32x4_t vi0x89AB = vld1q_f32(i0); i0 = (const float*) ((uintptr_t) i0 + input_tuple_stride);
+ const float32x4_t vi1x89AB = vld1q_f32(i1); i1 = (const float*) ((uintptr_t) i1 + input_tuple_stride);
+ const float32x4_t vi2x89AB = vld1q_f32(i2); i2 = (const float*) ((uintptr_t) i2 + input_tuple_stride);
+ const float32x4_t vi3x89AB = vld1q_f32(i3); i3 = (const float*) ((uintptr_t) i3 + input_tuple_stride);
+ const float32x4_t vi4x89AB = vld1q_f32(i4); i4 = (const float*) ((uintptr_t) i4 + input_tuple_stride);
+ const float32x4_t vi5x89AB = vld1q_f32(i5); i5 = (const float*) ((uintptr_t) i5 + input_tuple_stride);
+ const float32x4_t vi6x89AB = vld1q_f32(i6); i6 = (const float*) ((uintptr_t) i6 + input_tuple_stride);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi0x4567, vw0123, 3);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi1x4567, vw0123, 3);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi2x4567, vw0123, 3);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi1x4567, vw89AB, 0);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi2x4567, vw89AB, 0);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi3x4567, vw89AB, 0);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi2x4567, vwCDEF, 1);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi3x4567, vwCDEF, 1);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi4x4567, vwCDEF, 1);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi3x4567, vwGHIJ, 2);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi4x4567, vwGHIJ, 2);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi5x4567, vwGHIJ, 2);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi4x4567, vwKLMN, 3);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi5x4567, vwKLMN, 3);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi6x4567, vwKLMN, 3);
+
+
+ const float32x4_t vi0x3456 = vextq_f32(vi0x0123, vi0x4567, 3);
+ const float32x4_t vi1x3456 = vextq_f32(vi1x0123, vi1x4567, 3);
+ const float32x4_t vi2x3456 = vextq_f32(vi2x0123, vi2x4567, 3);
+ const float32x4_t vi3x3456 = vextq_f32(vi3x0123, vi3x4567, 3);
+ const float32x4_t vi4x3456 = vextq_f32(vi4x0123, vi4x4567, 3);
+ const float32x4_t vi5x3456 = vextq_f32(vi5x0123, vi5x4567, 3);
+ const float32x4_t vi6x3456 = vextq_f32(vi6x0123, vi6x4567, 3);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi0x3456, vw0123, 2);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi1x3456, vw0123, 2);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi2x3456, vw0123, 2);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi1x3456, vw4567, 3);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi2x3456, vw4567, 3);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi3x3456, vw4567, 3);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi2x3456, vwCDEF, 0);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi3x3456, vwCDEF, 0);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi4x3456, vwCDEF, 0);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi3x3456, vwGHIJ, 1);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi4x3456, vwGHIJ, 1);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi5x3456, vwGHIJ, 1);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi4x3456, vwKLMN, 2);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi5x3456, vwKLMN, 2);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi6x3456, vwKLMN, 2);
+
+ const float32x4_t vi0x2345 = vextq_f32(vi0x0123, vi0x4567, 2);
+ const float32x4_t vi1x2345 = vextq_f32(vi1x0123, vi1x4567, 2);
+ const float32x4_t vi2x2345 = vextq_f32(vi2x0123, vi2x4567, 2);
+ const float32x4_t vi3x2345 = vextq_f32(vi3x0123, vi3x4567, 2);
+ const float32x4_t vi4x2345 = vextq_f32(vi4x0123, vi4x4567, 2);
+ const float32x4_t vi5x2345 = vextq_f32(vi5x0123, vi5x4567, 2);
+ const float32x4_t vi6x2345 = vextq_f32(vi6x0123, vi6x4567, 2);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi0x2345, vw0123, 1);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi1x2345, vw0123, 1);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi2x2345, vw0123, 1);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi1x2345, vw4567, 2);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi2x2345, vw4567, 2);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi3x2345, vw4567, 2);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi2x2345, vw89AB, 3);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi3x2345, vw89AB, 3);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi4x2345, vw89AB, 3);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi3x2345, vwGHIJ, 0);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi4x2345, vwGHIJ, 0);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi5x2345, vwGHIJ, 0);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi4x2345, vwKLMN, 1);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi5x2345, vwKLMN, 1);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi6x2345, vwKLMN, 1);
+
+ vi0x0123 = vi0x4567;
+ vi1x0123 = vi1x4567;
+ vi2x0123 = vi2x4567;
+ vi3x0123 = vi3x4567;
+ vi4x0123 = vi4x4567;
+ vi5x0123 = vi5x4567;
+ vi6x0123 = vi6x4567;
+
+ const float32x4_t vi0x5678 = vextq_f32(vi0x4567, vi0x89AB, 1);
+ const float32x4_t vi1x5678 = vextq_f32(vi1x4567, vi1x89AB, 1);
+ const float32x4_t vi2x5678 = vextq_f32(vi2x4567, vi2x89AB, 1);
+ const float32x4_t vi3x5678 = vextq_f32(vi3x4567, vi3x89AB, 1);
+ const float32x4_t vi4x5678 = vextq_f32(vi4x4567, vi4x89AB, 1);
+ const float32x4_t vi5x5678 = vextq_f32(vi5x4567, vi5x89AB, 1);
+ const float32x4_t vi6x5678 = vextq_f32(vi6x4567, vi6x89AB, 1);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi0x5678, vw4567, 0);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi1x5678, vw4567, 0);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi2x5678, vw4567, 0);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi1x5678, vw89AB, 1);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi2x5678, vw89AB, 1);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi3x5678, vw89AB, 1);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi2x5678, vwCDEF, 2);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi3x5678, vwCDEF, 2);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi4x5678, vwCDEF, 2);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi3x5678, vwGHIJ, 3);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi4x5678, vwGHIJ, 3);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi5x5678, vwGHIJ, 3);
+
+ vo4567p00 = vfmaq_lane_f32( vo4567p00, vi4x5678, vwOP, 0);
+ vo4567p10 = vfmaq_lane_f32( vo4567p10, vi5x5678, vwOP, 0);
+ vo4567p20 = vfmaq_lane_f32( vo4567p20, vi6x5678, vwOP, 0);
+
+ const float32x4_t vi0x6789 = vextq_f32(vi0x4567, vi0x89AB, 2);
+ const float32x4_t vi1x6789 = vextq_f32(vi1x4567, vi1x89AB, 2);
+ const float32x4_t vi2x6789 = vextq_f32(vi2x4567, vi2x89AB, 2);
+ const float32x4_t vi3x6789 = vextq_f32(vi3x4567, vi3x89AB, 2);
+ const float32x4_t vi4x6789 = vextq_f32(vi4x4567, vi4x89AB, 2);
+ const float32x4_t vi5x6789 = vextq_f32(vi5x4567, vi5x89AB, 2);
+ const float32x4_t vi6x6789 = vextq_f32(vi6x4567, vi6x89AB, 2);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi0x6789, vw4567, 1);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi1x6789, vw4567, 1);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi2x6789, vw4567, 1);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi1x6789, vw89AB, 2);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi2x6789, vw89AB, 2);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi3x6789, vw89AB, 2);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi2x6789, vwCDEF, 3);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi3x6789, vwCDEF, 3);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi4x6789, vwCDEF, 3);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi3x6789, vwKLMN, 0);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi4x6789, vwKLMN, 0);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi5x6789, vwKLMN, 0);
+
+ vo4567p00 = vfmaq_lane_f32( vo4567p00, vi4x6789, vwOP, 1);
+ vo4567p10 = vfmaq_lane_f32( vo4567p10, vi5x6789, vwOP, 1);
+ vo4567p20 = vfmaq_lane_f32( vo4567p20, vi6x6789, vwOP, 1);
+
+ vi0x4567 = vi0x89AB;
+ vi1x4567 = vi1x89AB;
+ vi2x4567 = vi2x89AB;
+ vi3x4567 = vi3x89AB;
+ vi4x4567 = vi4x89AB;
+ vi5x4567 = vi5x89AB;
+ vi6x4567 = vi6x89AB;
+
+ float32x4_t vo0 = vo4567p00;
+ float32x4_t vo1 = vo4567p10;
+ float32x4_t vo2 = vo4567p20;
+
+ vo0 = vmaxq_f32(vo0, vmin);
+ vo0 = vminq_f32(vo0, vmax);
+ vo1 = vmaxq_f32(vo1, vmin);
+ vo1 = vminq_f32(vo1, vmax);
+ vo2 = vmaxq_f32(vo2, vmin);
+ vo2 = vminq_f32(vo2, vmax);
+
+ vst1q_f32(output0, vo0); output0 = (float*) ((uintptr_t) output0 + output_tuple_stride);
+ vst1q_f32(output1, vo1); output1 = (float*) ((uintptr_t) output1 + output_tuple_stride);
+ vst1q_f32(output2, vo2); output2 = (float*) ((uintptr_t) output2 + output_tuple_stride);
+ }
+ // Always process the last block of 5..8 pixels.
+ if XNN_LIKELY(k > 4)
+ {
+ float32x4_t vo4567p00 = vdupq_laneq_f32(vw0123, 0);
+ float32x4_t vo4567p10 = vdupq_laneq_f32(vw0123, 0);
+ float32x4_t vo4567p20 = vdupq_laneq_f32(vw0123, 0);
+
+ float32x4_t vi0x89AB = vld1q_f32(i0); i0 = (const float*) ((uintptr_t) i0 + input_tuple_stride);
+ float32x4_t vi1x89AB = vld1q_f32(i1); i1 = (const float*) ((uintptr_t) i1 + input_tuple_stride);
+ float32x4_t vi2x89AB = vld1q_f32(i2); i2 = (const float*) ((uintptr_t) i2 + input_tuple_stride);
+ float32x4_t vi3x89AB = vld1q_f32(i3); i3 = (const float*) ((uintptr_t) i3 + input_tuple_stride);
+ float32x4_t vi4x89AB = vld1q_f32(i4); i4 = (const float*) ((uintptr_t) i4 + input_tuple_stride);
+ float32x4_t vi5x89AB = vld1q_f32(i5); i5 = (const float*) ((uintptr_t) i5 + input_tuple_stride);
+ float32x4_t vi6x89AB = vld1q_f32(i6); i6 = (const float*) ((uintptr_t) i6 + input_tuple_stride);
+
+ vi0x89AB = vreinterpretq_u32_f32(vandq_u32(vmask, vreinterpretq_f32_u32(vi0x89AB)));
+ vi1x89AB = vreinterpretq_u32_f32(vandq_u32(vmask, vreinterpretq_f32_u32(vi1x89AB)));
+ vi2x89AB = vreinterpretq_u32_f32(vandq_u32(vmask, vreinterpretq_f32_u32(vi2x89AB)));
+ vi3x89AB = vreinterpretq_u32_f32(vandq_u32(vmask, vreinterpretq_f32_u32(vi3x89AB)));
+ vi4x89AB = vreinterpretq_u32_f32(vandq_u32(vmask, vreinterpretq_f32_u32(vi4x89AB)));
+ vi5x89AB = vreinterpretq_u32_f32(vandq_u32(vmask, vreinterpretq_f32_u32(vi5x89AB)));
+ vi6x89AB = vreinterpretq_u32_f32(vandq_u32(vmask, vreinterpretq_f32_u32(vi6x89AB)));
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi0x4567, vw0123, 3);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi1x4567, vw0123, 3);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi2x4567, vw0123, 3);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi1x4567, vw89AB, 0);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi2x4567, vw89AB, 0);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi3x4567, vw89AB, 0);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi2x4567, vwCDEF, 1);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi3x4567, vwCDEF, 1);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi4x4567, vwCDEF, 1);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi3x4567, vwGHIJ, 2);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi4x4567, vwGHIJ, 2);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi5x4567, vwGHIJ, 2);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi4x4567, vwKLMN, 3);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi5x4567, vwKLMN, 3);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi6x4567, vwKLMN, 3);
+
+
+ const float32x4_t vi0x3456 = vextq_f32(vi0x0123, vi0x4567, 3);
+ const float32x4_t vi1x3456 = vextq_f32(vi1x0123, vi1x4567, 3);
+ const float32x4_t vi2x3456 = vextq_f32(vi2x0123, vi2x4567, 3);
+ const float32x4_t vi3x3456 = vextq_f32(vi3x0123, vi3x4567, 3);
+ const float32x4_t vi4x3456 = vextq_f32(vi4x0123, vi4x4567, 3);
+ const float32x4_t vi5x3456 = vextq_f32(vi5x0123, vi5x4567, 3);
+ const float32x4_t vi6x3456 = vextq_f32(vi6x0123, vi6x4567, 3);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi0x3456, vw0123, 2);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi1x3456, vw0123, 2);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi2x3456, vw0123, 2);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi1x3456, vw4567, 3);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi2x3456, vw4567, 3);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi3x3456, vw4567, 3);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi2x3456, vwCDEF, 0);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi3x3456, vwCDEF, 0);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi4x3456, vwCDEF, 0);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi3x3456, vwGHIJ, 1);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi4x3456, vwGHIJ, 1);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi5x3456, vwGHIJ, 1);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi4x3456, vwKLMN, 2);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi5x3456, vwKLMN, 2);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi6x3456, vwKLMN, 2);
+
+
+ const float32x4_t vi0x2345 = vextq_f32(vi0x0123, vi0x4567, 2);
+ const float32x4_t vi1x2345 = vextq_f32(vi1x0123, vi1x4567, 2);
+ const float32x4_t vi2x2345 = vextq_f32(vi2x0123, vi2x4567, 2);
+ const float32x4_t vi3x2345 = vextq_f32(vi3x0123, vi3x4567, 2);
+ const float32x4_t vi4x2345 = vextq_f32(vi4x0123, vi4x4567, 2);
+ const float32x4_t vi5x2345 = vextq_f32(vi5x0123, vi5x4567, 2);
+ const float32x4_t vi6x2345 = vextq_f32(vi6x0123, vi6x4567, 2);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi0x2345, vw0123, 1);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi1x2345, vw0123, 1);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi2x2345, vw0123, 1);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi1x2345, vw4567, 2);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi2x2345, vw4567, 2);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi3x2345, vw4567, 2);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi2x2345, vw89AB, 3);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi3x2345, vw89AB, 3);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi4x2345, vw89AB, 3);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi3x2345, vwGHIJ, 0);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi4x2345, vwGHIJ, 0);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi5x2345, vwGHIJ, 0);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi4x2345, vwKLMN, 1);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi5x2345, vwKLMN, 1);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi6x2345, vwKLMN, 1);
+
+
+ vi0x0123 = vi0x4567;
+ vi1x0123 = vi1x4567;
+ vi2x0123 = vi2x4567;
+ vi3x0123 = vi3x4567;
+ vi4x0123 = vi4x4567;
+ vi5x0123 = vi5x4567;
+ vi6x0123 = vi6x4567;
+
+ const float32x4_t vi0x5678 = vextq_f32(vi0x4567, vi0x89AB, 1);
+ const float32x4_t vi1x5678 = vextq_f32(vi1x4567, vi1x89AB, 1);
+ const float32x4_t vi2x5678 = vextq_f32(vi2x4567, vi2x89AB, 1);
+ const float32x4_t vi3x5678 = vextq_f32(vi3x4567, vi3x89AB, 1);
+ const float32x4_t vi4x5678 = vextq_f32(vi4x4567, vi4x89AB, 1);
+ const float32x4_t vi5x5678 = vextq_f32(vi5x4567, vi5x89AB, 1);
+ const float32x4_t vi6x5678 = vextq_f32(vi6x4567, vi6x89AB, 1);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi0x5678, vw4567, 0);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi1x5678, vw4567, 0);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi2x5678, vw4567, 0);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi1x5678, vw89AB, 1);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi2x5678, vw89AB, 1);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi3x5678, vw89AB, 1);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi2x5678, vwCDEF, 2);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi3x5678, vwCDEF, 2);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi4x5678, vwCDEF, 2);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi3x5678, vwGHIJ, 3);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi4x5678, vwGHIJ, 3);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi5x5678, vwGHIJ, 3);
+
+ vo4567p00 = vfmaq_lane_f32( vo4567p00, vi4x5678, vwOP, 0);
+ vo4567p10 = vfmaq_lane_f32( vo4567p10, vi5x5678, vwOP, 0);
+ vo4567p20 = vfmaq_lane_f32( vo4567p20, vi6x5678, vwOP, 0);
+
+ const float32x4_t vi0x6789 = vextq_f32(vi0x4567, vi0x89AB, 2);
+ const float32x4_t vi1x6789 = vextq_f32(vi1x4567, vi1x89AB, 2);
+ const float32x4_t vi2x6789 = vextq_f32(vi2x4567, vi2x89AB, 2);
+ const float32x4_t vi3x6789 = vextq_f32(vi3x4567, vi3x89AB, 2);
+ const float32x4_t vi4x6789 = vextq_f32(vi4x4567, vi4x89AB, 2);
+ const float32x4_t vi5x6789 = vextq_f32(vi5x4567, vi5x89AB, 2);
+ const float32x4_t vi6x6789 = vextq_f32(vi6x4567, vi6x89AB, 2);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi0x6789, vw4567, 1);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi1x6789, vw4567, 1);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi2x6789, vw4567, 1);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi1x6789, vw89AB, 2);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi2x6789, vw89AB, 2);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi3x6789, vw89AB, 2);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi2x6789, vwCDEF, 3);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi3x6789, vwCDEF, 3);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi4x6789, vwCDEF, 3);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi3x6789, vwKLMN, 0);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi4x6789, vwKLMN, 0);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi5x6789, vwKLMN, 0);
+
+ vo4567p00 = vfmaq_lane_f32( vo4567p00, vi4x6789, vwOP, 1);
+ vo4567p10 = vfmaq_lane_f32( vo4567p10, vi5x6789, vwOP, 1);
+ vo4567p20 = vfmaq_lane_f32( vo4567p20, vi6x6789, vwOP, 1);
+
+ vi0x4567 = vi0x89AB;
+ vi1x4567 = vi1x89AB;
+ vi2x4567 = vi2x89AB;
+ vi3x4567 = vi3x89AB;
+ vi4x4567 = vi4x89AB;
+ vi5x4567 = vi5x89AB;
+ vi6x4567 = vi6x89AB;
+
+ float32x4_t vo0 = vo4567p00;
+ float32x4_t vo1 = vo4567p10;
+ float32x4_t vo2 = vo4567p20;
+
+ vo0 = vmaxq_f32(vo0, vmin);
+ vo0 = vminq_f32(vo0, vmax);
+ vo1 = vmaxq_f32(vo1, vmin);
+ vo1 = vminq_f32(vo1, vmax);
+ vo2 = vmaxq_f32(vo2, vmin);
+ vo2 = vminq_f32(vo2, vmax);
+
+ vst1q_f32(output0, vo0); output0 = (float*) ((uintptr_t) output0 + output_tuple_stride);
+ vst1q_f32(output1, vo1); output1 = (float*) ((uintptr_t) output1 + output_tuple_stride);
+ vst1q_f32(output2, vo2); output2 = (float*) ((uintptr_t) output2 + output_tuple_stride);
+ k -= 4;
+ }
+ assert(k >= 1);
+ assert(k <= 4);
+ {
+ float32x4_t vo4567p00 = vdupq_laneq_f32(vw0123, 0);
+ float32x4_t vo4567p10 = vdupq_laneq_f32(vw0123, 0);
+ float32x4_t vo4567p20 = vdupq_laneq_f32(vw0123, 0);
+
+ // This might have already happened if there are more than 4 pixels, but
+ // we can't count on it.
+ vi0x4567 = vreinterpretq_u32_f32(vandq_u32(vmask, vreinterpretq_f32_u32(vi0x4567)));
+ vi1x4567 = vreinterpretq_u32_f32(vandq_u32(vmask, vreinterpretq_f32_u32(vi1x4567)));
+ vi2x4567 = vreinterpretq_u32_f32(vandq_u32(vmask, vreinterpretq_f32_u32(vi2x4567)));
+ vi3x4567 = vreinterpretq_u32_f32(vandq_u32(vmask, vreinterpretq_f32_u32(vi3x4567)));
+ vi4x4567 = vreinterpretq_u32_f32(vandq_u32(vmask, vreinterpretq_f32_u32(vi4x4567)));
+ vi5x4567 = vreinterpretq_u32_f32(vandq_u32(vmask, vreinterpretq_f32_u32(vi5x4567)));
+ vi6x4567 = vreinterpretq_u32_f32(vandq_u32(vmask, vreinterpretq_f32_u32(vi6x4567)));
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi0x4567, vw0123, 3);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi1x4567, vw0123, 3);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi2x4567, vw0123, 3);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi1x4567, vw89AB, 0);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi2x4567, vw89AB, 0);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi3x4567, vw89AB, 0);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi2x4567, vwCDEF, 1);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi3x4567, vwCDEF, 1);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi4x4567, vwCDEF, 1);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi3x4567, vwGHIJ, 2);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi4x4567, vwGHIJ, 2);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi5x4567, vwGHIJ, 2);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi4x4567, vwKLMN, 3);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi5x4567, vwKLMN, 3);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi6x4567, vwKLMN, 3);
+
+
+ const float32x4_t vi0x3456 = vextq_f32(vi0x0123, vi0x4567, 3);
+ const float32x4_t vi1x3456 = vextq_f32(vi1x0123, vi1x4567, 3);
+ const float32x4_t vi2x3456 = vextq_f32(vi2x0123, vi2x4567, 3);
+ const float32x4_t vi3x3456 = vextq_f32(vi3x0123, vi3x4567, 3);
+ const float32x4_t vi4x3456 = vextq_f32(vi4x0123, vi4x4567, 3);
+ const float32x4_t vi5x3456 = vextq_f32(vi5x0123, vi5x4567, 3);
+ const float32x4_t vi6x3456 = vextq_f32(vi6x0123, vi6x4567, 3);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi0x3456, vw0123, 2);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi1x3456, vw0123, 2);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi2x3456, vw0123, 2);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi1x3456, vw4567, 3);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi2x3456, vw4567, 3);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi3x3456, vw4567, 3);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi2x3456, vwCDEF, 0);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi3x3456, vwCDEF, 0);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi4x3456, vwCDEF, 0);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi3x3456, vwGHIJ, 1);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi4x3456, vwGHIJ, 1);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi5x3456, vwGHIJ, 1);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi4x3456, vwKLMN, 2);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi5x3456, vwKLMN, 2);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi6x3456, vwKLMN, 2);
+
+ const float32x4_t vi0x2345 = vextq_f32(vi0x0123, vi0x4567, 2);
+ const float32x4_t vi1x2345 = vextq_f32(vi1x0123, vi1x4567, 2);
+ const float32x4_t vi2x2345 = vextq_f32(vi2x0123, vi2x4567, 2);
+ const float32x4_t vi3x2345 = vextq_f32(vi3x0123, vi3x4567, 2);
+ const float32x4_t vi4x2345 = vextq_f32(vi4x0123, vi4x4567, 2);
+ const float32x4_t vi5x2345 = vextq_f32(vi5x0123, vi5x4567, 2);
+ const float32x4_t vi6x2345 = vextq_f32(vi6x0123, vi6x4567, 2);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi0x2345, vw0123, 1);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi1x2345, vw0123, 1);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi2x2345, vw0123, 1);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi1x2345, vw4567, 2);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi2x2345, vw4567, 2);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi3x2345, vw4567, 2);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi2x2345, vw89AB, 3);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi3x2345, vw89AB, 3);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi4x2345, vw89AB, 3);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi3x2345, vwGHIJ, 0);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi4x2345, vwGHIJ, 0);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi5x2345, vwGHIJ, 0);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi4x2345, vwKLMN, 1);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi5x2345, vwKLMN, 1);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi6x2345, vwKLMN, 1);
+
+
+ const float32x4_t vzero = vmovq_n_f32(0.0f);
+ const float32x4_t vi0x5678 = vextq_f32(vi0x4567, vzero, 1);
+ const float32x4_t vi1x5678 = vextq_f32(vi1x4567, vzero, 1);
+ const float32x4_t vi2x5678 = vextq_f32(vi2x4567, vzero, 1);
+ const float32x4_t vi3x5678 = vextq_f32(vi3x4567, vzero, 1);
+ const float32x4_t vi4x5678 = vextq_f32(vi4x4567, vzero, 1);
+ const float32x4_t vi5x5678 = vextq_f32(vi5x4567, vzero, 1);
+ const float32x4_t vi6x5678 = vextq_f32(vi6x4567, vzero, 1);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi0x5678, vw4567, 0);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi1x5678, vw4567, 0);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi2x5678, vw4567, 0);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi1x5678, vw89AB, 1);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi2x5678, vw89AB, 1);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi3x5678, vw89AB, 1);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi2x5678, vwCDEF, 2);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi3x5678, vwCDEF, 2);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi4x5678, vwCDEF, 2);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi3x5678, vwGHIJ, 3);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi4x5678, vwGHIJ, 3);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi5x5678, vwGHIJ, 3);
+
+ vo4567p00 = vfmaq_lane_f32( vo4567p00, vi4x5678, vwOP, 0);
+ vo4567p10 = vfmaq_lane_f32( vo4567p10, vi5x5678, vwOP, 0);
+ vo4567p20 = vfmaq_lane_f32( vo4567p20, vi6x5678, vwOP, 0);
+
+ const float32x4_t vi0x6789 = vextq_f32(vi0x4567, vzero, 2);
+ const float32x4_t vi1x6789 = vextq_f32(vi1x4567, vzero, 2);
+ const float32x4_t vi2x6789 = vextq_f32(vi2x4567, vzero, 2);
+ const float32x4_t vi3x6789 = vextq_f32(vi3x4567, vzero, 2);
+ const float32x4_t vi4x6789 = vextq_f32(vi4x4567, vzero, 2);
+ const float32x4_t vi5x6789 = vextq_f32(vi5x4567, vzero, 2);
+ const float32x4_t vi6x6789 = vextq_f32(vi6x4567, vzero, 2);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi0x6789, vw4567, 1);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi1x6789, vw4567, 1);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi2x6789, vw4567, 1);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi1x6789, vw89AB, 2);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi2x6789, vw89AB, 2);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi3x6789, vw89AB, 2);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi2x6789, vwCDEF, 3);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi3x6789, vwCDEF, 3);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi4x6789, vwCDEF, 3);
+
+ vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi3x6789, vwKLMN, 0);
+ vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi4x6789, vwKLMN, 0);
+ vo4567p20 = vfmaq_laneq_f32(vo4567p20, vi5x6789, vwKLMN, 0);
+
+ vo4567p00 = vfmaq_lane_f32( vo4567p00, vi4x6789, vwOP, 1);
+ vo4567p10 = vfmaq_lane_f32( vo4567p10, vi5x6789, vwOP, 1);
+ vo4567p20 = vfmaq_lane_f32( vo4567p20, vi6x6789, vwOP, 1);
+
+ float32x4_t vo0 = vo4567p00;
+ float32x4_t vo1 = vo4567p10;
+ float32x4_t vo2 = vo4567p20;
+
+ vo0 = vmaxq_f32(vo0, vmin);
+ vo0 = vminq_f32(vo0, vmax);
+ vo1 = vmaxq_f32(vo1, vmin);
+ vo1 = vminq_f32(vo1, vmax);
+ vo2 = vmaxq_f32(vo2, vmin);
+ vo2 = vminq_f32(vo2, vmax);
+
+ if XNN_LIKELY(k & 4) {
+ vst1q_f32(output0, vo0);
+ vst1q_f32(output1, vo1);
+ vst1q_f32(output2, vo2);
+ } else {
+ float* output0_lo = output0;
+ float* output1_lo = output1;
+ float* output2_lo = output2;
+ float32x2_t vo0_lo = vget_low_f32(vo0);
+ float32x2_t vo1_lo = vget_low_f32(vo1);
+ float32x2_t vo2_lo = vget_low_f32(vo2);
+ if (k & 2) {
+ vst1_f32(output0_lo, vo0_lo); output0_lo += 2;
+ vst1_f32(output1_lo, vo1_lo); output1_lo += 2;
+ vst1_f32(output2_lo, vo2_lo); output2_lo += 2;
+ vo0_lo = vget_high_f32(vo0);
+ vo1_lo = vget_high_f32(vo1);
+ vo2_lo = vget_high_f32(vo2);
+ }
+ if (k & 1) {
+ vst1_lane_f32(output0_lo, vo0_lo, 0);
+ vst1_lane_f32(output1_lo, vo1_lo, 0);
+ vst1_lane_f32(output2_lo, vo2_lo, 0);
+ }
+ }
+ }
+
+ i0 = (const float*) ((uintptr_t) i0 + input_width_increment_triple);
+ i1 = (const float*) ((uintptr_t) i1 + input_width_increment_triple);
+ i2 = (const float*) ((uintptr_t) i2 + input_width_increment_triple);
+ i3 = (const float*) ((uintptr_t) i3 + input_width_increment_triple);
+ i4 = (const float*) ((uintptr_t) i4 + input_width_increment_triple);
+ i5 = (const float*) ((uintptr_t) i5 + input_width_increment_triple);
+ i6 = (const float*) ((uintptr_t) i6 + input_width_increment_triple);
+ output0 = (float*) ((uintptr_t) output2 + output_width_increment_single);
+ output1 = (float*) ((uintptr_t) output0 + output_width_stride);
+ output2 = (float*) ((uintptr_t) output1 + output_width_stride);
+ m -= 3;
+ }
+
+ if (m == 2) {
float32x4_t vi0x0123 = vmovq_n_f32(0.0f);
float32x4_t vi1x0123 = vmovq_n_f32(0.0f);
float32x4_t vi2x0123 = vmovq_n_f32(0.0f);
@@ -137,7 +726,6 @@
vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi4x2345, vwKLMN, 1);
vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi5x2345, vwKLMN, 1);
-
vi0x0123 = vi0x4567;
vi1x0123 = vi1x4567;
vi2x0123 = vi2x4567;
@@ -189,7 +777,6 @@
vo4567p00 = vfmaq_lane_f32( vo4567p00, vi4x6789, vwOP, 1);
vo4567p10 = vfmaq_lane_f32( vo4567p10, vi5x6789, vwOP, 1);
-
vi0x4567 = vi0x89AB;
vi1x4567 = vi1x89AB;
vi2x4567 = vi2x89AB;
@@ -435,7 +1022,6 @@
vo4567p00 = vfmaq_laneq_f32(vo4567p00, vi4x2345, vwKLMN, 1);
vo4567p10 = vfmaq_laneq_f32(vo4567p10, vi5x2345, vwKLMN, 1);
-
const float32x4_t vzero = vmovq_n_f32(0.0f);
const float32x4_t vi0x5678 = vextq_f32(vi0x4567, vzero, 1);
const float32x4_t vi1x5678 = vextq_f32(vi1x4567, vzero, 1);
@@ -509,19 +1095,8 @@
}
}
}
-
- i0 = (const float*) ((uintptr_t) i0 + input_width_increment_double);
- i1 = (const float*) ((uintptr_t) i1 + input_width_increment_double);
- i2 = (const float*) ((uintptr_t) i2 + input_width_increment_double);
- i3 = (const float*) ((uintptr_t) i3 + input_width_increment_double);
- i4 = (const float*) ((uintptr_t) i4 + input_width_increment_double);
- i5 = (const float*) ((uintptr_t) i5 + input_width_increment_double);
- output0 = (float*) ((uintptr_t) output1 + output_width_increment_single);
- output1 = (float*) ((uintptr_t) output0 + output_width_stride);
- m -= 2;
}
-
- if (m == 1) {
+ else if (m == 1) {
float32x4_t vi0x0123 = vmovq_n_f32(0.0f);
float32x4_t vi1x0123 = vmovq_n_f32(0.0f);
float32x4_t vi2x0123 = vmovq_n_f32(0.0f);
diff --git a/src/init.c b/src/init.c
index f63d7a8..dbcae34 100644
--- a/src/init.c
+++ b/src/init.c
@@ -521,7 +521,7 @@
.ukernel = (xnn_dwconv_spchw_ukernel_function) xnn_f32_dwconv_spchw_ukernel_5x5p2__neonfma,
.input_width_tile = 4,
.output_width_tile = 4,
- .output_height_tile = 2,
+ .output_height_tile = 3,
};
xnn_params.f32.spchw_dwconv5x5s2 = (struct spchw_dwconv_parameters) {
.ukernel = (xnn_dwconv_spchw_ukernel_function) xnn_f32_dwconv_spchw_ukernel_5x5s2p2__neonfma,
diff --git a/test/f32-dwconv-spchw.cc b/test/f32-dwconv-spchw.cc
index efbff7d..c53170f 100644
--- a/test/f32-dwconv-spchw.cc
+++ b/test/f32-dwconv-spchw.cc
@@ -813,9 +813,25 @@
}
}
- TEST(F32_DWCONV_SPCHW_5X5P2__NEONFMA, output_height_gt_1) {
+ TEST(F32_DWCONV_SPCHW_5X5P2__NEONFMA, output_height_eq_2) {
TEST_REQUIRES_ARM_NEON_FMA;
- for (size_t output_height = 2; output_height < 5; output_height++) {
+ for (size_t input_width = 1; input_width < 32; input_width += 3) {
+ DWConvSpCHWMicrokernelTester()
+ .input_tuple_size(4)
+ .output_tuple_size(4)
+ .input_width(input_width)
+ .padding_left(2)
+ .padding_right(2)
+ .kernel_height(5)
+ .kernel_width(5)
+ .output_height(2)
+ .Test(xnn_f32_dwconv_spchw_ukernel_5x5p2__neonfma);
+ }
+ }
+
+ TEST(F32_DWCONV_SPCHW_5X5P2__NEONFMA, output_height_gt_2) {
+ TEST_REQUIRES_ARM_NEON_FMA;
+ for (size_t output_height = 3; output_height < 5; output_height++) {
for (size_t input_width = 1; input_width < 32; input_width += 3) {
DWConvSpCHWMicrokernelTester()
.input_tuple_size(4)