1 // Auto-generated file. Do not edit!
2 // Template: src/f32-dwconv/up-scalar.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 #include <assert.h>
11
12 #include <xnnpack/dwconv.h>
13 #include <xnnpack/math.h>
14
15
xnn_f32_dwconv_ukernel_up2x25__scalar(size_t channels,size_t output_width,const float ** input,const float * weights,float * output,size_t input_stride,size_t output_increment,size_t input_offset,const float * zero,const union xnn_f32_default_params params[restrict XNN_MIN_ELEMENTS (1)])16 void xnn_f32_dwconv_ukernel_up2x25__scalar(
17 size_t channels,
18 size_t output_width,
19 const float** input,
20 const float* weights,
21 float* output,
22 size_t input_stride,
23 size_t output_increment,
24 size_t input_offset,
25 const float* zero,
26 const union xnn_f32_default_params params[restrict XNN_MIN_ELEMENTS(1)])
27 {
28 assert(channels != 0);
29 assert(output_width != 0);
30
31 do {
32 const float* i0 = input[0];
33 assert(i0 != NULL);
34 if XNN_UNPREDICTABLE(i0 != zero) {
35 i0 = (const float*) ((uintptr_t) i0 + input_offset);
36 }
37 const float* i1 = input[1];
38 assert(i1 != NULL);
39 if XNN_UNPREDICTABLE(i1 != zero) {
40 i1 = (const float*) ((uintptr_t) i1 + input_offset);
41 }
42 const float* i2 = input[2];
43 assert(i2 != NULL);
44 if XNN_UNPREDICTABLE(i2 != zero) {
45 i2 = (const float*) ((uintptr_t) i2 + input_offset);
46 }
47 const float* i3 = input[3];
48 assert(i3 != NULL);
49 if XNN_UNPREDICTABLE(i3 != zero) {
50 i3 = (const float*) ((uintptr_t) i3 + input_offset);
51 }
52 const float* i4 = input[4];
53 assert(i4 != NULL);
54 if XNN_UNPREDICTABLE(i4 != zero) {
55 i4 = (const float*) ((uintptr_t) i4 + input_offset);
56 }
57 const float* i5 = input[5];
58 assert(i5 != NULL);
59 if XNN_UNPREDICTABLE(i5 != zero) {
60 i5 = (const float*) ((uintptr_t) i5 + input_offset);
61 }
62 const float* i6 = input[6];
63 assert(i6 != NULL);
64 if XNN_UNPREDICTABLE(i6 != zero) {
65 i6 = (const float*) ((uintptr_t) i6 + input_offset);
66 }
67 const float* i7 = input[7];
68 assert(i7 != NULL);
69 if XNN_UNPREDICTABLE(i7 != zero) {
70 i7 = (const float*) ((uintptr_t) i7 + input_offset);
71 }
72 const float* i8 = input[8];
73 assert(i8 != NULL);
74 if XNN_UNPREDICTABLE(i8 != zero) {
75 i8 = (const float*) ((uintptr_t) i8 + input_offset);
76 }
77 const float* i9 = input[9];
78 assert(i9 != NULL);
79 if XNN_UNPREDICTABLE(i9 != zero) {
80 i9 = (const float*) ((uintptr_t) i9 + input_offset);
81 }
82 const float* i10 = input[10];
83 assert(i10 != NULL);
84 if XNN_UNPREDICTABLE(i10 != zero) {
85 i10 = (const float*) ((uintptr_t) i10 + input_offset);
86 }
87 const float* i11 = input[11];
88 assert(i11 != NULL);
89 if XNN_UNPREDICTABLE(i11 != zero) {
90 i11 = (const float*) ((uintptr_t) i11 + input_offset);
91 }
92 const float* i12 = input[12];
93 assert(i12 != NULL);
94 if XNN_UNPREDICTABLE(i12 != zero) {
95 i12 = (const float*) ((uintptr_t) i12 + input_offset);
96 }
97 const float* i13 = input[13];
98 assert(i13 != NULL);
99 if XNN_UNPREDICTABLE(i13 != zero) {
100 i13 = (const float*) ((uintptr_t) i13 + input_offset);
101 }
102 const float* i14 = input[14];
103 assert(i14 != NULL);
104 if XNN_UNPREDICTABLE(i14 != zero) {
105 i14 = (const float*) ((uintptr_t) i14 + input_offset);
106 }
107 const float* i15 = input[15];
108 assert(i15 != NULL);
109 if XNN_UNPREDICTABLE(i15 != zero) {
110 i15 = (const float*) ((uintptr_t) i15 + input_offset);
111 }
112 const float* i16 = input[16];
113 assert(i16 != NULL);
114 if XNN_UNPREDICTABLE(i16 != zero) {
115 i16 = (const float*) ((uintptr_t) i16 + input_offset);
116 }
117 const float* i17 = input[17];
118 assert(i17 != NULL);
119 if XNN_UNPREDICTABLE(i17 != zero) {
120 i17 = (const float*) ((uintptr_t) i17 + input_offset);
121 }
122 const float* i18 = input[18];
123 assert(i18 != NULL);
124 if XNN_UNPREDICTABLE(i18 != zero) {
125 i18 = (const float*) ((uintptr_t) i18 + input_offset);
126 }
127 const float* i19 = input[19];
128 assert(i19 != NULL);
129 if XNN_UNPREDICTABLE(i19 != zero) {
130 i19 = (const float*) ((uintptr_t) i19 + input_offset);
131 }
132 const float* i20 = input[20];
133 assert(i20 != NULL);
134 if XNN_UNPREDICTABLE(i20 != zero) {
135 i20 = (const float*) ((uintptr_t) i20 + input_offset);
136 }
137 const float* i21 = input[21];
138 assert(i21 != NULL);
139 if XNN_UNPREDICTABLE(i21 != zero) {
140 i21 = (const float*) ((uintptr_t) i21 + input_offset);
141 }
142 const float* i22 = input[22];
143 assert(i22 != NULL);
144 if XNN_UNPREDICTABLE(i22 != zero) {
145 i22 = (const float*) ((uintptr_t) i22 + input_offset);
146 }
147 const float* i23 = input[23];
148 assert(i23 != NULL);
149 if XNN_UNPREDICTABLE(i23 != zero) {
150 i23 = (const float*) ((uintptr_t) i23 + input_offset);
151 }
152 const float* i24 = input[24];
153 assert(i24 != NULL);
154 if XNN_UNPREDICTABLE(i24 != zero) {
155 i24 = (const float*) ((uintptr_t) i24 + input_offset);
156 }
157 input = (const float**) ((uintptr_t) input + input_stride);
158
159 size_t c = channels;
160 const float* w = weights;
161 for (; c >= 2; c -= 2) {
162 float vacc0p0 = w[0];
163 float vacc1p0 = w[1];
164
165
166 const float vi0x0 = i0[0];
167 const float vi0x1 = i0[1];
168 i0 += 2;
169
170 const float vk0x0 = w[2];
171 vacc0p0 += vi0x0 * vk0x0;
172 const float vk0x1 = w[3];
173 vacc1p0 += vi0x1 * vk0x1;
174
175 const float vi1x0 = i1[0];
176 const float vi1x1 = i1[1];
177 i1 += 2;
178
179 const float vk1x0 = w[4];
180 vacc0p0 += vi1x0 * vk1x0;
181 const float vk1x1 = w[5];
182 vacc1p0 += vi1x1 * vk1x1;
183
184 const float vi2x0 = i2[0];
185 const float vi2x1 = i2[1];
186 i2 += 2;
187
188 const float vk2x0 = w[6];
189 vacc0p0 += vi2x0 * vk2x0;
190 const float vk2x1 = w[7];
191 vacc1p0 += vi2x1 * vk2x1;
192
193 const float vi3x0 = i3[0];
194 const float vi3x1 = i3[1];
195 i3 += 2;
196
197 const float vk3x0 = w[8];
198 vacc0p0 += vi3x0 * vk3x0;
199 const float vk3x1 = w[9];
200 vacc1p0 += vi3x1 * vk3x1;
201
202 const float vi4x0 = i4[0];
203 const float vi4x1 = i4[1];
204 i4 += 2;
205
206 const float vk4x0 = w[10];
207 vacc0p0 += vi4x0 * vk4x0;
208 const float vk4x1 = w[11];
209 vacc1p0 += vi4x1 * vk4x1;
210
211 const float vi5x0 = i5[0];
212 const float vi5x1 = i5[1];
213 i5 += 2;
214
215 const float vk5x0 = w[12];
216 vacc0p0 += vi5x0 * vk5x0;
217 const float vk5x1 = w[13];
218 vacc1p0 += vi5x1 * vk5x1;
219
220 const float vi6x0 = i6[0];
221 const float vi6x1 = i6[1];
222 i6 += 2;
223
224 const float vk6x0 = w[14];
225 vacc0p0 += vi6x0 * vk6x0;
226 const float vk6x1 = w[15];
227 vacc1p0 += vi6x1 * vk6x1;
228
229 const float vi7x0 = i7[0];
230 const float vi7x1 = i7[1];
231 i7 += 2;
232
233 const float vk7x0 = w[16];
234 vacc0p0 += vi7x0 * vk7x0;
235 const float vk7x1 = w[17];
236 vacc1p0 += vi7x1 * vk7x1;
237
238 const float vi8x0 = i8[0];
239 const float vi8x1 = i8[1];
240 i8 += 2;
241
242 const float vk8x0 = w[18];
243 vacc0p0 += vi8x0 * vk8x0;
244 const float vk8x1 = w[19];
245 vacc1p0 += vi8x1 * vk8x1;
246
247 const float vi9x0 = i9[0];
248 const float vi9x1 = i9[1];
249 i9 += 2;
250
251 const float vk9x0 = w[20];
252 vacc0p0 += vi9x0 * vk9x0;
253 const float vk9x1 = w[21];
254 vacc1p0 += vi9x1 * vk9x1;
255
256 const float vi10x0 = i10[0];
257 const float vi10x1 = i10[1];
258 i10 += 2;
259
260 const float vk10x0 = w[22];
261 vacc0p0 += vi10x0 * vk10x0;
262 const float vk10x1 = w[23];
263 vacc1p0 += vi10x1 * vk10x1;
264
265 const float vi11x0 = i11[0];
266 const float vi11x1 = i11[1];
267 i11 += 2;
268
269 const float vk11x0 = w[24];
270 vacc0p0 += vi11x0 * vk11x0;
271 const float vk11x1 = w[25];
272 vacc1p0 += vi11x1 * vk11x1;
273
274 const float vi12x0 = i12[0];
275 const float vi12x1 = i12[1];
276 i12 += 2;
277
278 const float vk12x0 = w[26];
279 vacc0p0 += vi12x0 * vk12x0;
280 const float vk12x1 = w[27];
281 vacc1p0 += vi12x1 * vk12x1;
282
283 const float vi13x0 = i13[0];
284 const float vi13x1 = i13[1];
285 i13 += 2;
286
287 const float vk13x0 = w[28];
288 vacc0p0 += vi13x0 * vk13x0;
289 const float vk13x1 = w[29];
290 vacc1p0 += vi13x1 * vk13x1;
291
292 const float vi14x0 = i14[0];
293 const float vi14x1 = i14[1];
294 i14 += 2;
295
296 const float vk14x0 = w[30];
297 vacc0p0 += vi14x0 * vk14x0;
298 const float vk14x1 = w[31];
299 vacc1p0 += vi14x1 * vk14x1;
300
301 const float vi15x0 = i15[0];
302 const float vi15x1 = i15[1];
303 i15 += 2;
304
305 const float vk15x0 = w[32];
306 vacc0p0 += vi15x0 * vk15x0;
307 const float vk15x1 = w[33];
308 vacc1p0 += vi15x1 * vk15x1;
309
310 const float vi16x0 = i16[0];
311 const float vi16x1 = i16[1];
312 i16 += 2;
313
314 const float vk16x0 = w[34];
315 vacc0p0 += vi16x0 * vk16x0;
316 const float vk16x1 = w[35];
317 vacc1p0 += vi16x1 * vk16x1;
318
319 const float vi17x0 = i17[0];
320 const float vi17x1 = i17[1];
321 i17 += 2;
322
323 const float vk17x0 = w[36];
324 vacc0p0 += vi17x0 * vk17x0;
325 const float vk17x1 = w[37];
326 vacc1p0 += vi17x1 * vk17x1;
327
328 const float vi18x0 = i18[0];
329 const float vi18x1 = i18[1];
330 i18 += 2;
331
332 const float vk18x0 = w[38];
333 vacc0p0 += vi18x0 * vk18x0;
334 const float vk18x1 = w[39];
335 vacc1p0 += vi18x1 * vk18x1;
336
337 const float vi19x0 = i19[0];
338 const float vi19x1 = i19[1];
339 i19 += 2;
340
341 const float vk19x0 = w[40];
342 vacc0p0 += vi19x0 * vk19x0;
343 const float vk19x1 = w[41];
344 vacc1p0 += vi19x1 * vk19x1;
345
346 const float vi20x0 = i20[0];
347 const float vi20x1 = i20[1];
348 i20 += 2;
349
350 const float vk20x0 = w[42];
351 vacc0p0 += vi20x0 * vk20x0;
352 const float vk20x1 = w[43];
353 vacc1p0 += vi20x1 * vk20x1;
354
355 const float vi21x0 = i21[0];
356 const float vi21x1 = i21[1];
357 i21 += 2;
358
359 const float vk21x0 = w[44];
360 vacc0p0 += vi21x0 * vk21x0;
361 const float vk21x1 = w[45];
362 vacc1p0 += vi21x1 * vk21x1;
363
364 const float vi22x0 = i22[0];
365 const float vi22x1 = i22[1];
366 i22 += 2;
367
368 const float vk22x0 = w[46];
369 vacc0p0 += vi22x0 * vk22x0;
370 const float vk22x1 = w[47];
371 vacc1p0 += vi22x1 * vk22x1;
372
373 const float vi23x0 = i23[0];
374 const float vi23x1 = i23[1];
375 i23 += 2;
376
377 const float vk23x0 = w[48];
378 vacc0p0 += vi23x0 * vk23x0;
379 const float vk23x1 = w[49];
380 vacc1p0 += vi23x1 * vk23x1;
381
382 const float vi24x0 = i24[0];
383 const float vi24x1 = i24[1];
384 i24 += 2;
385
386 const float vk24x0 = w[50];
387 vacc0p0 += vi24x0 * vk24x0;
388 const float vk24x1 = w[51];
389 vacc1p0 += vi24x1 * vk24x1;
390
391 w += 52;
392
393
394 output[0] = vacc0p0;
395 output[1] = vacc1p0;
396 output += 2;
397 }
398 for (; c >= 1; c -= 1) {
399 float vacc0p0 = *w++;
400
401 const float vi0 = *i0++;
402 const float vk0 = w[1];
403 vacc0p0 += vi0 * vk0;
404 const float vi1 = *i1++;
405 const float vk1 = w[3];
406 vacc0p0 += vi1 * vk1;
407 const float vi2 = *i2++;
408 const float vk2 = w[5];
409 vacc0p0 += vi2 * vk2;
410 const float vi3 = *i3++;
411 const float vk3 = w[7];
412 vacc0p0 += vi3 * vk3;
413 const float vi4 = *i4++;
414 const float vk4 = w[9];
415 vacc0p0 += vi4 * vk4;
416 const float vi5 = *i5++;
417 const float vk5 = w[11];
418 vacc0p0 += vi5 * vk5;
419 const float vi6 = *i6++;
420 const float vk6 = w[13];
421 vacc0p0 += vi6 * vk6;
422 const float vi7 = *i7++;
423 const float vk7 = w[15];
424 vacc0p0 += vi7 * vk7;
425 const float vi8 = *i8++;
426 const float vk8 = w[17];
427 vacc0p0 += vi8 * vk8;
428 const float vi9 = *i9++;
429 const float vk9 = w[19];
430 vacc0p0 += vi9 * vk9;
431 const float vi10 = *i10++;
432 const float vk10 = w[21];
433 vacc0p0 += vi10 * vk10;
434 const float vi11 = *i11++;
435 const float vk11 = w[23];
436 vacc0p0 += vi11 * vk11;
437 const float vi12 = *i12++;
438 const float vk12 = w[25];
439 vacc0p0 += vi12 * vk12;
440 const float vi13 = *i13++;
441 const float vk13 = w[27];
442 vacc0p0 += vi13 * vk13;
443 const float vi14 = *i14++;
444 const float vk14 = w[29];
445 vacc0p0 += vi14 * vk14;
446 const float vi15 = *i15++;
447 const float vk15 = w[31];
448 vacc0p0 += vi15 * vk15;
449 const float vi16 = *i16++;
450 const float vk16 = w[33];
451 vacc0p0 += vi16 * vk16;
452 const float vi17 = *i17++;
453 const float vk17 = w[35];
454 vacc0p0 += vi17 * vk17;
455 const float vi18 = *i18++;
456 const float vk18 = w[37];
457 vacc0p0 += vi18 * vk18;
458 const float vi19 = *i19++;
459 const float vk19 = w[39];
460 vacc0p0 += vi19 * vk19;
461 const float vi20 = *i20++;
462 const float vk20 = w[41];
463 vacc0p0 += vi20 * vk20;
464 const float vi21 = *i21++;
465 const float vk21 = w[43];
466 vacc0p0 += vi21 * vk21;
467 const float vi22 = *i22++;
468 const float vk22 = w[45];
469 vacc0p0 += vi22 * vk22;
470 const float vi23 = *i23++;
471 const float vk23 = w[47];
472 vacc0p0 += vi23 * vk23;
473 const float vi24 = *i24++;
474 const float vk24 = w[49];
475 vacc0p0 += vi24 * vk24;
476
477
478 *output++ = vacc0p0;
479 }
480
481 output = (float*) ((uintptr_t) output + output_increment);
482 } while (--output_width != 0);
483 }
484