Debian Codegraph @

src/f32-rsum/gen/f32-rsum-scalar-u4-acc4.c

raw symbols SCIP
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_acc4(
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 float vacc2 = 0.0f;
30 float vacc3 = 0.0f;
31 for (; batch >= 4 * sizeof(float); batch -= 4 * sizeof(float)) {
32 const float vt0 = input[0];
33 const float vt1 = input[1];
34 const float vt2 = input[2];
35 const float vt3 = input[3];
36 input += 4;
37
38 vacc0 += vt0;
39 vacc1 += vt1;
40 vacc2 += vt2;
41 vacc3 += vt3;
42 }
43 vacc0 += vacc1;
44 vacc2 += vacc3;
45 vacc0 += vacc2;
46
47 if XNN_UNLIKELY(batch != 0) {
48 do {
49 const float vt = *input++;
50 vacc0 += vt;
51 batch -= sizeof(float);
52 } while (batch != 0);
53 }
54 const float vscale = params->scalar.scale;
55 vacc0 *= vscale;
56 *output += vacc0;
57 }