about summary refs log tree commit diff
path: root/pkgs/development/libraries/xsimd
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/xsimd')
-rw-r--r--pkgs/development/libraries/xsimd/default.nix36
-rw-r--r--pkgs/development/libraries/xsimd/disable-exp10-test.patch36
-rw-r--r--pkgs/development/libraries/xsimd/disable-polar-test.patch38
-rw-r--r--pkgs/development/libraries/xsimd/disable-test_error_gamma.patch (renamed from pkgs/development/libraries/xsimd/disable-test_error_gamma-test.patch)12
-rw-r--r--pkgs/development/libraries/xsimd/fix-atan-test.patch19
-rw-r--r--pkgs/development/libraries/xsimd/fix-darwin-exp10-implementation.patch22
6 files changed, 18 insertions, 145 deletions
diff --git a/pkgs/development/libraries/xsimd/default.nix b/pkgs/development/libraries/xsimd/default.nix
index d775cef4d6734..019b3afbefc84 100644
--- a/pkgs/development/libraries/xsimd/default.nix
+++ b/pkgs/development/libraries/xsimd/default.nix
@@ -1,39 +1,31 @@
 { lib
 , stdenv
 , fetchFromGitHub
+, fetchpatch
 , cmake
 , doctest
 }:
 
 stdenv.mkDerivation (finalAttrs: {
   pname = "xsimd";
-  version = "12.1.1";
+  version = "13.0.0";
   src = fetchFromGitHub {
     owner = "xtensor-stack";
     repo = "xsimd";
     rev = finalAttrs.version;
-    hash = "sha256-ofUFieeRtpnzNv3Ad5oYwKWb2XcqQHoj601TIhydJyI=";
+    hash = "sha256-qElJYW5QDj3s59L3NgZj5zkhnUMzIP2mBa1sPks3/CE=";
   };
   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
+    # Fix of https://github.com/xtensor-stack/xsimd/pull/1024 for
+    # https://github.com/xtensor-stack/xsimd/issues/456 and
+    # https://github.com/xtensor-stack/xsimd/issues/807,
+    (fetchpatch {
+      url = "https://github.com/xtensor-stack/xsimd/commit/c8a87ed6e04b6782f48f94713adfb0cad6c11ddf.patch";
+      hash = "sha256-2/FvBGdqTPcayD7rdHPSzL+F8IYKAfMW0WBJ0cW9EZ0=";
+    })
   ] ++ lib.optionals stdenv.isDarwin [
-    # https://github.com/xtensor-stack/xsimd/issues/807
-    ./disable-test_error_gamma-test.patch
-  ] ++ lib.optionals (stdenv.isDarwin || stdenv.hostPlatform.isMusl) [
-    # - Darwin report: https://github.com/xtensor-stack/xsimd/issues/917
-    # - Musl   report: https://github.com/xtensor-stack/xsimd/issues/798
-    ./disable-exp10-test.patch
-  ] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
-    # https://github.com/xtensor-stack/xsimd/issues/798
-    ./disable-polar-test.patch
-  ] ++ lib.optionals stdenv.hostPlatform.isMusl [
-    # Fix suggested here: https://github.com/xtensor-stack/xsimd/issues/798#issuecomment-1356884601
-    # Upstream didn't merge that from some reason.
-    ./fix-atan-test.patch
+    # https://github.com/xtensor-stack/xsimd/issues/1030
+    ./disable-test_error_gamma.patch
   ];
 
   nativeBuildInputs = [
@@ -41,7 +33,9 @@ stdenv.mkDerivation (finalAttrs: {
   ];
 
   cmakeFlags = [
-    "-DBUILD_TESTS=${if (finalAttrs.finalPackage.doCheck && stdenv.hostPlatform == stdenv.buildPlatform) then "ON" else "OFF"}"
+    # Always build the tests, even if not running them, because testing whether
+    # they can be built is a test in itself.
+    "-DBUILD_TESTS=ON"
   ];
 
   doCheck = true;
diff --git a/pkgs/development/libraries/xsimd/disable-exp10-test.patch b/pkgs/development/libraries/xsimd/disable-exp10-test.patch
deleted file mode 100644
index 8d2940c3b080b..0000000000000
--- a/pkgs/development/libraries/xsimd/disable-exp10-test.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-commit 87433035c70578507e08565723c99158290f2488
-Author: Doron Behar <doron.behar@gmail.com>
-Date:   Tue Aug 1 13:26:04 2023 +0300
-
-    Darwin & Musl: Disable failing exp10 test
-
---- a/test/test_xsimd_api.cpp
-+++ b/test/test_xsimd_api.cpp
-@@ -515,15 +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);
--#ifdef EMSCRIPTEN
--        CHECK_EQ(extract(xsimd::exp10(T(val))), doctest::Approx(std::pow(value_type(10), val)));
--#else
--        CHECK_EQ(extract(xsimd::exp10(T(val))), std::pow(value_type(10), val));
--#endif
--    }
-     void test_exp2()
-     {
-         value_type val(2);
-@@ -813,11 +804,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();
diff --git a/pkgs/development/libraries/xsimd/disable-polar-test.patch b/pkgs/development/libraries/xsimd/disable-polar-test.patch
deleted file mode 100644
index 91128f43c2d5c..0000000000000
--- a/pkgs/development/libraries/xsimd/disable-polar-test.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-commit 9374b88b97911d9c6e19d5e764e25183cd45d534
-Author: Doron Behar <doron.behar@gmail.com>
-Date:   Tue Aug 1 13:29:16 2023 +0300
-
-    aarch64-Darwin: Disable failing polar test
-
---- a/test/test_xsimd_api.cpp
-+++ b/test/test_xsimd_api.cpp
-@@ -661,17 +661,6 @@ struct xsimd_api_float_types_functions
-         value_type val1(4);
-         CHECK_EQ(extract(xsimd::nextafter(T(val0), T(val1))), std::nextafter(val0, val1));
-     }
--    void test_polar()
--    {
--        value_type val0(3);
--        value_type val1(4);
--#ifndef EMSCRIPTEN
--        CHECK_EQ(extract(xsimd::polar(T(val0), T(val1))), std::polar(val0, val1));
--#else
--        CHECK_EQ(std::real(extract(xsimd::polar(T(val0), T(val1)))), doctest::Approx(std::real(std::polar(val0, val1))));
--        CHECK_EQ(std::imag(extract(xsimd::polar(T(val0), T(val1)))), doctest::Approx(std::imag(std::polar(val0, val1))));
--#endif
--    }
-     void test_pow()
-     {
-         value_type val0(2);
-@@ -931,11 +920,6 @@ TEST_CASE_TEMPLATE("[xsimd api | float types functions]", B, FLOAT_TYPES)
-         Test.test_nextafter();
-     }
- 
--    SUBCASE("polar")
--    {
--        Test.test_polar();
--    }
--
-     SUBCASE("pow")
-     {
-         Test.test_pow();
diff --git a/pkgs/development/libraries/xsimd/disable-test_error_gamma-test.patch b/pkgs/development/libraries/xsimd/disable-test_error_gamma.patch
index a7344d231b8db..49957ea62ed74 100644
--- a/pkgs/development/libraries/xsimd/disable-test_error_gamma-test.patch
+++ b/pkgs/development/libraries/xsimd/disable-test_error_gamma.patch
@@ -1,13 +1,7 @@
-commit 3f751cef6b27ec13418a92c5b5f36b22bb5ffd55
-Author: Doron Behar <doron.behar@gmail.com>
-Date:   Tue Aug 1 13:24:34 2023 +0300
-
-    Darwin: Disable failing test from test_error_gamma.cpp
-
-diff --git a/test/test_error_gamma.cpp b/test/test_error_gamma.cpp
+diff --git i/test/test_error_gamma.cpp w/test/test_error_gamma.cpp
 index 214cbb5..299e5b8 100644
---- a/test/test_error_gamma.cpp
-+++ b/test/test_error_gamma.cpp
+--- 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);
diff --git a/pkgs/development/libraries/xsimd/fix-atan-test.patch b/pkgs/development/libraries/xsimd/fix-atan-test.patch
deleted file mode 100644
index 3d1517610aae5..0000000000000
--- a/pkgs/development/libraries/xsimd/fix-atan-test.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-commit f60dad2c1d8ad47fbff761ce1cb027fc7c3a40e8
-Author: Doron Behar <doron.behar@gmail.com>
-Date:   Tue Aug 1 13:47:37 2023 +0300
-
-    Musl: Fix atan test from test_complex_trigonometric.cpp
-
-diff --git a/test/test_complex_trigonometric.cpp b/test/test_complex_trigonometric.cpp
-index a486110..691db77 100644
---- a/test/test_complex_trigonometric.cpp
-+++ b/test/test_complex_trigonometric.cpp
-@@ -155,7 +155,7 @@ struct complex_trigonometric_test
-             out = atan(in);
-             detail::store_batch(out, res, i);
-         }
--        size_t diff = detail::get_nb_diff(res, expected);
-+        size_t diff = detail::get_nb_diff_near(res, expected, 1e-12);
-         CHECK_EQ(diff, 0);
-     }
- 
diff --git a/pkgs/development/libraries/xsimd/fix-darwin-exp10-implementation.patch b/pkgs/development/libraries/xsimd/fix-darwin-exp10-implementation.patch
deleted file mode 100644
index caa7db0bcc134..0000000000000
--- a/pkgs/development/libraries/xsimd/fix-darwin-exp10-implementation.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-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);