Unverified Commit 4223f416 authored by kirillrdy's avatar kirillrdy Committed by GitHub
Browse files

halide: 16.0.0 -> 18.0.0 (#349237)

parents 5a051507 a90f538e
Loading
Loading
Loading
Loading
+103 −60
Original line number Diff line number Diff line
{ stdenv
, llvmPackages
, lib
, fetchFromGitHub
, cmake
, libffi
, libpng
, libjpeg
, mesa
, libGL
, eigen
, openblas
, blas
, lapack
{
  stdenv,
  llvmPackages,
  lib,
  fetchFromGitHub,
  cmake,
  flatbuffers,
  libffi,
  libpng,
  libjpeg,
  mesa,
  libGL,
  eigen,
  openblas,
  blas,
  lapack,
  pythonSupport ? false,
  python3Packages ? null,
}:

assert blas.implementation == "openblas" && lapack.implementation == "openblas";

stdenv.mkDerivation rec {
  pname = "halide";
  version = "16.0.0";
  version = "18.0.0";

  src = fetchFromGitHub {
    owner = "halide";
    repo = "Halide";
    rev = "v${version}";
    sha256 = "sha256-lJQrXkJgBmGb/QMSxwuPkkHOSgEDowLWzIolp1km2Y8=";
    hash = "sha256-BPalUh9EgdCqVaWC1HoreyyRcPQc4QMIYnLrRoNDDCI=";
  };

  postPatch = ''
  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__)
@@ -53,7 +58,7 @@ stdenv.mkDerivation rec {

  cmakeFlags = [
    "-DWARNINGS_AS_ERRORS=OFF"
    "-DWITH_PYTHON_BINDINGS=OFF"
    "-DWITH_PYTHON_BINDINGS=${if pythonSupport then "ON" else "OFF"}"
    "-DTARGET_WEBASSEMBLY=OFF"
    # Disable performance tests since they may fail on busy machines
    "-DWITH_TEST_PERFORMANCE=OFF"
@@ -61,20 +66,40 @@ stdenv.mkDerivation rec {
    # 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"
    # Disable FetchContent for flatbuffers and use the version from nixpkgs instead
    "-DFLATBUFFERS_USE_FETCHCONTENT=OFF"
    "-DPYBIND11_USE_FETCHCONTENT=OFF"
  ];

  doCheck = true;

  # Note: disable mullapudi2016_fibonacci because it requires too much
  # parallelism for remote builders
  preCheck = ''
    checkFlagsArray+=("ARGS=-E 'mullapudi2016_fibonacci'")
  preCheck =
    let
      disabledTests = lib.strings.concatStringsSep "|" [
        # Requires too much parallelism for remote builders.
        "mullapudi2016_fibonacci"
        # Take too long---we don't want to run these in CI.
        "adams2019_test_apps_autoscheduler"
        "anderson2021_test_apps_autoscheduler"
        "correctness_cross_compilation"
        "correctness_simd_op_check_hvx"
      ];
    in
    ''
      checkFlagsArray+=("ARGS=-E '${disabledTests}'")
    '';

  postInstall = lib.optionalString pythonSupport ''
    mkdir -p $out/${builtins.dirOf python3Packages.python.sitePackages}
    mv -v $out/lib/python3/site-packages $out/${python3Packages.python.sitePackages}
    rmdir $out/lib/python3/
  '';

  # 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
  buildInputs = [
  buildInputs =
    [
      llvmPackages.llvm
      llvmPackages.lld
      llvmPackages.openmp
@@ -84,18 +109,36 @@ stdenv.mkDerivation rec {
      libjpeg
      eigen
      openblas
  ] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
    ]
    ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
      mesa
      libGL
    ];

  nativeBuildInputs = [ cmake ];
  nativeBuildInputs =
    [
      cmake
      flatbuffers
    ]
    ++ lib.optionals pythonSupport [
      python3Packages.python
      python3Packages.pybind11
    ];

  propagatedBuildInputs = lib.optionals pythonSupport [
    python3Packages.numpy
    python3Packages.imageio
  ];

  meta = with lib; {
    description = "C++ based language for image processing and computational photography";
    homepage = "https://halide-lang.org";
    license = licenses.mit;
    platforms = platforms.all;
    maintainers = with maintainers; [ ck3d atila twesterhout ];
    maintainers = with maintainers; [
      ck3d
      atila
      twesterhout
    ];
  };
}
+1 −1
Original line number Diff line number Diff line
@@ -8360,7 +8360,7 @@ with pkgs;
  halibut = callPackage ../tools/typesetting/halibut { };
  halide = callPackage ../development/compilers/halide {
    llvmPackages = llvmPackages_16;
    llvmPackages = llvmPackages_18;
  };
  hareThirdParty = recurseIntoAttrs (callPackage ./hare-third-party.nix { });
+2 −0
Original line number Diff line number Diff line
@@ -5578,6 +5578,8 @@ self: super: with self; {
  hakuin = callPackage ../development/python-modules/hakuin { };
  halide = toPythonModule (pkgs.halide.override { pythonSupport = true; python3Packages = self; });
  halo = callPackage ../development/python-modules/halo { };
  halohome = callPackage ../development/python-modules/halohome { };