about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/halide/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-12-01 19:00:09 +0100
committerAlyssa Ross <hi@alyssa.is>2023-12-01 19:00:09 +0100
commit9e9b07490d5bab5d115c66b80bdb10ff0c11ed8d (patch)
tree4368f9e4cb2d5b93a956c085337e45cb70f1e331 /nixpkgs/pkgs/development/compilers/halide/default.nix
parenta9cbfb6941b47d6f50129e6e36927882392daed7 (diff)
parent2344fe1da14cb08b0c18743b207995f9b8597915 (diff)
downloadnixlib-9e9b07490d5bab5d115c66b80bdb10ff0c11ed8d.tar
nixlib-9e9b07490d5bab5d115c66b80bdb10ff0c11ed8d.tar.gz
nixlib-9e9b07490d5bab5d115c66b80bdb10ff0c11ed8d.tar.bz2
nixlib-9e9b07490d5bab5d115c66b80bdb10ff0c11ed8d.tar.lz
nixlib-9e9b07490d5bab5d115c66b80bdb10ff0c11ed8d.tar.xz
nixlib-9e9b07490d5bab5d115c66b80bdb10ff0c11ed8d.tar.zst
nixlib-9e9b07490d5bab5d115c66b80bdb10ff0c11ed8d.zip
Merge https://github.com/NixOS/nixpkgs
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/halide/default.nix')
-rw-r--r--nixpkgs/pkgs/development/compilers/halide/default.nix38
1 files changed, 36 insertions, 2 deletions
diff --git a/nixpkgs/pkgs/development/compilers/halide/default.nix b/nixpkgs/pkgs/development/compilers/halide/default.nix
index 0f5a330faa18..738ecc81a156 100644
--- a/nixpkgs/pkgs/development/compilers/halide/default.nix
+++ b/nixpkgs/pkgs/development/compilers/halide/default.nix
@@ -18,25 +18,59 @@ assert blas.implementation == "openblas" && lapack.implementation == "openblas";
 
 stdenv.mkDerivation rec {
   pname = "halide";
-  version = "15.0.1";
+  version = "16.0.0";
 
   src = fetchFromGitHub {
     owner = "halide";
     repo = "Halide";
     rev = "v${version}";
-    sha256 = "sha256-mnZ6QMqDr48bH2W+andGZj2EhajXKApjuW6B50xtzx0=";
+    sha256 = "sha256-lJQrXkJgBmGb/QMSxwuPkkHOSgEDowLWzIolp1km2Y8=";
   };
 
+  postPatch = ''
+    # See https://github.com/halide/Halide/issues/7785
+    substituteInPlace 'src/runtime/HalideRuntime.h' \
+      --replace '#if defined(__x86_64__) || defined(__i386__) || defined(__arm__) || defined(__aarch64__)
+    #define HALIDE_CPP_COMPILER_HAS_FLOAT16' \
+                '#if defined(__x86_64__) || defined(__i386__)
+    #define HALIDE_CPP_COMPILER_HAS_FLOAT16'
+  ''
+  # Note: on x86_64-darwin, clang fails to find AvailabilityVersions.h, so we remove it.
+  # Halide uses AvailabilityVersions.h and TargetConditionals.h to determine whether
+  # ::aligned_alloc is available. For us, it isn't.
+  + lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) ''
+    substituteInPlace 'src/runtime/HalideBuffer.h' \
+      --replace '#ifdef __APPLE__
+    #include <AvailabilityVersions.h>
+    #include <TargetConditionals.h>
+    #endif' \
+                ' ' \
+      --replace 'TARGET_OS_OSX && (__MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_15)' \
+                '1' \
+      --replace 'TARGET_OS_IPHONE && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_14_0)' \
+                '0'
+  '';
+
   cmakeFlags = [
     "-DWARNINGS_AS_ERRORS=OFF"
     "-DWITH_PYTHON_BINDINGS=OFF"
     "-DTARGET_WEBASSEMBLY=OFF"
     # Disable performance tests since they may fail on busy machines
     "-DWITH_TEST_PERFORMANCE=OFF"
+    # Disable fuzzing tests -- this has become the default upstream after the
+    # v16 release (See https://github.com/halide/Halide/commit/09c5d1d19ec8e6280ccbc01a8a12decfb27226ba)
+    # These tests also fail to compile on Darwin because of some missing command line options...
+    "-DWITH_TEST_FUZZ=OFF"
   ];
 
   doCheck = true;
 
+  # Note: disable mullapudi2016_fibonacci because it requires too much
+  # parallelism for remote builders
+  preCheck = ''
+    checkFlagsArray+=("ARGS=-E 'mullapudi2016_fibonacci'")
+  '';
+
   # Note: only openblas and not atlas part of this Nix expression
   # see pkgs/development/libraries/science/math/liblapack/3.5.0.nix
   # to get a hint howto setup atlas instead of openblas