Debian Codegraph @

src/f32-vrelu/gen/f32-vrelu-rvv-u1v.c

raw symbols SCIP
1 // Auto-generated file. Do not edit!
2 // Template: src/f32-vrelu/rvv.c.in
3 // Generator: tools/xngen
4 //
5 // Copyright 2024 Imagination Technologies, inc.
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/vunary.h"
13 #include "xnnpack/common.h"
14 #include <riscv_vector.h>
15
16 void xnn_f32_vrelu_ukernel__rvv_u1v(
17 size_t batch,
18 const float* input,
19 float* output,
20 const struct xnn_f32_relu_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 zero = 0.0f;
28 size_t batch_ = batch >> XNN_LOG2_SIZEOF_FLOAT;
29
30 for (; batch_ > 0; ) {
31 size_t n = __riscv_vsetvl_e32m1(batch_); batch_ -= n;
32 vfloat32m1_t in_f32v = __riscv_vle32_v_f32m1(input, n); input += n;
33 vfloat32m1_t out_f32v = __riscv_vfmax_vf_f32m1(in_f32v, zero, n);
34 __riscv_vse32_v_f32m1(output, out_f32v, n); output += n;
35 }
36 }