Debian Codegraph @

src/f32-rsum/gen/f32-rsum-scalar-u2-acc2.c

raw
1 // Auto-generated file. Do not edit!
2 // Template: src/f32-rsum/scalar.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 "xnnpack/common.h"
13 #include "xnnpack/reduce.h"
14
15
16 void xnn_f32_rsum_ukernel__scalar_u2_acc2(
17 size_t batch,
18 const float* input,
19 float* output,
20 const struct xnn_f32_scale_params params[restrict XNN_MIN_ELEMENTS(1)])
21 {
22 assert(batch != 0);
23 assert(batch % sizeof(float) == 0);
24 assert(input != NULL);
25 assert(output != NULL);
26
27 float vacc0 = 0.0f;
28 float vacc1 = 0.0f;
29 for (; batch >= 2 * sizeof(float); batch -= 2 * sizeof(float)) {
30 const float vt0 = input[0];
31 const float vt1 = input[1];
32 input += 2;
33
34 vacc0 += vt0;
35 vacc1 += vt1;
36 }
37 vacc0 += vacc1;
38
39 if XNN_UNLIKELY(batch != 0) {
40 const float vt = *input;
41 vacc0 += vt;
42 }
43 const float vscale = params->scalar.scale;
44 vacc0 *= vscale;
45 *output += vacc0;
46 }