2020-07-10 20:34:25 +02:00
|
|
|
{ stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, rocm-cmake
|
|
|
|
, clang
|
|
|
|
, rocm-comgr
|
|
|
|
, rocm-opencl-runtime
|
|
|
|
, rocm-runtime
|
|
|
|
, rocm-thunk
|
|
|
|
, libelf
|
|
|
|
, libglvnd
|
|
|
|
, libX11
|
2020-08-21 08:38:43 +02:00
|
|
|
, numactl
|
2020-07-10 20:34:25 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "rocclr";
|
2020-09-19 08:10:17 +02:00
|
|
|
version = "3.8.0";
|
2020-07-10 20:34:25 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ROCm-Developer-Tools";
|
|
|
|
repo = "ROCclr";
|
2020-08-21 08:38:43 +02:00
|
|
|
rev = "rocm-${version}";
|
2020-09-19 08:10:17 +02:00
|
|
|
sha256 = "05vh70qh6jb7038b1rcmz24bg4an0nw98bv2vn3jcyygj4dr3fmf";
|
2020-07-10 20:34:25 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake rocm-cmake ];
|
|
|
|
|
2020-08-07 16:49:18 +02:00
|
|
|
buildInputs = [ clang rocm-comgr rocm-runtime rocm-thunk ];
|
2020-07-10 20:34:25 +02:00
|
|
|
|
2020-08-21 08:38:43 +02:00
|
|
|
propagatedBuildInputs = [ libelf libglvnd libX11 numactl ];
|
2020-07-10 20:34:25 +02:00
|
|
|
|
|
|
|
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)' \
|
2020-08-07 16:49:18 +02:00
|
|
|
'set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ''${CMAKE_INSTALL_LIBDIR})' \
|
|
|
|
--replace 'find_library( OpenCL REQUIRED' 'find_library( OpenCL'
|
2020-07-10 20:34:25 +02:00
|
|
|
substituteInPlace device/comgrctx.cpp \
|
|
|
|
--replace "libamd_comgr.so" "${rocm-comgr}/lib/libamd_comgr.so"
|
|
|
|
'';
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DOPENCL_DIR=${rocm-opencl-runtime.src}"
|
|
|
|
];
|
|
|
|
|
|
|
|
preFixup = ''
|
|
|
|
ln -s $out/include/compiler/lib/include/* $out/include
|
2020-08-21 08:38:43 +02:00
|
|
|
substituteInPlace $out/lib/cmake/rocclr/ROCclrConfig.cmake \
|
|
|
|
--replace "/build/source/build" "$out"
|
2020-07-10 20:34:25 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
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" ];
|
|
|
|
};
|
|
|
|
}
|