• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_up1x9__wasm_acc2(size_t channels,size_t output_width,const float ** input,const float * weights,float * output,size_t input_stride,size_t output_increment,const union xnn_f32_output_params params[restrict static1])16 void xnn_f32_dwconv_ukernel_up1x9__wasm_acc2(
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     const union xnn_f32_output_params params[restrict static 1])
25 {
26   assert(channels != 0);
27   assert(output_width != 0);
28 
29   const float vmin = params->scalar.min;
30   const float vmax = params->scalar.max;
31   do {
32     const float* i0 = input[0];
33     assert(i0 != NULL);
34     const float* i1 = input[1];
35     assert(i1 != NULL);
36     const float* i2 = input[2];
37     assert(i2 != NULL);
38     const float* i3 = input[3];
39     assert(i3 != NULL);
40     const float* i4 = input[4];
41     assert(i4 != NULL);
42     const float* i5 = input[5];
43     assert(i5 != NULL);
44     const float* i6 = input[6];
45     assert(i6 != NULL);
46     const float* i7 = input[7];
47     assert(i7 != NULL);
48     const float* i8 = input[8];
49     assert(i8 != NULL);
50     input = (const float**) ((uintptr_t) input + input_stride);
51 
52     size_t c = channels;
53     const float* w = weights;
54     do {
55       float vacc0p0 = w[0];
56 
57       const float vi0 = *i0++;
58       const float vk0 = w[1];
59       vacc0p0 += vi0 * vk0;
60 
61       const float vi1 = *i1++;
62       const float vk1 = w[2];
63       float vacc0p1 = vi1 * vk1;
64 
65       const float vi2 = *i2++;
66       const float vk2 = w[3];
67       vacc0p0 += vi2 * vk2;
68 
69       const float vi3 = *i3++;
70       const float vk3 = w[4];
71       vacc0p1 += vi3 * vk3;
72 
73       const float vi4 = *i4++;
74       const float vk4 = w[5];
75       vacc0p0 += vi4 * vk4;
76 
77       const float vi5 = *i5++;
78       const float vk5 = w[6];
79       vacc0p1 += vi5 * vk5;
80 
81       const float vi6 = *i6++;
82       const float vk6 = w[7];
83       vacc0p0 += vi6 * vk6;
84 
85       const float vi7 = *i7++;
86       const float vk7 = w[8];
87       vacc0p1 += vi7 * vk7;
88 
89       const float vi8 = *i8++;
90       const float vk8 = w[9];
91       vacc0p0 += vi8 * vk8;
92 
93       w += 10;
94 
95       vacc0p0 += vacc0p1;
96 
97       float vacc0 = __builtin_wasm_max_f32(vacc0p0, vmin);
98       vacc0 = __builtin_wasm_min_f32(vacc0, vmax);
99 
100       *output++ = vacc0;
101     } while (--c != 0);
102 
103     output = (float*) ((uintptr_t) output + output_increment);
104   } while (--output_width != 0);
105 }
106