Skip to content

Commit

Permalink
Experimental support for RVV runtime dispatch in clang19, refs llvm/l…
Browse files Browse the repository at this point in the history
…lvm-project#56592

PiperOrigin-RevId: 660355333
  • Loading branch information
jan-wassenberg authored and copybara-github committed Aug 7, 2024
1 parent 5975f5e commit 4bdbd65
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 2 additions & 3 deletions hwy/detect_targets.h
Original file line number Diff line number Diff line change
Expand Up @@ -605,12 +605,11 @@
#endif // HWY_HAVE_AUXV

#ifndef HWY_HAVE_RUNTIME_DISPATCH_RVV // allow override
// The riscv_vector.h in (at least) Clang 16-18 requires compiler flags, see
// The riscv_vector.h in Clang 16-18 requires compiler flags, see
// https://github.com/llvm/llvm-project/issues/56592. GCC 13.3 also has an
// #error check, whereas 14.1 fails with "argument type 'vuint16m8_t' requires
// the V ISA extension": https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115325.
// Hence disable runtime dispatch for now.
#if HWY_ARCH_RISCV && 0
#if HWY_ARCH_RISCV && HWY_COMPILER_CLANG >= 1900
#define HWY_HAVE_RUNTIME_DISPATCH_RVV 1
#else
#define HWY_HAVE_RUNTIME_DISPATCH_RVV 0
Expand Down
6 changes: 5 additions & 1 deletion hwy/ops/set_macros-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -629,8 +629,12 @@

#define HWY_NAMESPACE N_RVV

#if HWY_COMPILER_CLANG >= 1900
// https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc#181-zvl-minimum-vector-length-standard-extensions
#define HWY_TARGET_STR "Zvl128b,Zve64d"
#else
// HWY_TARGET_STR remains undefined so HWY_ATTR is a no-op.
// (rv64gcv is not a valid target)
#endif

//-----------------------------------------------------------------------------
// EMU128
Expand Down

0 comments on commit 4bdbd65

Please sign in to comment.