Debian Codegraph @

src/f32-igemm/gen/f32-igemm-1x8-minmax-neon-lane-ld128.c

raw symbols SCIP
1 // Auto-generated file. Do not edit!
2 // Template: src/f32-igemm/neon-ld128.c.in
3 // Generator: tools/xngen
4 //
5 // Copyright 2019 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
11 #include <assert.h>
12
13 #include <arm_neon.h>
14
15 #include "xnnpack/igemm.h"
16
17
18 void xnn_f32_igemm_minmax_ukernel_1x8__neon_lane_ld128(
19 size_t mr,
20 size_t nc,
21 size_t kc,
22 size_t ks,
23 const float** restrict a,
24 const float* restrict w,
25 float* restrict c,
26 size_t cm_stride,
27 size_t cn_stride,
28 size_t a_offset,
29 const float* zero,
30 const union xnn_f32_minmax_params params[restrict XNN_MIN_ELEMENTS(1)])
31 {
32 assert(mr != 0);
33 assert(mr <= 1);
34 assert(nc != 0);
35 assert(kc != 0);
36 assert(kc % sizeof(float) == 0);
37 assert(ks != 0);
38 assert(ks % (1 * sizeof(void*)) == 0);
39 assert(a_offset % sizeof(float) == 0);
40 assert(a != NULL);
41 assert(w != NULL);
42 assert(c != NULL);
43
44 float* c0 = c;
45
46 do {
47 float32x4_t vacc0x0 = vld1q_f32(w); w += 4;
48 float32x4_t vacc0x1 = vld1q_f32(w); w += 4;
49
50 size_t p = ks;
51 do {
52 const float* restrict a0 = a[0];
53 assert(a0 != NULL);
54 if XNN_UNPREDICTABLE(a0 != zero) {
55 a0 = (const float*) ((uintptr_t) a0 + a_offset);
56 }
57 a += 1;
58
59 size_t k = kc;
60 for (; k >= 4 * sizeof(float); k -= 4 * sizeof(float)) {
61 const float32x4_t va0 = vld1q_f32(a0); a0 += 4;
62
63
64 const float32x4_t vb0123c0 = vld1q_f32(w); w += 4;
65 const float32x4_t vb4567c0 = vld1q_f32(w); w += 4;
66
67 vacc0x0 = vmlaq_lane_f32(vacc0x0, vb0123c0, vget_low_f32(va0), 0);
68 vacc0x1 = vmlaq_lane_f32(vacc0x1, vb4567c0, vget_low_f32(va0), 0);
69
70 const float32x4_t vb0123c1 = vld1q_f32(w); w += 4;
71 const float32x4_t vb4567c1 = vld1q_f32(w); w += 4;
72
73 vacc0x0 = vmlaq_lane_f32(vacc0x0, vb0123c1, vget_low_f32(va0), 1);
74 vacc0x1 = vmlaq_lane_f32(vacc0x1, vb4567c1, vget_low_f32(va0), 1);
75
76 const float32x4_t vb0123c2 = vld1q_f32(w); w += 4;
77 const float32x4_t vb4567c2 = vld1q_f32(w); w += 4;
78
79 vacc0x0 = vmlaq_lane_f32(vacc0x0, vb0123c2, vget_high_f32(va0), 0);
80 vacc0x1 = vmlaq_lane_f32(vacc0x1, vb4567c2, vget_high_f32(va0), 0);
81
82 const float32x4_t vb0123c3 = vld1q_f32(w); w += 4;
83 const float32x4_t vb4567c3 = vld1q_f32(w); w += 4;
84
85 vacc0x0 = vmlaq_lane_f32(vacc0x0, vb0123c3, vget_high_f32(va0), 1);
86 vacc0x1 = vmlaq_lane_f32(vacc0x1, vb4567c3, vget_high_f32(va0), 1);
87 }
88 if XNN_UNLIKELY(k != 0) {
89 do {
90 const float32x4_t va0 = vld1q_dup_f32(a0); a0 += 1;
91
92 const float32x4_t vb0123 = vld1q_f32(w); w += 4;
93 const float32x4_t vb4567 = vld1q_f32(w); w += 4;
94
95 vacc0x0 = vmlaq_f32(vacc0x0, va0, vb0123);
96 vacc0x1 = vmlaq_f32(vacc0x1, va0, vb4567);
97
98 k -= sizeof(float);
99 } while (k != 0);
100 }
101
102 p -= 1 * sizeof(void*);
103 } while (p != 0);
104
105 const float32x4_t vmax = vld1q_dup_f32(&params->scalar.max);
106 vacc0x0 = vminq_f32(vacc0x0, vmax);
107 vacc0x1 = vminq_f32(vacc0x1, vmax);
108
109 const float32x4_t vmin = vld1q_dup_f32(&params->scalar.min);
110 vacc0x0 = vmaxq_f32(vacc0x0, vmin);
111 vacc0x1 = vmaxq_f32(vacc0x1, vmin);
112
113 if XNN_LIKELY(nc >= 8) {
114 vst1q_f32(c0, vacc0x0);
115 vst1q_f32(c0 + 4, vacc0x1);
116 c0 = (float*) ((uintptr_t) c0 + cn_stride);
117
118 a = (const float**restrict) ((uintptr_t) a - ks);
119 nc -= 8;
120 } else {
121 if (nc & 4) {
122 vst1q_f32(c0, vacc0x0); c0 += 4;
123
124 vacc0x0 = vacc0x1;
125 }
126 float32x2_t vacc0 = vget_low_f32(vacc0x0);
127 if (nc & 2) {
128 vst1_f32(c0, vacc0); c0 += 2;
129
130 vacc0 = vget_high_f32(vacc0x0);
131 }
132 if (nc & 1) {
133 vst1_lane_f32(c0, vacc0, 0);
134 }
135
136 nc = 0;
137 }
138 } while (nc != 0);
139 }