Skip to content

Commit

Permalink
Explicitly verify dependency between architectures (like sse3 implies…
Browse files Browse the repository at this point in the history
… sse2)

Also add CI to make sure the assumption we make are correct on all
architectures supported by GCC.

Fix #1070
  • Loading branch information
serge-sans-paille committed Jan 26, 2025
1 parent 4cd58ef commit 214a648
Show file tree
Hide file tree
Showing 25 changed files with 241 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/arch-consistency-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Arch consistency check
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt install g++
- name: Check architecture consistency
run: sh test/check_arch.sh
5 changes: 5 additions & 0 deletions include/xsimd/types/xsimd_avx2_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ namespace xsimd
};

#if XSIMD_WITH_AVX2

#if !XSIMD_WITH_AVX
#error "architecture inconsistency: avx2 requires avx"
#endif

namespace types
{
XSIMD_DECLARE_SIMD_REGISTER_ALIAS(avx2, avx);
Expand Down
4 changes: 4 additions & 0 deletions include/xsimd/types/xsimd_avx512bw_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ namespace xsimd

#if XSIMD_WITH_AVX512BW

#if !XSIMD_WITH_AVX512DQ
#error "architecture inconsistency: avx512bw requires avx512dq"
#endif

namespace types
{
template <class T>
Expand Down
4 changes: 4 additions & 0 deletions include/xsimd/types/xsimd_avx512cd_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ namespace xsimd

#if XSIMD_WITH_AVX512CD

#if !XSIMD_WITH_AVX512F
#error "architecture inconsistency: avx512bw requires avx512f"
#endif

namespace types
{
template <class T>
Expand Down
4 changes: 4 additions & 0 deletions include/xsimd/types/xsimd_avx512dq_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ namespace xsimd

#if XSIMD_WITH_AVX512DQ

#if !XSIMD_WITH_AVX512CD
#error "architecture inconsistency: avx512dq requires avx512cd"
#endif

namespace types
{
template <class T>
Expand Down
4 changes: 4 additions & 0 deletions include/xsimd/types/xsimd_avx512er_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ namespace xsimd

#if XSIMD_WITH_AVX512ER

#if !XSIMD_WITH_AVX512CD
#error "architecture inconsistency: avx512er requires avx512cd"
#endif

namespace types
{
template <class T>
Expand Down
4 changes: 4 additions & 0 deletions include/xsimd/types/xsimd_avx512f_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ namespace xsimd

#if XSIMD_WITH_AVX512F

#if !XSIMD_WITH_AVX2
#error "architecture inconsistency: avx512f requires avx2"
#endif

namespace types
{
template <class T>
Expand Down
4 changes: 4 additions & 0 deletions include/xsimd/types/xsimd_avx512ifma_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ namespace xsimd

#if XSIMD_WITH_AVX512IFMA

#if !XSIMD_WITH_AVX512BW
#error "architecture inconsistency: avx512ifma requires avx512bw"
#endif

namespace types
{
template <class T>
Expand Down
4 changes: 4 additions & 0 deletions include/xsimd/types/xsimd_avx512pf_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ namespace xsimd

#if XSIMD_WITH_AVX512PF

#if !XSIMD_WITH_AVX512ER
#error "architecture inconsistency: avx512pf requires avx512er"
#endif

namespace types
{
template <class T>
Expand Down
4 changes: 4 additions & 0 deletions include/xsimd/types/xsimd_avx512vbmi_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ namespace xsimd

#if XSIMD_WITH_AVX512VBMI

#if !XSIMD_WITH_AVX512IFMA
#error "architecture inconsistency: avx512vbmi requires avx512ifma"
#endif

namespace types
{
template <class T>
Expand Down
4 changes: 4 additions & 0 deletions include/xsimd/types/xsimd_avx512vnni_avx512bw_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ namespace xsimd

#if XSIMD_WITH_AVX512VNNI_AVX512BW

#if !XSIMD_WITH_AVX512BW
#error "architecture inconsistency: avx512vnni+avx512bw requires avx512bw"
#endif

namespace types
{
template <class T>
Expand Down
4 changes: 4 additions & 0 deletions include/xsimd/types/xsimd_avx512vnni_avx512vbmi_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ namespace xsimd

#if XSIMD_WITH_AVX512VNNI_AVX512VBMI

#if !XSIMD_WITH_AVX512VBMI
#error "architecture inconsistency: avx512vnni+avx512vbmi requires avx512vbmi"
#endif

namespace types
{
template <class T>
Expand Down
4 changes: 4 additions & 0 deletions include/xsimd/types/xsimd_avx_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ namespace xsimd

#if XSIMD_WITH_AVX

#if !XSIMD_WITH_SSE4_2
#error "architecture inconsistency: avx requires sse4.2"
#endif

#include <immintrin.h>

namespace xsimd
Expand Down
5 changes: 5 additions & 0 deletions include/xsimd/types/xsimd_avxvnni_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ namespace xsimd
};

#if XSIMD_WITH_AVXVNNI

#if !XSIMD_WITH_AVX2
#error "architecture inconsistency: avxvnni requires avx2"
#endif

namespace types
{
XSIMD_DECLARE_SIMD_REGISTER_ALIAS(avxvnni, avx2);
Expand Down
5 changes: 5 additions & 0 deletions include/xsimd/types/xsimd_fma3_avx2_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ namespace xsimd
};

#if XSIMD_WITH_FMA3_AVX2

#if !XSIMD_WITH_AVX2
#error "architecture inconsistency: fma3+avx2 requires avx2"
#endif

namespace types
{

Expand Down
5 changes: 5 additions & 0 deletions include/xsimd/types/xsimd_fma3_avx_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ namespace xsimd
};

#if XSIMD_WITH_FMA3_AVX

#if !XSIMD_WITH_AVX
#error "architecture inconsistency: fma3+avx requires avx"
#endif

namespace types
{

Expand Down
5 changes: 5 additions & 0 deletions include/xsimd/types/xsimd_fma3_sse_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ namespace xsimd
};

#if XSIMD_WITH_FMA3_SSE

#if !XSIMD_WITH_SSE4_2
#error "architecture inconsistency: fma3+sse4.2 requires sse4.2"
#endif

namespace types
{

Expand Down
5 changes: 5 additions & 0 deletions include/xsimd/types/xsimd_fma4_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ namespace xsimd
};

#if XSIMD_WITH_FMA4

#if !XSIMD_WITH_SSE4_2
#error "architecture inconsistency: fma4 requires sse4.2"
#endif

namespace types
{

Expand Down
5 changes: 5 additions & 0 deletions include/xsimd/types/xsimd_i8mm_neon64_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ namespace xsimd
};

#if XSIMD_WITH_I8MM_NEON64

#if !XSIMD_WITH_NEON64
#error "architecture inconsistency: i8mm+neon64 requires neon64"
#endif

namespace types
{

Expand Down
4 changes: 4 additions & 0 deletions include/xsimd/types/xsimd_neon64_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ namespace xsimd

#if XSIMD_WITH_NEON64

#if !XSIMD_WITH_NEON
#error "architecture inconsistency: neon64 requires neon"
#endif

namespace types
{
XSIMD_DECLARE_SIMD_REGISTER_ALIAS(neon64, neon);
Expand Down
5 changes: 5 additions & 0 deletions include/xsimd/types/xsimd_sse3_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ namespace xsimd
};

#if XSIMD_WITH_SSE3

#if !XSIMD_WITH_SSE2
#error "architecture inconsistency: sse3 requires sse2"
#endif

namespace types
{

Expand Down
5 changes: 5 additions & 0 deletions include/xsimd/types/xsimd_sse4_1_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ namespace xsimd
};

#if XSIMD_WITH_SSE4_1

#if !XSIMD_WITH_SSSE3
#error "architecture inconsistency: sse4.1 requires ssse3"
#endif

namespace types
{
XSIMD_DECLARE_SIMD_REGISTER_ALIAS(sse4_1, ssse3);
Expand Down
5 changes: 5 additions & 0 deletions include/xsimd/types/xsimd_sse4_2_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ namespace xsimd
};

#if XSIMD_WITH_SSE4_2

#if !XSIMD_WITH_SSE4_1
#error "architecture inconsistency: sse4.2 requires sse4.1"
#endif

namespace types
{
XSIMD_DECLARE_SIMD_REGISTER_ALIAS(sse4_2, sse4_1);
Expand Down
5 changes: 5 additions & 0 deletions include/xsimd/types/xsimd_ssse3_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ namespace xsimd
};

#if XSIMD_WITH_SSSE3

#if !XSIMD_WITH_SSE3
#error "architecture inconsistency: ssse3 requires sse3"
#endif

namespace types
{
XSIMD_DECLARE_SIMD_REGISTER_ALIAS(ssse3, sse3);
Expand Down
Loading

0 comments on commit 214a648

Please sign in to comment.