From f98356812553eb23b62295ea82b5dbc6553d93b2 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sat, 18 May 2024 23:59:08 +0300 Subject: [PATCH 1/8] xsimd: 12.1.1 -> 13.0.0 Diff: https://github.com/xtensor-stack/xsimd/compare/12.1.1...13.0.0 --- pkgs/development/libraries/xsimd/default.nix | 31 +++++---------- .../libraries/xsimd/disable-exp10-test.patch | 36 ------------------ .../libraries/xsimd/disable-polar-test.patch | 38 ------------------- .../xsimd/disable-test_error_gamma-test.patch | 36 ------------------ .../libraries/xsimd/fix-atan-test.patch | 19 ---------- .../fix-darwin-exp10-implementation.patch | 22 ----------- 6 files changed, 10 insertions(+), 172 deletions(-) delete mode 100644 pkgs/development/libraries/xsimd/disable-exp10-test.patch delete mode 100644 pkgs/development/libraries/xsimd/disable-polar-test.patch delete mode 100644 pkgs/development/libraries/xsimd/disable-test_error_gamma-test.patch delete mode 100644 pkgs/development/libraries/xsimd/fix-atan-test.patch delete mode 100644 pkgs/development/libraries/xsimd/fix-darwin-exp10-implementation.patch diff --git a/pkgs/development/libraries/xsimd/default.nix b/pkgs/development/libraries/xsimd/default.nix index d775cef4d673..78be55a804a7 100644 --- a/pkgs/development/libraries/xsimd/default.nix +++ b/pkgs/development/libraries/xsimd/default.nix @@ -1,39 +1,28 @@ { 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 - ] ++ 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 + # 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="; + }) ]; nativeBuildInputs = [ 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 8d2940c3b080..000000000000 --- a/pkgs/development/libraries/xsimd/disable-exp10-test.patch +++ /dev/null @@ -1,36 +0,0 @@ -commit 87433035c70578507e08565723c99158290f2488 -Author: Doron Behar -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 91128f43c2d5..000000000000 --- a/pkgs/development/libraries/xsimd/disable-polar-test.patch +++ /dev/null @@ -1,38 +0,0 @@ -commit 9374b88b97911d9c6e19d5e764e25183cd45d534 -Author: Doron Behar -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-test.patch deleted file mode 100644 index a7344d231b8d..000000000000 --- a/pkgs/development/libraries/xsimd/disable-test_error_gamma-test.patch +++ /dev/null @@ -1,36 +0,0 @@ -commit 3f751cef6b27ec13418a92c5b5f36b22bb5ffd55 -Author: Doron Behar -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/pkgs/development/libraries/xsimd/fix-atan-test.patch b/pkgs/development/libraries/xsimd/fix-atan-test.patch deleted file mode 100644 index 3d1517610aae..000000000000 --- a/pkgs/development/libraries/xsimd/fix-atan-test.patch +++ /dev/null @@ -1,19 +0,0 @@ -commit f60dad2c1d8ad47fbff761ce1cb027fc7c3a40e8 -Author: Doron Behar -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 caa7db0bcc13..000000000000 --- 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); From 3558ec4b9d2eeee0f396d91e638e957f0bf36904 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sun, 19 May 2024 00:05:16 +0300 Subject: [PATCH 2/8] xsimd: always build the tests --- pkgs/development/libraries/xsimd/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/xsimd/default.nix b/pkgs/development/libraries/xsimd/default.nix index 78be55a804a7..db761aae7094 100644 --- a/pkgs/development/libraries/xsimd/default.nix +++ b/pkgs/development/libraries/xsimd/default.nix @@ -30,7 +30,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; From cbe19213b4c0f41fcdc77fc41235fe489eee0be0 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sun, 19 May 2024 00:00:33 +0300 Subject: [PATCH 3/8] xtensor: Remove . at end of meta.description --- pkgs/development/libraries/xtensor/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/xtensor/default.nix b/pkgs/development/libraries/xtensor/default.nix index 678f87af74cf..f62be138f2c0 100644 --- a/pkgs/development/libraries/xtensor/default.nix +++ b/pkgs/development/libraries/xtensor/default.nix @@ -59,7 +59,7 @@ stdenv.mkDerivation (finalAttrs: { checkTarget = "xtest"; meta = with lib; { - description = "Multi-dimensional arrays with broadcasting and lazy computing."; + description = "Multi-dimensional arrays with broadcasting and lazy computing"; homepage = "https://github.com/xtensor-stack/xtensor"; license = licenses.bsd3; maintainers = with maintainers; [ cpcloud ]; From cc19c5c475e957f89a35d9d741c282db0f587353 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sun, 19 May 2024 00:00:45 +0300 Subject: [PATCH 4/8] xtensor: 0.24.7 -> 0.25.0 Diff: https://github.com/xtensor-stack/xtensor/compare/0.24.7...0.25.0 --- pkgs/development/libraries/xtensor/default.nix | 17 ++--------------- .../xtensor/remove-failing-test_xinfo.patch | 12 ------------ 2 files changed, 2 insertions(+), 27 deletions(-) delete mode 100644 pkgs/development/libraries/xtensor/remove-failing-test_xinfo.patch diff --git a/pkgs/development/libraries/xtensor/default.nix b/pkgs/development/libraries/xtensor/default.nix index f62be138f2c0..6b72778c720c 100644 --- a/pkgs/development/libraries/xtensor/default.nix +++ b/pkgs/development/libraries/xtensor/default.nix @@ -13,24 +13,14 @@ stdenv.mkDerivation (finalAttrs: { pname = "xtensor"; - version = "0.24.7"; + version = "0.25.0"; src = fetchFromGitHub { owner = "xtensor-stack"; repo = "xtensor"; rev = finalAttrs.version; - hash = "sha256-dVbpcBW+jK9nIl5efk5LdKdBm8CkaJWEZ0ZY7ZuApwk="; + hash = "sha256-hVfdtYcJ6mzqj0AUu6QF9aVKQGYKd45RngY6UN3yOH4="; }; - patches = [ - # Support for xsimd 11 - (fetchpatch { - url = "https://github.com/xtensor-stack/xtensor/commit/77a650a8018e0be6fcc76bf66685ff352ae23ef1.patch"; - hash = "sha256-vOdUzzsSK+lYcA7fZXWOTVV202GZC0DhkMMjzggnmWE="; - }) - # A single test fails on Darwin, see: - # https://github.com/xtensor-stack/xtensor/issues/2718 - ./remove-failing-test_xinfo.patch - ]; nativeBuildInputs = [ cmake @@ -38,9 +28,6 @@ stdenv.mkDerivation (finalAttrs: { propagatedBuildInputs = [ nlohmann_json xtl - ] ++ lib.optionals (!(stdenv.isAarch64 && stdenv.isLinux)) [ - # xsimd support is broken on aarch64-linux, see: - # https://github.com/xtensor-stack/xsimd/issues/945 xsimd ]; diff --git a/pkgs/development/libraries/xtensor/remove-failing-test_xinfo.patch b/pkgs/development/libraries/xtensor/remove-failing-test_xinfo.patch deleted file mode 100644 index c3352c453c59..000000000000 --- a/pkgs/development/libraries/xtensor/remove-failing-test_xinfo.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git i/test/CMakeLists.txt w/test/CMakeLists.txt -index 46127597..727b66bd 100644 ---- i/test/CMakeLists.txt -+++ w/test/CMakeLists.txt -@@ -189,7 +189,6 @@ set(XTENSOR_TESTS - test_xhistogram.cpp - test_xpad.cpp - test_xindex_view.cpp -- test_xinfo.cpp - test_xio.cpp - test_xlayout.cpp - test_xmanipulation.cpp From e28b99600481454045d3ba104435c40981208003 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sun, 19 May 2024 00:12:56 +0300 Subject: [PATCH 5/8] xtensor: use lib.cmakeBool --- pkgs/development/libraries/xtensor/default.nix | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pkgs/development/libraries/xtensor/default.nix b/pkgs/development/libraries/xtensor/default.nix index 6b72778c720c..8682b32a45e6 100644 --- a/pkgs/development/libraries/xtensor/default.nix +++ b/pkgs/development/libraries/xtensor/default.nix @@ -31,12 +31,10 @@ stdenv.mkDerivation (finalAttrs: { xsimd ]; - cmakeFlags = let - cmakeBool = x: if x then "ON" else "OFF"; - in [ - "-DBUILD_TESTS=${cmakeBool finalAttrs.finalPackage.doCheck}" - "-DXTENSOR_ENABLE_ASSERT=${cmakeBool enableAssertions}" - "-DXTENSOR_CHECK_DIMENSION=${cmakeBool enableBoundChecks}" + cmakeFlags = [ + (lib.cmakeBool "BUILD_TESTS" finalAttrs.finalPackage.doCheck ) + (lib.cmakeBool "XTENSOR_ENABLE_ASSERT" enableAssertions) + (lib.cmakeBool "XTENSOR_CHECK_DIMENSION" enableBoundChecks) ]; doCheck = true; From a8badac01b7ec38146fdca30a49d24f76436e93e Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sun, 19 May 2024 00:18:57 +0300 Subject: [PATCH 6/8] xtensor: always build tests --- pkgs/development/libraries/xtensor/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/xtensor/default.nix b/pkgs/development/libraries/xtensor/default.nix index 8682b32a45e6..da85a37ab5bc 100644 --- a/pkgs/development/libraries/xtensor/default.nix +++ b/pkgs/development/libraries/xtensor/default.nix @@ -32,7 +32,9 @@ stdenv.mkDerivation (finalAttrs: { ]; cmakeFlags = [ - (lib.cmakeBool "BUILD_TESTS" finalAttrs.finalPackage.doCheck ) + # Always build the tests, even if not running them, because testing whether + # they can be built is a test in itself. + (lib.cmakeBool "BUILD_TESTS" true) (lib.cmakeBool "XTENSOR_ENABLE_ASSERT" enableAssertions) (lib.cmakeBool "XTENSOR_CHECK_DIMENSION" enableBoundChecks) ]; From 9a78139e38673402017d8b252d1f4e03ebc4bd3b Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sun, 19 May 2024 00:25:15 +0300 Subject: [PATCH 7/8] python311Packages.xtensor-python: 0.26.1 -> 0.27.0 Diff: https://github.com/xtensor-stack/xtensor-python/compare/0.26.1...0.27.0 --- pkgs/development/python-modules/xtensor-python/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/xtensor-python/default.nix b/pkgs/development/python-modules/xtensor-python/default.nix index 4b2123162cc1..f6e34649f5f1 100644 --- a/pkgs/development/python-modules/xtensor-python/default.nix +++ b/pkgs/development/python-modules/xtensor-python/default.nix @@ -11,13 +11,13 @@ toPythonModule (stdenv.mkDerivation(finalAttrs: { pname = "xtensor-python"; - version = "0.26.1"; + version = "0.27.0"; src = fetchFromGitHub { owner = "xtensor-stack"; repo = "xtensor-python"; rev = finalAttrs.version; - sha256 = "sha256-kLFt5Ah5/ZO6wfTZQviVXeIAVok+/F/XCwpgPSagOMo="; + sha256 = "sha256-Cy/aXuiriE/qxSd4Apipzak30DjgE7jX8ai1ThJ/VnE="; }; nativeBuildInputs = [ From 2f8ae866d1f0ed9776cd68868da27aabbf535336 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sun, 19 May 2024 00:26:03 +0300 Subject: [PATCH 8/8] python311Packages.xtensor: always build tests --- pkgs/development/python-modules/xtensor-python/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/xtensor-python/default.nix b/pkgs/development/python-modules/xtensor-python/default.nix index f6e34649f5f1..50cbb7446f43 100644 --- a/pkgs/development/python-modules/xtensor-python/default.nix +++ b/pkgs/development/python-modules/xtensor-python/default.nix @@ -31,7 +31,9 @@ toPythonModule (stdenv.mkDerivation(finalAttrs: { ]; doCheck = true; cmakeFlags = [ - "-DBUILD_TESTS=${if finalAttrs.finalPackage.doCheck 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" ]; propagatedBuildInputs = [