| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 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_u8v( |
| 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_e32m8(batch_); batch_ -= n; |
| 32 |
vfloat32m8_t in_f32v = __riscv_vle32_v_f32m8(input, n); input += n; |
| 33 |
vfloat32m8_t out_f32v = __riscv_vfmax_vf_f32m8(in_f32v, zero, n); |
| 34 |
__riscv_vse32_v_f32m8(output, out_f32v, n); output += n; |
| 35 |
} |
| 36 |
} |