Merge pull request #100202 from OPNA2608/update/halide-10.0.0

halide: 2019.08.27 -> 10.0.0, enable on aarch64-linux
This commit is contained in:
Kevin Cox 2020-11-03 18:19:40 -05:00 committed by GitHub
commit e031671e19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 88 deletions

View File

@ -1,42 +1,43 @@
{ llvmPackages, lib, fetchFromGitHub, cmake
, libpng, libjpeg, mesa, eigen
, openblas, blas, lapack
{ llvmPackages
, lib
, fetchFromGitHub
, cmake
, libpng
, libjpeg
, mesa
, eigen
, openblas
, blas
, lapack
}:
assert blas.implementation == "openblas" && lapack.implementation == "openblas";
let
version = "2019_08_27";
in llvmPackages.stdenv.mkDerivation {
name = "halide-${builtins.replaceStrings ["_"] ["."] version}";
llvmPackages.stdenv.mkDerivation rec {
pname = "halide";
version = "10.0.0";
src = fetchFromGitHub {
owner = "halide";
repo = "Halide";
rev = "release_${version}";
sha256 = "09xf8v9zyxx2fn6s1yzjkyzcf9zyzrg3x5vivgd2ljzbfhm8wh7n";
rev = "v${version}";
sha256 = "0il71rppjp76m7zd420siidvhs76sqiq26h60ywk812sj9mmgxj6";
};
patches = [ ./nix.patch ];
# clang fails to compile intermediate code because
# of unused "--gcc-toolchain" option
postPatch = ''
sed -i "s/-Werror//" src/CMakeLists.txt
'';
cmakeFlags = [ "-DWARNINGS_AS_ERRORS=OFF" ];
cmakeFlags = [ "-DWARNINGS_AS_ERRORS=OFF" "-DWITH_PYTHON_BINDINGS=OFF" ];
# To handle the lack of 'local' RPATH; required, as they call one of
# their built binaries requiring their libs, in the build process.
preBuild = ''
export LD_LIBRARY_PATH="$(pwd)/lib''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="$(pwd)/src''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
'';
enableParallelBuilding = true;
# 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
@ -44,24 +45,11 @@ in llvmPackages.stdenv.mkDerivation {
nativeBuildInputs = [ cmake ];
# No install target for cmake available.
# Calling install target in Makefile causes complete rebuild
# and the library rpath is broken, because libncursesw.so.6 is missing.
# Another way is using "make halide_archive", but the tarball is not easy
# to disassemble.
installPhase = ''
find
mkdir -p "$out/lib" "$out/bin"
cp bin/HalideTrace* "$out/bin"
cp lib/libHalide.so "$out/lib"
cp -r include "$out"
'';
meta = with lib; {
description = "C++ based language for image processing and computational photography";
homepage = "https://halide-lang.org";
license = licenses.mit;
platforms = [ "i686-linux" "x86_64-linux" ];
platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" ];
maintainers = [ maintainers.ck3d ];
};
}

View File

@ -1,56 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4ba384324..7e23038f7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -75,10 +75,10 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
set(LLVM_VERSION "${LLVM_VERSION_MAJOR}${LLVM_VERSION_MINOR}")
-file(TO_NATIVE_PATH "${LLVM_TOOLS_BINARY_DIR}/llvm-as${CMAKE_EXECUTABLE_SUFFIX}" LLVM_AS)
-file(TO_NATIVE_PATH "${LLVM_TOOLS_BINARY_DIR}/llvm-nm${CMAKE_EXECUTABLE_SUFFIX}" LLVM_NM)
-file(TO_NATIVE_PATH "${LLVM_TOOLS_BINARY_DIR}/clang${CMAKE_EXECUTABLE_SUFFIX}" CLANG)
-file(TO_NATIVE_PATH "${LLVM_TOOLS_BINARY_DIR}/llvm-config${CMAKE_EXECUTABLE_SUFFIX}" LLVM_CONFIG)
+find_program(LLVM_AS llvm-as HINTS ${LLVM_TOOLS_BINARY_DIR})
+find_program(LLVM_NM llvm-nm HINTS ${LLVM_TOOLS_BINARY_DIR})
+find_program(CLANG clang HINTS ${LLVM_TOOLS_BINARY_DIR})
+find_program(LLVM_CONFIG llvm-config HINTS ${LLVM_TOOLS_BINARY_DIR})
# LLVM doesn't appear to expose --system-libs via its CMake interface,
# so we must shell out to llvm-config to find this info
diff --git a/apps/linear_algebra/CMakeLists.txt b/apps/linear_algebra/CMakeLists.txt
index 132c80e6a..36ce865f2 100644
--- a/apps/linear_algebra/CMakeLists.txt
+++ b/apps/linear_algebra/CMakeLists.txt
@@ -26,7 +26,7 @@ if (CBLAS_FOUND)
# Atlas requires also linking against its provided libcblas for cblas symbols
set(ATLAS_EXTRA_LIBS cblas) # XXX fragile
set(OpenBLAS_EXTRA_LIBS)
- set(BLAS_VENDORS OpenBLAS ATLAS)
+ set(BLAS_VENDORS OpenBLAS)
# TODO
# there are more vendors we could add here that support the cblas interface
@@ -41,6 +41,7 @@ if (CBLAS_FOUND)
message(STATUS " ${BLAS_VENDOR}: Missing")
else()
message(STATUS " ${BLAS_VENDOR}: Found")
+ set(BLAS_LIBRARIES "${BLAS_LIBRARIES}" CACHE FILEPATH "BLAS library to use")
list(APPEND BLAS_VENDORS ${NAME})
endif()
endforeach()
diff --git a/apps/linear_algebra/tests/CMakeLists.txt b/apps/linear_algebra/tests/CMakeLists.txt
index cc02eb0a4..c20419a0d 100644
--- a/apps/linear_algebra/tests/CMakeLists.txt
+++ b/apps/linear_algebra/tests/CMakeLists.txt
@@ -19,7 +19,7 @@ target_compile_options(test_halide_blas PRIVATE -Wno-unused-variable)
target_link_libraries(test_halide_blas
PRIVATE
halide_blas
- cblas # XXX fragile
+ ${BLAS_LIBRARIES}
${HALIDE_COMPILER_LIB}
)
--
2.23.0

View File

@ -4494,7 +4494,9 @@ in
halibut = callPackage ../tools/typesetting/halibut { };
halide = callPackage ../development/compilers/halide { };
halide = callPackage ../development/compilers/halide {
llvmPackages = llvmPackages_9;
};
ham = pkgs.perlPackages.ham;