Skip to content

Commit

Permalink
Fix various problems with architecture version handling
Browse files Browse the repository at this point in the history
Some architectures were not registered in the `xsimd::all_architectures`
arch list.

The test for issorted was incorrect.

Some architectures add wrong version values but this went unnoticed
because of the invalid check.
  • Loading branch information
serge-sans-paille committed Dec 5, 2023
1 parent 27ec4ff commit a3ddd47
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
18 changes: 9 additions & 9 deletions include/xsimd/config/xsimd_arch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,22 @@ namespace xsimd
{
};

template <class... Archs>
template <unsigned... Vals>
struct is_sorted;

template <>
struct is_sorted<> : std::true_type
{
};

template <class Arch>
struct is_sorted<Arch> : std::true_type
template <unsigned Val>
struct is_sorted<Val> : std::true_type
{
};

template <class A0, class A1, class... Archs>
struct is_sorted<A0, A1, Archs...>
: std::conditional<(A0::version() >= A1::version()), is_sorted<Archs...>,
template <unsigned V0, unsigned V1, unsigned... Vals>
struct is_sorted<V0, V1, Vals...>
: std::conditional<(V0 >= V1), is_sorted<V1, Vals...>,
std::false_type>::type
{
};
Expand Down Expand Up @@ -111,7 +111,7 @@ namespace xsimd
struct arch_list
{
#ifndef NDEBUG
static_assert(detail::is_sorted<Archs...>::value,
static_assert(detail::is_sorted<Archs::version()...>::value,
"architecture list must be sorted by version");
#endif

Expand Down Expand Up @@ -190,13 +190,13 @@ namespace xsimd
struct unsupported
{
};
using all_x86_architectures = arch_list<avx512bw, avx512dq, avx512cd, avx512f, fma3<avx2>, avx2, fma3<avx>, avx, fma4, fma3<sse4_2>, sse4_2, sse4_1, /*sse4a,*/ ssse3, sse3, sse2>;
using all_x86_architectures = arch_list<avx512vnni, avx512vbmi, avx512ifma, avx512pf, avx512bw, avx512er, avx512dq, avx512cd, avx512f, fma3<avx2>, avx2, fma3<avx>, avx, fma4, fma3<sse4_2>, sse4_2, sse4_1, /*sse4a,*/ ssse3, sse3, sse2>;
using all_sve_architectures = arch_list<detail::sve<512>, detail::sve<256>, detail::sve<128>>;
using all_rvv_architectures = arch_list<detail::rvv<512>, detail::rvv<256>, detail::rvv<128>>;
using all_arm_architectures = typename detail::join<all_sve_architectures, arch_list<neon64, neon>>::type;
using all_riscv_architectures = all_rvv_architectures;
using all_wasm_architectures = arch_list<wasm>;
using all_architectures = typename detail::join<all_arm_architectures, all_x86_architectures, all_riscv_architectures, all_wasm_architectures>::type;
using all_architectures = typename detail::join<all_wasm_architectures, all_arm_architectures, all_x86_architectures, all_riscv_architectures>::type;

using supported_architectures = typename detail::supported<all_architectures>::type;

Expand Down
2 changes: 1 addition & 1 deletion include/xsimd/types/xsimd_avx512ifma_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace xsimd
{
static constexpr bool supported() noexcept { return XSIMD_WITH_AVX512IFMA; }
static constexpr bool available() noexcept { return true; }
static constexpr unsigned version() noexcept { return generic::version(3, 4, 0); }
static constexpr unsigned version() noexcept { return generic::version(3, 5, 0); }
static constexpr char const* name() noexcept { return "avx512ifma"; }
};

Expand Down
2 changes: 1 addition & 1 deletion include/xsimd/types/xsimd_avx512vbmi_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace xsimd
{
static constexpr bool supported() noexcept { return XSIMD_WITH_AVX512VBMI; }
static constexpr bool available() noexcept { return true; }
static constexpr unsigned version() noexcept { return generic::version(3, 5, 0); }
static constexpr unsigned version() noexcept { return generic::version(3, 6, 0); }
static constexpr char const* name() noexcept { return "avx512vbmi"; }
};

Expand Down
2 changes: 1 addition & 1 deletion include/xsimd/types/xsimd_avx512vnni_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace xsimd
{
static constexpr bool supported() noexcept { return XSIMD_WITH_AVX512VNNI; }
static constexpr bool available() noexcept { return true; }
static constexpr unsigned version() noexcept { return generic::version(3, 6, 0); }
static constexpr unsigned version() noexcept { return generic::version(3, 7, 0); }
static constexpr char const* name() noexcept { return "avx512vnni"; }
};

Expand Down
2 changes: 1 addition & 1 deletion include/xsimd/types/xsimd_sve_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace xsimd
static constexpr bool available() noexcept { return true; }
static constexpr bool requires_alignment() noexcept { return true; }
static constexpr std::size_t alignment() noexcept { return 16; }
static constexpr unsigned version() noexcept { return generic::version(9, 0, 0); }
static constexpr unsigned version() noexcept { return generic::version(9, Width/32, 0); }
static constexpr char const* name() noexcept { return "arm64+sve"; }
};
}
Expand Down

0 comments on commit a3ddd47

Please sign in to comment.