Skip to content

Commit

Permalink
Support SVE runtime dispatcher in xsimd
Browse files Browse the repository at this point in the history
Change-Id: I2659ca90ae1fedd23ab0fba16882f5f31f36fb0e
Signed-off-by: Yuqi Gu <yuqi.gu@arm.com>
  • Loading branch information
guyuqi authored and serge-sans-paille committed Mar 22, 2023
1 parent 1a8c4df commit 5c15ff1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/xsimd/config/xsimd_cpuid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ namespace xsimd
unsigned avx512bw : 1;
unsigned neon : 1;
unsigned neon64 : 1;
unsigned sve : 1;

// version number of the best arch available
unsigned best;
Expand All @@ -75,6 +76,15 @@ namespace xsimd
neon64 = 0;
best = neon::version() * neon;

#elif defined(__ARM_FEATURE_SVE) && defined(__ARM_FEATURE_SVE_BITS) && __ARM_FEATURE_SVE_BITS > 0

#if defined(__linux__) && (!defined(__ANDROID_API__) || __ANDROID_API__ >= 18)
sve = bool(getauxval(AT_HWCAP) & HWCAP_SVE);
#else
sve = 0;
#endif
best = sve::version() * sve;

#elif defined(__x86_64__) || defined(__i386__) || defined(_M_AMD64) || defined(_M_IX86)
auto get_cpuid = [](int reg[4], int func_id) noexcept
{
Expand Down

0 comments on commit 5c15ff1

Please sign in to comment.