Skip to content

Commit

Permalink
Enable S8/U8_VCLAMP microkernels for RISC-V
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 688619523
  • Loading branch information
fbarchard authored and xnnpack-bot committed Oct 22, 2024
1 parent e9975bc commit 31205d0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cmake/gen/rvv_microkernels.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ SET(PROD_RVV_MICROKERNEL_SRCS
src/qu8-vlrelu/gen/qu8-vlrelu-rvv-u2v.c
src/qu8-vmul/gen/qu8-vmul-minmax-f32-rvv-u2v.c
src/qu8-vmulc/gen/qu8-vmulc-minmax-f32-rvv-u2v.c
src/s8-vclamp/gen/s8-vclamp-rvv-u4v.c
src/u8-vclamp/gen/u8-vclamp-rvv-u4v.c
src/x32-packw/gen/x32-packw-x4v-gemm-goi-rvv-u8.c
src/x32-transposec/gen/x32-transposec-4x4-rvv.c
src/x32-transposec/gen/x32-transposec-8x8-rvv.c
Expand Down Expand Up @@ -192,11 +194,9 @@ SET(NON_PROD_RVV_MICROKERNEL_SRCS
src/qu8-vmulc/gen/qu8-vmulc-minmax-f32-rvv-u1v.c
src/s8-vclamp/gen/s8-vclamp-rvv-u1v.c
src/s8-vclamp/gen/s8-vclamp-rvv-u2v.c
src/s8-vclamp/gen/s8-vclamp-rvv-u4v.c
src/s8-vclamp/gen/s8-vclamp-rvv-u8v.c
src/u8-vclamp/gen/u8-vclamp-rvv-u1v.c
src/u8-vclamp/gen/u8-vclamp-rvv-u2v.c
src/u8-vclamp/gen/u8-vclamp-rvv-u4v.c
src/u8-vclamp/gen/u8-vclamp-rvv-u8v.c
src/x32-packw/gen/x32-packw-x1v-gemm-goi-rvv-u2.c
src/x32-packw/gen/x32-packw-x1v-gemm-goi-rvv-u4.c
Expand Down
4 changes: 2 additions & 2 deletions gen/rvv_microkernels.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ PROD_RVV_MICROKERNEL_SRCS = [
"src/qu8-vlrelu/gen/qu8-vlrelu-rvv-u2v.c",
"src/qu8-vmul/gen/qu8-vmul-minmax-f32-rvv-u2v.c",
"src/qu8-vmulc/gen/qu8-vmulc-minmax-f32-rvv-u2v.c",
"src/s8-vclamp/gen/s8-vclamp-rvv-u4v.c",
"src/u8-vclamp/gen/u8-vclamp-rvv-u4v.c",
"src/x32-packw/gen/x32-packw-x4v-gemm-goi-rvv-u8.c",
"src/x32-transposec/gen/x32-transposec-4x4-rvv.c",
"src/x32-transposec/gen/x32-transposec-8x8-rvv.c",
Expand Down Expand Up @@ -189,11 +191,9 @@ NON_PROD_RVV_MICROKERNEL_SRCS = [
"src/qu8-vmulc/gen/qu8-vmulc-minmax-f32-rvv-u1v.c",
"src/s8-vclamp/gen/s8-vclamp-rvv-u1v.c",
"src/s8-vclamp/gen/s8-vclamp-rvv-u2v.c",
"src/s8-vclamp/gen/s8-vclamp-rvv-u4v.c",
"src/s8-vclamp/gen/s8-vclamp-rvv-u8v.c",
"src/u8-vclamp/gen/u8-vclamp-rvv-u1v.c",
"src/u8-vclamp/gen/u8-vclamp-rvv-u2v.c",
"src/u8-vclamp/gen/u8-vclamp-rvv-u4v.c",
"src/u8-vclamp/gen/u8-vclamp-rvv-u8v.c",
"src/x32-packw/gen/x32-packw-x1v-gemm-goi-rvv-u2.c",
"src/x32-packw/gen/x32-packw-x1v-gemm-goi-rvv-u4.c",
Expand Down
7 changes: 7 additions & 0 deletions src/configs/unary-elementwise-config.c
Original file line number Diff line number Diff line change
Expand Up @@ -1979,6 +1979,10 @@ static void init_s8_clamp_config(void) {
#elif XNN_ARCH_ARM64
s8_clamp_config.ukernel = (xnn_vunary_ukernel_fn) xnn_s8_vclamp_ukernel__neon_u64;
s8_clamp_config.init.s8_minmax = xnn_init_s8_minmax_scalar_params;

#elif XNN_ARCH_RISCV && XNN_ENABLE_RISCV_VECTOR
s8_clamp_config.ukernel = (xnn_vunary_ukernel_fn) xnn_s8_vclamp_ukernel__rvv_u4v;
s8_clamp_config.init.s8_minmax = xnn_init_s8_minmax_scalar_params;
#elif XNN_ARCH_X86 || XNN_ARCH_X86_64
const struct xnn_hardware_config* hardware_config = xnn_init_hardware_config();
assert(hardware_config != NULL);
Expand Down Expand Up @@ -2021,6 +2025,9 @@ static void init_u8_clamp_config(void) {
#elif XNN_ARCH_ARM64
u8_clamp_config.ukernel = (xnn_vunary_ukernel_fn) xnn_u8_vclamp_ukernel__neon_u64;
u8_clamp_config.init.u8_minmax = xnn_init_u8_minmax_scalar_params;
#elif XNN_ARCH_RISCV && XNN_ENABLE_RISCV_VECTOR
u8_clamp_config.ukernel = (xnn_vunary_ukernel_fn) xnn_u8_vclamp_ukernel__rvv_u4v;
u8_clamp_config.init.u8_minmax = xnn_init_u8_minmax_scalar_params;
#elif XNN_ARCH_X86 || XNN_ARCH_X86_64
const struct xnn_hardware_config* hardware_config = xnn_init_hardware_config();
assert(hardware_config != NULL);
Expand Down

0 comments on commit 31205d0

Please sign in to comment.