Skip to content

Commit 2d7ef25

Browse files
Fix various problems with architecture version handling
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.
1 parent 27ec4ff commit 2d7ef25

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

include/xsimd/config/xsimd_arch.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,22 @@ namespace xsimd
5757
{
5858
};
5959

60-
template <class... Archs>
60+
template <unsigned... Vals>
6161
struct is_sorted;
6262

6363
template <>
6464
struct is_sorted<> : std::true_type
6565
{
6666
};
6767

68-
template <class Arch>
69-
struct is_sorted<Arch> : std::true_type
68+
template <unsigned Val>
69+
struct is_sorted<Val> : std::true_type
7070
{
7171
};
7272

73-
template <class A0, class A1, class... Archs>
74-
struct is_sorted<A0, A1, Archs...>
75-
: std::conditional<(A0::version() >= A1::version()), is_sorted<Archs...>,
73+
template <unsigned V0, unsigned V1, unsigned... Vals>
74+
struct is_sorted<V0, V1, Vals...>
75+
: std::conditional<(V0 >= V1), is_sorted<V1, Vals...>,
7676
std::false_type>::type
7777
{
7878
};
@@ -111,7 +111,7 @@ namespace xsimd
111111
struct arch_list
112112
{
113113
#ifndef NDEBUG
114-
static_assert(detail::is_sorted<Archs...>::value,
114+
static_assert(detail::is_sorted<Archs::version()...>::value,
115115
"architecture list must be sorted by version");
116116
#endif
117117

@@ -190,13 +190,13 @@ namespace xsimd
190190
struct unsupported
191191
{
192192
};
193-
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>;
193+
using all_x86_architectures = arch_list<avx512vnni, avx512vbmi, avx512ifma, avx512pf, avx512bw, avx512er, avx512dq, avx512cd, avx512f, avxvnni, fma3<avx2>, avx2, fma3<avx>, avx, fma4, fma3<sse4_2>, sse4_2, sse4_1, /*sse4a,*/ ssse3, sse3, sse2>;
194194
using all_sve_architectures = arch_list<detail::sve<512>, detail::sve<256>, detail::sve<128>>;
195195
using all_rvv_architectures = arch_list<detail::rvv<512>, detail::rvv<256>, detail::rvv<128>>;
196196
using all_arm_architectures = typename detail::join<all_sve_architectures, arch_list<neon64, neon>>::type;
197197
using all_riscv_architectures = all_rvv_architectures;
198198
using all_wasm_architectures = arch_list<wasm>;
199-
using all_architectures = typename detail::join<all_arm_architectures, all_x86_architectures, all_riscv_architectures, all_wasm_architectures>::type;
199+
using all_architectures = typename detail::join<all_riscv_architectures, all_wasm_architectures, all_arm_architectures, all_x86_architectures>::type;
200200

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

include/xsimd/types/xsimd_avx512ifma_register.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace xsimd
2626
{
2727
static constexpr bool supported() noexcept { return XSIMD_WITH_AVX512IFMA; }
2828
static constexpr bool available() noexcept { return true; }
29-
static constexpr unsigned version() noexcept { return generic::version(3, 4, 0); }
29+
static constexpr unsigned version() noexcept { return generic::version(3, 5, 0); }
3030
static constexpr char const* name() noexcept { return "avx512ifma"; }
3131
};
3232

include/xsimd/types/xsimd_avx512vbmi_register.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace xsimd
2626
{
2727
static constexpr bool supported() noexcept { return XSIMD_WITH_AVX512VBMI; }
2828
static constexpr bool available() noexcept { return true; }
29-
static constexpr unsigned version() noexcept { return generic::version(3, 5, 0); }
29+
static constexpr unsigned version() noexcept { return generic::version(3, 6, 0); }
3030
static constexpr char const* name() noexcept { return "avx512vbmi"; }
3131
};
3232

include/xsimd/types/xsimd_avx512vnni_register.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace xsimd
2626
{
2727
static constexpr bool supported() noexcept { return XSIMD_WITH_AVX512VNNI; }
2828
static constexpr bool available() noexcept { return true; }
29-
static constexpr unsigned version() noexcept { return generic::version(3, 6, 0); }
29+
static constexpr unsigned version() noexcept { return generic::version(3, 7, 0); }
3030
static constexpr char const* name() noexcept { return "avx512vnni"; }
3131
};
3232

include/xsimd/types/xsimd_sve_register.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace xsimd
3636
static constexpr bool available() noexcept { return true; }
3737
static constexpr bool requires_alignment() noexcept { return true; }
3838
static constexpr std::size_t alignment() noexcept { return 16; }
39-
static constexpr unsigned version() noexcept { return generic::version(9, 0, 0); }
39+
static constexpr unsigned version() noexcept { return generic::version(9, Width / 32, 0); }
4040
static constexpr char const* name() noexcept { return "arm64+sve"; }
4141
};
4242
}

0 commit comments

Comments
 (0)