xsimd: Fix exp10 darwin build error

Disable tests that fail on Darwin, as also reported upstream.
This commit is contained in:
Doron Behar 2023-07-30 18:47:52 +03:00
parent 8bd2ba2f43
commit 88b2797038
3 changed files with 92 additions and 0 deletions

View file

@ -14,6 +14,18 @@ stdenv.mkDerivation rec {
rev = version;
sha256 = "sha256-l6IRzndjb95hIcFCCm8zmlNHWtKduqy2t/oml/9Xp+w=";
};
patches = [
# Ideally, Accelerate/Accelerate.h should be used for this implementation,
# but it doesn't work... Needs a Darwin user to debug this. We apply this
# patch unconditionally, because the #if macros make sure it doesn't
# interfer with the Linux implementations.
./fix-darwin-exp10-implementation.patch
] ++ lib.optionals stdenv.isDarwin [
# Upstream reports:
# https://github.com/xtensor-stack/xsimd/issues/807
# https://github.com/xtensor-stack/xsimd/issues/917
./disable-darwin-failing-tests.patch
];
nativeBuildInputs = [
cmake

View file

@ -0,0 +1,58 @@
diff --git i/test/test_error_gamma.cpp w/test/test_error_gamma.cpp
index 214cbb5..299e5b8 100644
--- i/test/test_error_gamma.cpp
+++ w/test/test_error_gamma.cpp
@@ -131,25 +131,6 @@ struct error_gamma_test
INFO("lgamma");
CHECK_EQ(diff, 0);
}
-#if !(XSIMD_WITH_AVX && !XSIMD_WITH_AVX2)
-
- // tgamma (negative input)
- {
- std::transform(gamma_neg_input.cbegin(), gamma_neg_input.cend(), expected.begin(),
- [](const value_type& v)
- { return std::lgamma(v); });
- batch_type in, out;
- for (size_t i = 0; i < nb_input; i += size)
- {
- detail::load_batch(in, gamma_neg_input, i);
- out = lgamma(in);
- detail::store_batch(out, res, i);
- }
- size_t diff = detail::get_nb_diff(res, expected);
- INFO("lgamma (negative input)");
- CHECK_EQ(diff, 0);
- }
-#endif
}
};
diff --git i/test/test_xsimd_api.cpp w/test/test_xsimd_api.cpp
index 84b4b0b..1b29742 100644
--- i/test/test_xsimd_api.cpp
+++ w/test/test_xsimd_api.cpp
@@ -515,11 +515,6 @@ struct xsimd_api_float_types_functions
value_type val(2);
CHECK_EQ(extract(xsimd::exp(T(val))), std::exp(val));
}
- void test_exp10()
- {
- value_type val(2);
- CHECK_EQ(extract(xsimd::exp10(T(val))), std::pow(value_type(10), val));
- }
void test_exp2()
{
value_type val(2);
@@ -804,11 +799,6 @@ TEST_CASE_TEMPLATE("[xsimd api | float types functions]", B, FLOAT_TYPES)
Test.test_exp();
}
- SUBCASE("exp10")
- {
- Test.test_exp10();
- }
-
SUBCASE("exp2")
{
Test.test_exp2();

View file

@ -0,0 +1,22 @@
diff --git i/include/xsimd/arch/xsimd_scalar.hpp w/include/xsimd/arch/xsimd_scalar.hpp
index 9066da6..7aa3b6b 100644
--- i/include/xsimd/arch/xsimd_scalar.hpp
+++ w/include/xsimd/arch/xsimd_scalar.hpp
@@ -502,16 +502,7 @@ namespace xsimd
return !(x0 == x1);
}
-#if defined(__APPLE__)
- inline float exp10(const float& x) noexcept
- {
- return __exp10f(x);
- }
- inline double exp10(const double& x) noexcept
- {
- return __exp10(x);
- }
-#elif defined(__GLIBC__)
+#if defined(__GLIBC__)
inline float exp10(const float& x) noexcept
{
return ::exp10f(x);