419 lines
14 KiB
Diff
419 lines
14 KiB
Diff
From da7ab060cbcf57a20adf1c7d5b013658183f8bc5 Mon Sep 17 00:00:00 2001
|
|
From: Johan Mabille <johan.mabille@gmail.com>
|
|
Date: Wed, 3 Jul 2019 17:09:58 +0200
|
|
Subject: [PATCH] Disabled most of the tests when no SIMD instruction set is
|
|
available
|
|
|
|
---
|
|
.travis.yml | 11 ++++++++++
|
|
.../xsimd/config/xsimd_instruction_set.hpp | 8 ++++---
|
|
include/xsimd/memory/xsimd_alignment.hpp | 2 +-
|
|
include/xsimd/memory/xsimd_load_store.hpp | 2 +-
|
|
include/xsimd/types/xsimd_types_include.hpp | 2 +-
|
|
test/xsimd_algorithms.cpp | 22 +++++++++++++------
|
|
test/xsimd_api_test.cpp | 2 +-
|
|
test/xsimd_basic_math_test.cpp | 5 ++++-
|
|
test/xsimd_error_gamma_test.cpp | 5 ++++-
|
|
test/xsimd_exponential_test.cpp | 5 ++++-
|
|
test/xsimd_fp_manipulation_test.cpp | 5 ++++-
|
|
test/xsimd_hyperbolic_test.cpp | 5 ++++-
|
|
test/xsimd_interface_test.cpp | 3 +++
|
|
test/xsimd_memory_test.cpp | 3 +++
|
|
test/xsimd_power_test.cpp | 5 ++++-
|
|
test/xsimd_rounding_test.cpp | 5 ++++-
|
|
test/xsimd_trigonometric_test.cpp | 5 ++++-
|
|
17 files changed, 73 insertions(+), 22 deletions(-)
|
|
|
|
diff --git a/.travis.yml b/.travis.yml
|
|
index d155b05..36bd25d 100644
|
|
--- a/.travis.yml
|
|
+++ b/.travis.yml
|
|
@@ -18,6 +18,14 @@ matrix:
|
|
packages:
|
|
- g++-5
|
|
env: COMPILER=gcc GCC=5
|
|
+ - os: linux
|
|
+ addons:
|
|
+ apt:
|
|
+ sources:
|
|
+ - ubuntu-toolchain-r-test
|
|
+ packages:
|
|
+ - g++-6
|
|
+ env: COMPILER=gcc GCC=6 FORCE_NO_INSTR_SET=1
|
|
- os: linux
|
|
addons:
|
|
apt:
|
|
@@ -175,6 +183,9 @@ install:
|
|
else
|
|
cmake . -DDOWNLOAD_GTEST=ON ;
|
|
fi
|
|
+ - if [[ "$FORCE_NO_INSTR_SET" == 1 ]] ; then
|
|
+ cmake . -DDOWNLOAD_GTEST=ON -DXSIMD_FORCE_X86_INSTR_SET=0 ;
|
|
+ fi
|
|
- make -j2 test_xsimd
|
|
- cd test
|
|
script:
|
|
diff --git a/include/xsimd/config/xsimd_instruction_set.hpp b/include/xsimd/config/xsimd_instruction_set.hpp
|
|
index ca0f1c1..627537b 100644
|
|
--- a/include/xsimd/config/xsimd_instruction_set.hpp
|
|
+++ b/include/xsimd/config/xsimd_instruction_set.hpp
|
|
@@ -138,7 +138,9 @@
|
|
* PPC INSTRUCTION SET *
|
|
***********************/
|
|
|
|
-#define XSIMD_PPC_VMX_VERSION XSIMD_VERSION_NUMBER(1, 0, 0)
|
|
+// We haven't implemented any support for PPC, so we should
|
|
+// not enable detection for this instructoin set
|
|
+/*#define XSIMD_PPC_VMX_VERSION XSIMD_VERSION_NUMBER(1, 0, 0)
|
|
#define XSIMD_PPC_VSX_VERSION XSIMD_VERSION_NUMBER(1, 1, 0)
|
|
#define XSIMD_PPC_QPX_VERSION XSIMD_VERSION_NUMBER(2, 0, 0)
|
|
|
|
@@ -161,7 +163,7 @@
|
|
#define XSIMD_PPC_INSTR_SET XSIMD_VERSION_NUMBER_NOT_AVAILABLE
|
|
#else
|
|
#define XSIMD_PPC_INSTR_SET_AVAILABLE XSIMD_VERSION_NUMBER_AVAILABLE
|
|
-#endif
|
|
+#endif*/
|
|
|
|
/***********************
|
|
* ARM INSTRUCTION SET *
|
|
@@ -224,7 +226,7 @@
|
|
|
|
#if !defined(XSIMD_INSTR_SET)
|
|
#define XSIMD_INSTR_SET XSIMD_VERSION_NUMBER_NOT_AVAILABLE
|
|
-#else
|
|
+#elif XSIMD_INSTR_SET != XSIMD_VERSION_NUMBER_NOT_AVAILABLE
|
|
#define XSIMD_INSTR_SET_AVAILABLE XSIMD_VERSION_NUMBER_AVAILABLE
|
|
#endif
|
|
|
|
diff --git a/include/xsimd/memory/xsimd_alignment.hpp b/include/xsimd/memory/xsimd_alignment.hpp
|
|
index bff50ea..301d72a 100644
|
|
--- a/include/xsimd/memory/xsimd_alignment.hpp
|
|
+++ b/include/xsimd/memory/xsimd_alignment.hpp
|
|
@@ -40,7 +40,7 @@ namespace xsimd
|
|
using type = unaligned_mode;
|
|
};
|
|
|
|
-#if defined(XSIMD_X86_INSTR_SET_AVAILABLE) || defined(XSIMD_ARM_INSTR_SET_AVAILABLE)
|
|
+#if defined(XSIMD_DEFAULT_ALIGNMENT)
|
|
template <class T>
|
|
struct allocator_alignment<aligned_allocator<T, XSIMD_DEFAULT_ALIGNMENT>>
|
|
{
|
|
diff --git a/include/xsimd/memory/xsimd_load_store.hpp b/include/xsimd/memory/xsimd_load_store.hpp
|
|
index b4b6773..45d5e33 100644
|
|
--- a/include/xsimd/memory/xsimd_load_store.hpp
|
|
+++ b/include/xsimd/memory/xsimd_load_store.hpp
|
|
@@ -598,7 +598,7 @@ namespace xsimd
|
|
{
|
|
}
|
|
|
|
-#if defined(XSIMD_X86_INSTR_SET_AVAILABLE)
|
|
+#if XSIMD_X86_INSTR_SET > XSIMD_INSTR_SET_NOT_AVAILABLE
|
|
|
|
template <>
|
|
inline void prefetch<int32_t>(const int32_t* address)
|
|
diff --git a/include/xsimd/types/xsimd_types_include.hpp b/include/xsimd/types/xsimd_types_include.hpp
|
|
index 39f0a2d..965320c 100644
|
|
--- a/include/xsimd/types/xsimd_types_include.hpp
|
|
+++ b/include/xsimd/types/xsimd_types_include.hpp
|
|
@@ -67,7 +67,7 @@
|
|
#include "xsimd_neon_complex.hpp"
|
|
#endif
|
|
|
|
-#if XSIMD_ARM_INSTR_SET == XSIMD_VERSION_NUMBER_NOT_AVAILABLE && XSIMD_X86_INSTR_SET == XSIMD_VERSION_NUMBER_NOT_AVAILABLE
|
|
+#if !defined(XSIMD_INSTR_SET_AVAILABLE)
|
|
#if defined(XSIMD_ENABLE_FALLBACK)
|
|
#warning "No SIMD instructions enabled, using fallback mode."
|
|
#else
|
|
diff --git a/test/xsimd_algorithms.cpp b/test/xsimd_algorithms.cpp
|
|
index 75f4e8c..07a4ff1 100644
|
|
--- a/test/xsimd_algorithms.cpp
|
|
+++ b/test/xsimd_algorithms.cpp
|
|
@@ -32,12 +32,20 @@ struct unary_functor
|
|
}
|
|
};
|
|
|
|
+#ifdef XSIMD_DEFAULT_ALIGNMENT
|
|
+template <class T>
|
|
+using test_allocator_type = xsimd::aligned_allocator<T, XSIMD_DEFAULT_ALIGNMENT>;
|
|
+#else
|
|
+template <class T>
|
|
+using test_allocator_type = std::allocator<T>;
|
|
+#endif
|
|
+
|
|
TEST(xsimd, binary_transform)
|
|
{
|
|
std::vector<double> expected(93);
|
|
|
|
std::vector<double> a(93, 123), b(93, 123), c(93);
|
|
- std::vector<double, xsimd::aligned_allocator<double, XSIMD_DEFAULT_ALIGNMENT>> aa(93, 123), ba(93, 123), ca(93);
|
|
+ std::vector<double, test_allocator_type<double>> aa(93, 123), ba(93, 123), ca(93);
|
|
|
|
std::transform(a.begin(), a.end(), b.begin(), expected.begin(),
|
|
binary_functor{});
|
|
@@ -83,7 +91,7 @@ TEST(xsimd, unary_transform)
|
|
{
|
|
std::vector<double> expected(93);
|
|
std::vector<double> a(93, 123), c(93);
|
|
- std::vector<double, xsimd::aligned_allocator<double, XSIMD_DEFAULT_ALIGNMENT>> aa(93, 123), ca(93);
|
|
+ std::vector<double, test_allocator_type<double>> aa(93, 123), ca(93);
|
|
|
|
std::transform(a.begin(), a.end(), expected.begin(),
|
|
unary_functor{});
|
|
@@ -112,7 +120,7 @@ TEST(xsimd, unary_transform)
|
|
class xsimd_reduce : public ::testing::Test
|
|
{
|
|
public:
|
|
- using aligned_vec_t = std::vector<double, xsimd::aligned_allocator<double, XSIMD_DEFAULT_ALIGNMENT>>;
|
|
+ using aligned_vec_t = std::vector<double, test_allocator_type<double>>;
|
|
|
|
static constexpr std::size_t num_elements = 4 * xsimd::simd_traits<double>::size;
|
|
static constexpr std::size_t small_num = xsimd::simd_traits<double>::size - 1;
|
|
@@ -211,11 +219,10 @@ TEST_F(xsimd_reduce, using_custom_binary_function)
|
|
}
|
|
}
|
|
|
|
+#if XSIMD_X86_INSTR_SET > XSIMD_VERSION_NUMBER_NOT_AVAILABLE || XSIMD_ARM_INSTR_SET > XSIMD_VERSION_NUMBER_NOT_AVAILABLE
|
|
TEST(xsimd, iterator)
|
|
{
|
|
- std::vector<float, xsimd::aligned_allocator<float, XSIMD_DEFAULT_ALIGNMENT>> a(10 * 16, 0.2);
|
|
- std::vector<float, xsimd::aligned_allocator<float, XSIMD_DEFAULT_ALIGNMENT>> b(1000, 2.);
|
|
- std::vector<float, xsimd::aligned_allocator<float, XSIMD_DEFAULT_ALIGNMENT>> c(1000, 3.);
|
|
+ std::vector<float, test_allocator_type<float>> a(10 * 16, 0.2), b(1000, 2.), c(1000, 3.);
|
|
|
|
std::iota(a.begin(), a.end(), 0.f);
|
|
std::vector<float> a_cpy(a.begin(), a.end());
|
|
@@ -245,7 +252,7 @@ TEST(xsimd, iterator)
|
|
}
|
|
|
|
#ifdef XSIMD_BATCH_DOUBLE_SIZE
|
|
- std::vector<std::complex<double>, xsimd::aligned_allocator<std::complex<double>, XSIMD_DEFAULT_ALIGNMENT>> ca(10 * 16, std::complex<double>(0.2));
|
|
+ std::vector<std::complex<double>, test_allocator_type<std::complex<double>>> ca(10 * 16, std::complex<double>(0.2));
|
|
using cbatch_type = typename xsimd::simd_traits<std::complex<double>>::type;
|
|
auto cbegin = xsimd::aligned_iterator<cbatch_type>(&ca[0]);
|
|
auto cend = xsimd::aligned_iterator<cbatch_type>(&ca[0] + a.size());
|
|
@@ -262,3 +269,4 @@ TEST(xsimd, iterator)
|
|
#endif
|
|
|
|
}
|
|
+#endif
|
|
diff --git a/test/xsimd_api_test.cpp b/test/xsimd_api_test.cpp
|
|
index 74fbcbb..f224214 100644
|
|
--- a/test/xsimd_api_test.cpp
|
|
+++ b/test/xsimd_api_test.cpp
|
|
@@ -36,7 +36,7 @@ namespace xsimd
|
|
}
|
|
}
|
|
|
|
-#if XSIMD_X86_INSTR_SET_AVAILABLE > XSIMD_VERSION_NUMBER_NOT_AVAILABLE
|
|
+#if XSIMD_X86_INSTR_SET > XSIMD_VERSION_NUMBER_NOT_AVAILABLE
|
|
TEST(xsimd, complex_return_type)
|
|
{
|
|
using cf_type = std::complex<float>;
|
|
diff --git a/test/xsimd_basic_math_test.cpp b/test/xsimd_basic_math_test.cpp
|
|
index cd62bc0..b192f1b 100644
|
|
--- a/test/xsimd_basic_math_test.cpp
|
|
+++ b/test/xsimd_basic_math_test.cpp
|
|
@@ -11,6 +11,8 @@
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
+#ifdef XSIMD_INSTR_SET_AVAILABLE
|
|
+
|
|
#include "xsimd/math/xsimd_basic_math.hpp"
|
|
#include "xsimd/memory/xsimd_aligned_allocator.hpp"
|
|
#include "xsimd/types/xsimd_types_include.hpp"
|
|
@@ -105,4 +107,5 @@ TEST(xsimd, fallback_double_basic_math)
|
|
bool res = xsimd::test_basic_math<double, 3, 32>(out, "fallback double");
|
|
EXPECT_TRUE(res);
|
|
}
|
|
-#endif
|
|
\ No newline at end of file
|
|
+#endif
|
|
+#endif // XSIMD_INSTR_SET_AVAILABLE
|
|
diff --git a/test/xsimd_error_gamma_test.cpp b/test/xsimd_error_gamma_test.cpp
|
|
index 8241ef3..c70904b 100644
|
|
--- a/test/xsimd_error_gamma_test.cpp
|
|
+++ b/test/xsimd_error_gamma_test.cpp
|
|
@@ -11,6 +11,8 @@
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
+#ifdef XSIMD_INSTR_SET_AVAILABLE
|
|
+
|
|
#include "xsimd/math/xsimd_error.hpp"
|
|
#include "xsimd/math/xsimd_gamma.hpp"
|
|
#include "xsimd/memory/xsimd_aligned_allocator.hpp"
|
|
@@ -106,4 +108,5 @@ TEST(xsimd, fallback_double_error_gamma)
|
|
bool res = xsimd::test_error_gamma<double, 3, 32>(out, "fallback double");
|
|
EXPECT_TRUE(res);
|
|
}
|
|
-#endif
|
|
\ No newline at end of file
|
|
+#endif
|
|
+#endif // XSIMD_INSTR_SET_AVAILABLE
|
|
diff --git a/test/xsimd_exponential_test.cpp b/test/xsimd_exponential_test.cpp
|
|
index 7a6f4b3..43ec983 100644
|
|
--- a/test/xsimd_exponential_test.cpp
|
|
+++ b/test/xsimd_exponential_test.cpp
|
|
@@ -11,6 +11,8 @@
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
+#ifdef XSIMD_INSTR_SET_AVAILABLE
|
|
+
|
|
#include "xsimd/math/xsimd_exponential.hpp"
|
|
#include "xsimd/math/xsimd_logarithm.hpp"
|
|
#include "xsimd/memory/xsimd_aligned_allocator.hpp"
|
|
@@ -106,4 +108,5 @@ TEST(xsimd, fallback_double_exponential)
|
|
bool res = xsimd::test_exponential<double, 3, 32>(out, "fallback double");
|
|
EXPECT_TRUE(res);
|
|
}
|
|
-#endif
|
|
\ No newline at end of file
|
|
+#endif
|
|
+#endif // XSIMD_INSTR_SET_AVAILABLE
|
|
diff --git a/test/xsimd_fp_manipulation_test.cpp b/test/xsimd_fp_manipulation_test.cpp
|
|
index c2d7f67..d19ed3e 100644
|
|
--- a/test/xsimd_fp_manipulation_test.cpp
|
|
+++ b/test/xsimd_fp_manipulation_test.cpp
|
|
@@ -11,6 +11,8 @@
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
+#ifdef XSIMD_INSTR_SET_AVAILABLE
|
|
+
|
|
#include "xsimd/math/xsimd_fp_manipulation.hpp"
|
|
#include "xsimd/memory/xsimd_aligned_allocator.hpp"
|
|
#include "xsimd/types/xsimd_types_include.hpp"
|
|
@@ -105,4 +107,5 @@ TEST(xsimd, fallback_double_fp_manipulation)
|
|
bool res = xsimd::test_fp_manipulation<double, 3, 32>(out, "fallback double");
|
|
EXPECT_TRUE(res);
|
|
}
|
|
-#endif
|
|
\ No newline at end of file
|
|
+#endif
|
|
+#endif // XSIMD_INSTR_SET_AVAILABLE
|
|
diff --git a/test/xsimd_hyperbolic_test.cpp b/test/xsimd_hyperbolic_test.cpp
|
|
index 23f2506..9a76ec4 100644
|
|
--- a/test/xsimd_hyperbolic_test.cpp
|
|
+++ b/test/xsimd_hyperbolic_test.cpp
|
|
@@ -11,6 +11,8 @@
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
+#ifdef XSIMD_INSTR_SET_AVAILABLE
|
|
+
|
|
#include "xsimd/math/xsimd_hyperbolic.hpp"
|
|
#include "xsimd/memory/xsimd_aligned_allocator.hpp"
|
|
#include "xsimd/types/xsimd_types_include.hpp"
|
|
@@ -105,4 +107,5 @@ TEST(xsimd, fallback_double_hyperbolic)
|
|
bool res = xsimd::test_hyperbolic<double, 3, 32>(out, "fallback double");
|
|
EXPECT_TRUE(res);
|
|
}
|
|
-#endif
|
|
\ No newline at end of file
|
|
+#endif
|
|
+#endif // XSIMD_INSTR_SET_AVAILABLE
|
|
diff --git a/test/xsimd_interface_test.cpp b/test/xsimd_interface_test.cpp
|
|
index ebbfe44..976b04a 100644
|
|
--- a/test/xsimd_interface_test.cpp
|
|
+++ b/test/xsimd_interface_test.cpp
|
|
@@ -12,6 +12,8 @@
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
+#ifdef XSIMD_INSTR_SET_AVAILABLE
|
|
+
|
|
#include "xsimd/xsimd.hpp"
|
|
|
|
namespace xsimd
|
|
@@ -109,3 +111,4 @@ namespace xsimd
|
|
EXPECT_EQ(t.ivec, t.ires);
|
|
}
|
|
}
|
|
+#endif // XSIMD_INSTR_SET_AVAILABLE
|
|
diff --git a/test/xsimd_memory_test.cpp b/test/xsimd_memory_test.cpp
|
|
index 754c5ec..1e48762 100644
|
|
--- a/test/xsimd_memory_test.cpp
|
|
+++ b/test/xsimd_memory_test.cpp
|
|
@@ -11,6 +11,8 @@
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
+#ifdef XSIMD_INSTR_SET_AVAILABLE
|
|
+
|
|
#include "xsimd/memory/xsimd_alignment.hpp"
|
|
|
|
namespace xsimd
|
|
@@ -31,3 +33,4 @@ namespace xsimd
|
|
EXPECT_TRUE((std::is_same<mock_align, unaligned_mode>::value));
|
|
}
|
|
}
|
|
+#endif // XSIMD_INSTR_SET_AVAILABLE
|
|
diff --git a/test/xsimd_power_test.cpp b/test/xsimd_power_test.cpp
|
|
index 99475c6..3b6376a 100644
|
|
--- a/test/xsimd_power_test.cpp
|
|
+++ b/test/xsimd_power_test.cpp
|
|
@@ -11,6 +11,8 @@
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
+#ifdef XSIMD_INSTR_SET_AVAILABLE
|
|
+
|
|
#include "xsimd/math/xsimd_power.hpp"
|
|
#include "xsimd/memory/xsimd_aligned_allocator.hpp"
|
|
#include "xsimd/types/xsimd_types_include.hpp"
|
|
@@ -105,4 +107,5 @@ TEST(xsimd, fallback_double_power)
|
|
bool res = xsimd::test_power<double, 3, 32>(out, "fallback double");
|
|
EXPECT_TRUE(res);
|
|
}
|
|
-#endif
|
|
\ No newline at end of file
|
|
+#endif
|
|
+#endif // XSIMD_INSTR_SET_AVAILABLE
|
|
diff --git a/test/xsimd_rounding_test.cpp b/test/xsimd_rounding_test.cpp
|
|
index 420ca3a..7fca3e4 100644
|
|
--- a/test/xsimd_rounding_test.cpp
|
|
+++ b/test/xsimd_rounding_test.cpp
|
|
@@ -11,6 +11,8 @@
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
+#ifdef XSIMD_INSTR_SET_AVAILABLE
|
|
+
|
|
#include "xsimd/math/xsimd_rounding.hpp"
|
|
#include "xsimd/memory/xsimd_aligned_allocator.hpp"
|
|
#include "xsimd/types/xsimd_types_include.hpp"
|
|
@@ -105,4 +107,5 @@ TEST(xsimd, fallback_double_rounding)
|
|
bool res = xsimd::test_rounding<double, 3, 32>(out, "fallback double");
|
|
EXPECT_TRUE(res);
|
|
}
|
|
-#endif
|
|
\ No newline at end of file
|
|
+#endif
|
|
+#endif // XSIMD_INSTR_SET_AVAILABLE
|
|
diff --git a/test/xsimd_trigonometric_test.cpp b/test/xsimd_trigonometric_test.cpp
|
|
index 2fba7f9..9998711 100644
|
|
--- a/test/xsimd_trigonometric_test.cpp
|
|
+++ b/test/xsimd_trigonometric_test.cpp
|
|
@@ -11,6 +11,8 @@
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
+#ifdef XSIMD_INSTR_SET_AVAILABLE
|
|
+
|
|
#include "xsimd/math/xsimd_trigonometric.hpp"
|
|
#include "xsimd/memory/xsimd_aligned_allocator.hpp"
|
|
#include "xsimd/types/xsimd_types_include.hpp"
|
|
@@ -105,4 +107,5 @@ TEST(xsimd, fallback_double_trigonometric)
|
|
bool res = xsimd::test_trigonometric<double, 3, 32>(out, "fallback double");
|
|
EXPECT_TRUE(res);
|
|
}
|
|
-#endif
|
|
\ No newline at end of file
|
|
+#endif
|
|
+#endif // XSIMD_INSTR_SET_AVAILABLE
|
|
--
|
|
2.21.0
|
|
|