2021-01-21 17:00:13 +00:00
|
|
|
{ lib, stdenv
|
2020-07-10 19:13:02 +01:00
|
|
|
, fetchFromGitHub
|
|
|
|
, addOpenGLRunpath
|
|
|
|
, cmake
|
|
|
|
, rocm-cmake
|
|
|
|
, clang
|
|
|
|
, clang-unwrapped
|
2020-08-21 07:41:17 +01:00
|
|
|
, glew
|
|
|
|
, libglvnd
|
2020-07-10 19:13:02 +01:00
|
|
|
, libX11
|
|
|
|
, lld
|
|
|
|
, llvm
|
|
|
|
, mesa
|
|
|
|
, python2
|
|
|
|
, rocclr
|
|
|
|
, rocm-comgr
|
|
|
|
, rocm-device-libs
|
|
|
|
, rocm-runtime
|
|
|
|
, rocm-thunk
|
|
|
|
}:
|
|
|
|
|
2020-08-21 07:41:17 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2020-07-10 19:13:02 +01:00
|
|
|
pname = "rocm-opencl-runtime";
|
2021-03-24 07:58:42 +00:00
|
|
|
version = "4.1.0";
|
2020-07-10 19:13:02 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "RadeonOpenCompute";
|
|
|
|
repo = "ROCm-OpenCL-Runtime";
|
2020-08-21 07:41:17 +01:00
|
|
|
rev = "rocm-${version}";
|
2021-03-24 07:58:42 +00:00
|
|
|
hash = "sha256-+6h1E5uWNKjjaeO5ZIi854CWYi0QGQ5mVUHdi9+4vX4=";
|
2020-07-10 19:13:02 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake rocm-cmake ];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
clang
|
|
|
|
clang-unwrapped
|
2020-08-21 07:41:17 +01:00
|
|
|
glew
|
|
|
|
libglvnd
|
2020-07-10 19:13:02 +01:00
|
|
|
libX11
|
|
|
|
lld
|
|
|
|
llvm
|
|
|
|
mesa
|
|
|
|
python2
|
|
|
|
rocclr
|
|
|
|
rocm-comgr
|
|
|
|
rocm-device-libs
|
|
|
|
rocm-runtime
|
|
|
|
rocm-thunk
|
|
|
|
];
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DAMDGPU_TARGET_TRIPLE='amdgcn-amd-amdhsa'"
|
|
|
|
"-DCLANG_OPTIONS_APPEND=-Wno-bitwise-conditional-parentheses"
|
|
|
|
"-DClang_DIR=${clang-unwrapped}/lib/cmake/clang"
|
|
|
|
"-DLIBROCclr_STATIC_DIR=${rocclr}/lib/cmake"
|
|
|
|
"-DLLVM_DIR=${llvm.out}/lib/cmake/llvm"
|
|
|
|
"-DUSE_COMGR_LIBRARY='yes'"
|
|
|
|
];
|
|
|
|
|
|
|
|
dontStrip = true;
|
|
|
|
|
2020-08-21 13:33:26 +01:00
|
|
|
# Remove clinfo, which is already provided through the
|
|
|
|
# `clinfo` package.
|
|
|
|
postInstall = ''
|
|
|
|
rm -rf $out/bin
|
|
|
|
'';
|
|
|
|
|
2020-07-10 19:13:02 +01:00
|
|
|
# Fix the ICD installation path for NixOS
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace khronos/icd/loader/linux/icd_linux.c \
|
|
|
|
--replace 'ICD_VENDOR_PATH' '"${addOpenGLRunpath.driverLink}/etc/OpenCL/vendors/"'
|
|
|
|
echo 'add_dependencies(amdocl64 OpenCL)' >> amdocl/CMakeLists.txt
|
|
|
|
'';
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2020-07-10 19:13:02 +01:00
|
|
|
description = "OpenCL runtime for AMD GPUs, part of the ROCm stack";
|
|
|
|
homepage = "https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime";
|
|
|
|
license = with licenses; [ asl20 mit ];
|
|
|
|
maintainers = with maintainers; [ danieldk ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|