From 85598c5fab27fb32b720f22abdd6d8274e979211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Fri, 10 Jul 2020 20:34:25 +0200 Subject: [PATCH] rocclr: init at 3.5.0 --- pkgs/development/libraries/rocclr/default.nix | 63 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 ++ 2 files changed, 67 insertions(+) create mode 100644 pkgs/development/libraries/rocclr/default.nix diff --git a/pkgs/development/libraries/rocclr/default.nix b/pkgs/development/libraries/rocclr/default.nix new file mode 100644 index 00000000000..f1917b8f2c7 --- /dev/null +++ b/pkgs/development/libraries/rocclr/default.nix @@ -0,0 +1,63 @@ +{ stdenv +, fetchFromGitHub +, cmake +, rocm-cmake +, clang +, rocm-comgr +, rocm-opencl-runtime +, rocm-runtime +, rocm-thunk +, libelf +, libglvnd +, libX11 +}: + +stdenv.mkDerivation rec { + pname = "rocclr"; + version = "3.5.0"; + + src = fetchFromGitHub { + owner = "ROCm-Developer-Tools"; + repo = "ROCclr"; + rev = "roc-${version}"; + sha256 = "0j70lxpwrdrb1v4lbcyzk7kilw62ip4py9fj149d8k3x5x6wkji1"; + }; + + nativeBuildInputs = [ cmake rocm-cmake ]; + + buildInputs = [ clang rocm-comgr rocm-runtime rocm-thunk clang ]; + + propagatedBuildInputs = [ libelf libglvnd libX11 ]; + + prePatch = '' + substituteInPlace CMakeLists.txt \ + --replace 'set(ROCCLR_EXPORTS_FILE "''${CMAKE_CURRENT_BINARY_DIR}/amdrocclr_staticTargets.cmake")' \ + 'set(ROCCLR_EXPORTS_FILE "''${CMAKE_INSTALL_LIBDIR}/cmake/amdrocclr_staticTargets.cmake")' \ + --replace 'set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ''${CMAKE_CURRENT_BINARY_DIR}/lib)' \ + 'set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ''${CMAKE_INSTALL_LIBDIR})' + substituteInPlace device/comgrctx.cpp \ + --replace "libamd_comgr.so" "${rocm-comgr}/lib/libamd_comgr.so" + ''; + + cmakeFlags = [ + "-DOPENCL_DIR=${rocm-opencl-runtime.src}" + ]; + + preFixup = '' + mv $out/include/include/* $out/include + ln -s $out/include/compiler/lib/include/* $out/include/include + ln -s $out/include/compiler/lib/include/* $out/include + sed "s|^\([[:space:]]*IMPORTED_LOCATION_RELEASE \).*|\1 \"$out/lib/libamdrocclr_static.a\"|" -i $out/lib/cmake/amdrocclr_staticTargets.cmake + ''; + + meta = with stdenv.lib; { + description = "Radeon Open Compute common language runtime"; + homepage = "https://github.com/ROCm-Developer-Tools/ROCclr"; + license = licenses.mit; + maintainers = with maintainers; [ danieldk ]; + # rocclr seems to have some AArch64 ifdefs, but does not seem + # to be supported yet by the build infrastructure. Recheck in + # the future. + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e3e45f9bfb9..ddb06a9059d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9235,6 +9235,10 @@ in rgbds = callPackage ../development/compilers/rgbds { }; + rocclr = callPackage ../development/libraries/rocclr { + inherit (llvmPackages_rocm) clang; + }; + rocm-cmake = callPackage ../development/tools/build-managers/rocm-cmake { }; rocm-comgr = callPackage ../development/libraries/rocm-comgr {