Debian Codegraph @

src/f32-rsum/gen/f32-rsum-scalar-u4-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_u4_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 >= 4 * sizeof(float); batch -= 4 * sizeof(float)) {
30 const float vt0 = input[0];
31 const float vt1 = input[1];
32 const float vt2 = input[2];
33 const float vt3 = input[3];
34 input += 4;
35
36 vacc0 += vt0;
37 vacc1 += vt1;
38 vacc0 += vt2;
39 vacc1 += vt3;
40 }
41 vacc0 += vacc1;
42
43 if XNN_UNLIKELY(batch != 0) {
44 do {
45 const float vt = *input++;
46 vacc0 += vt;
47 batch -= sizeof(float);
48 } while (batch != 0);
49 }
50 const float vscale = params->scalar.scale;
51 vacc0 *= vscale;
52 *output += vacc0;
53 }