highway icon indicating copy to clipboard operation
highway copied to clipboard

Add HWY_ATTAINABLE_RISCV on RISCV

Open luyahan opened this issue 10 months ago • 2 comments

luyahan avatar Apr 26 '24 02:04 luyahan

Can you help me understand the goal here?

The intention of "attainable" is "whatever the compiler is able to compile, independent of compiler flags". I understand that this might not fully work yet for RVV without compiler flags. But the ultimate goal is to have this be HWY_RVV as it currently is.

Do you think we should disable HWY_HAVE_RUNTIME_DISPATCH again for RISC-V?

When I use foreach_targets.h to build code, it can't build target for RVV on RISC-V due to HWY_TARGETS doesn't been set HWY_RVV bit.

#define HWY_TARGETS \
  (HWY_ATTAINABLE_TARGETS & ((HWY_STATIC_TARGET - 1LL) | HWY_STATIC_TARGET))

And HWY_BASELINE_RVV been set only when defined(__riscv_v_intrinsic) && __riscv_v_intrinsic >= 11000

// RVV requires intrinsics 0.11 or later, see #1156.
#if HWY_ARCH_RISCV && defined(__riscv_v_intrinsic) && __riscv_v_intrinsic >= 11000
#define HWY_BASELINE_RVV HWY_RVV
#else
#define HWY_

luyahan avatar Apr 28 '24 07:04 luyahan

I think we're almost there. It is good you have added the

#elif HWY_ARCH_RVV
#define HWY_ATTAINABLE_TARGETS

I think now all that's required is to change #define HWY_ATTAINABLE_RISCV (HWY_BASELINE_RVV) to #define HWY_ATTAINABLE_RISCV (HWY_RVV).

jan-wassenberg avatar Apr 29 '24 08:04 jan-wassenberg