| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
#include <assert.h> |
| 11 |
#include <math.h> |
| 12 |
|
| 13 |
#include <riscv_vector.h> |
| 14 |
|
| 15 |
#include "xnnpack/common.h" |
| 16 |
#include "xnnpack/intrinsics-polyfill.h" |
| 17 |
#include "xnnpack/vunary.h" |
| 18 |
|
| 19 |
|
| 20 |
void xnn_f32_vsqrt_ukernel__rvv_sqrt_u2v( |
| 21 |
size_t batch, |
| 22 |
const float* input, |
| 23 |
float* output, |
| 24 |
const struct xnn_f32_default_params params[restrict XNN_MIN_ELEMENTS(1)]) |
| 25 |
{ |
| 26 |
assert(batch != 0); |
| 27 |
assert(batch % sizeof(float) == 0); |
| 28 |
assert(input != NULL); |
| 29 |
assert(output != NULL); |
| 30 |
|
| 31 |
batch >>= XNN_LOG2_SIZEOF_FLOAT; |
| 32 |
do { |
| 33 |
const size_t n = __riscv_vsetvl_e32m2(batch); |
| 34 |
vfloat32m2_t vx = __riscv_vle32_v_f32m2(input, n); |
| 35 |
input += n; |
| 36 |
vfloat32m2_t vacc = __riscv_vfsqrt_v_f32m2(vx, n); |
| 37 |
__riscv_vse32_v_f32m2(output, vacc, n); |
| 38 |
output += n; |
| 39 |
|
| 40 |
batch -= n; |
| 41 |
} while (batch != 0); |
| 42 |
} |