about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/xsimd
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-08-23 10:09:14 +0000
committerAlyssa Ross <hi@alyssa.is>2023-08-26 09:07:03 +0000
commit63dabcc77ef9a56655e1ca2ab2e25e6163a72c1f (patch)
treed58934cb48f9c953b19a0d0d5cffc0d0c5561471 /nixpkgs/pkgs/development/libraries/xsimd
parentc4eef3dacb2a3d359561f30917d9e3cc4e041be9 (diff)
parent91a22f76cd1716f9d0149e8a5c68424bb691de15 (diff)
downloadnixlib-63dabcc77ef9a56655e1ca2ab2e25e6163a72c1f.tar
nixlib-63dabcc77ef9a56655e1ca2ab2e25e6163a72c1f.tar.gz
nixlib-63dabcc77ef9a56655e1ca2ab2e25e6163a72c1f.tar.bz2
nixlib-63dabcc77ef9a56655e1ca2ab2e25e6163a72c1f.tar.lz
nixlib-63dabcc77ef9a56655e1ca2ab2e25e6163a72c1f.tar.xz
nixlib-63dabcc77ef9a56655e1ca2ab2e25e6163a72c1f.tar.zst
nixlib-63dabcc77ef9a56655e1ca2ab2e25e6163a72c1f.zip
Merge branch 'nixos-unstable' of https://github.com/NixOS/nixpkgs
Conflicts:
	nixpkgs/pkgs/build-support/go/module.nix
	nixpkgs/pkgs/development/python-modules/django-mailman3/default.nix
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/xsimd')
-rw-r--r--nixpkgs/pkgs/development/libraries/xsimd/default.nix59
-rw-r--r--nixpkgs/pkgs/development/libraries/xsimd/disable-exp10-test.patch34
-rw-r--r--nixpkgs/pkgs/development/libraries/xsimd/disable-polar-test.patch35
-rw-r--r--nixpkgs/pkgs/development/libraries/xsimd/disable-test_error_gamma-test.patch36
-rw-r--r--nixpkgs/pkgs/development/libraries/xsimd/fix-atan-test.patch19
-rw-r--r--nixpkgs/pkgs/development/libraries/xsimd/fix-darwin-exp10-implementation.patch22
6 files changed, 185 insertions, 20 deletions
diff --git a/nixpkgs/pkgs/development/libraries/xsimd/default.nix b/nixpkgs/pkgs/development/libraries/xsimd/default.nix
index ec2d166ef580..a481a12932f9 100644
--- a/nixpkgs/pkgs/development/libraries/xsimd/default.nix
+++ b/nixpkgs/pkgs/development/libraries/xsimd/default.nix
@@ -1,35 +1,54 @@
-{ lib, stdenv, fetchFromGitHub, cmake, gtest }:
+{ lib
+, stdenv
+, fetchFromGitHub
+, cmake
+, doctest
+}:
+
 stdenv.mkDerivation rec {
   pname = "xsimd";
-  version = "9.0.1";
+  version = "11.1.0";
   src = fetchFromGitHub {
     owner = "xtensor-stack";
     repo = "xsimd";
     rev = version;
-    sha256 = "sha256-onALN6agtrHWigtFlCeefD9CiRZI4Y690XTzy2UDnrk=";
+    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 [
+    # 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
+  ];
 
-  nativeBuildInputs = [ cmake ];
+  nativeBuildInputs = [
+    cmake
+  ];
 
-  cmakeFlags = [ "-DBUILD_TESTS=ON" ];
+  cmakeFlags = [
+    "-DBUILD_TESTS=${if (doCheck && stdenv.hostPlatform == stdenv.buildPlatform) then "ON" else "OFF"}"
+  ];
 
   doCheck = true;
-  nativeCheckInputs = [ gtest ];
+  nativeCheckInputs = [
+    doctest
+  ];
   checkTarget = "xtest";
-  GTEST_FILTER =
-    let
-      # Upstream Issue: https://github.com/xtensor-stack/xsimd/issues/456
-      filteredTests = lib.optionals stdenv.hostPlatform.isDarwin [
-        "error_gamma_test/*"
-      ];
-    in
-    "-${builtins.concatStringsSep ":" filteredTests}";
-
-  # https://github.com/xtensor-stack/xsimd/issues/748
-  postPatch = ''
-    substituteInPlace xsimd.pc.in \
-      --replace '$'{prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@
-  '';
 
   meta = with lib; {
     description = "C++ wrappers for SIMD intrinsics";
diff --git a/nixpkgs/pkgs/development/libraries/xsimd/disable-exp10-test.patch b/nixpkgs/pkgs/development/libraries/xsimd/disable-exp10-test.patch
new file mode 100644
index 000000000000..62e24e18c6b7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xsimd/disable-exp10-test.patch
@@ -0,0 +1,34 @@
+commit 87433035c70578507e08565723c99158290f2488
+Author: Doron Behar <doron.behar@gmail.com>
+Date:   Tue Aug 1 13:26:04 2023 +0300
+
+    Darwin & Musl: Disable failing exp10 test
+
+diff --git a/test/test_xsimd_api.cpp b/test/test_xsimd_api.cpp
+index 84b4b0b..1b29742 100644
+--- a/test/test_xsimd_api.cpp
++++ b/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();
diff --git a/nixpkgs/pkgs/development/libraries/xsimd/disable-polar-test.patch b/nixpkgs/pkgs/development/libraries/xsimd/disable-polar-test.patch
new file mode 100644
index 000000000000..cbb7c0313c6d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xsimd/disable-polar-test.patch
@@ -0,0 +1,35 @@
+commit 9374b88b97911d9c6e19d5e764e25183cd45d534
+Author: Doron Behar <doron.behar@gmail.com>
+Date:   Tue Aug 1 13:29:16 2023 +0300
+
+    aarch64-Darwin: Disable failing polar test
+
+diff --git a/test/test_xsimd_api.cpp b/test/test_xsimd_api.cpp
+index 1b29742..03c6b4b 100644
+--- a/test/test_xsimd_api.cpp
++++ b/test/test_xsimd_api.cpp
+@@ -652,12 +652,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);
+-        CHECK_EQ(extract(xsimd::polar(T(val0), T(val1))), std::polar(val0, val1));
+-    }
+     void test_pow()
+     {
+         value_type val0(2);
+@@ -912,11 +906,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/nixpkgs/pkgs/development/libraries/xsimd/disable-test_error_gamma-test.patch b/nixpkgs/pkgs/development/libraries/xsimd/disable-test_error_gamma-test.patch
new file mode 100644
index 000000000000..a7344d231b8d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xsimd/disable-test_error_gamma-test.patch
@@ -0,0 +1,36 @@
+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
+index 214cbb5..299e5b8 100644
+--- a/test/test_error_gamma.cpp
++++ b/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 a/nixpkgs/pkgs/development/libraries/xsimd/fix-atan-test.patch b/nixpkgs/pkgs/development/libraries/xsimd/fix-atan-test.patch
new file mode 100644
index 000000000000..3d1517610aae
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xsimd/fix-atan-test.patch
@@ -0,0 +1,19 @@
+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/nixpkgs/pkgs/development/libraries/xsimd/fix-darwin-exp10-implementation.patch b/nixpkgs/pkgs/development/libraries/xsimd/fix-darwin-exp10-implementation.patch
new file mode 100644
index 000000000000..caa7db0bcc13
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/xsimd/fix-darwin-exp10-implementation.patch
@@ -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);