2021-09-18 10:52:07 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2020-07-18 16:06:22 +00:00
|
|
|
, fetchFromGitHub
|
2022-12-17 10:02:37 +00:00
|
|
|
, rocmUpdateScript
|
2020-07-18 16:06:22 +00:00
|
|
|
, addOpenGLRunpath
|
|
|
|
, cmake
|
2022-10-21 18:38:19 +00:00
|
|
|
, pkg-config
|
2020-09-25 04:45:31 +00:00
|
|
|
, xxd
|
2020-07-18 16:06:22 +00:00
|
|
|
, elfutils
|
2022-10-21 18:38:19 +00:00
|
|
|
, libdrm
|
2020-09-25 04:45:31 +00:00
|
|
|
, llvm
|
2021-09-18 10:52:07 +00:00
|
|
|
, numactl
|
2020-09-25 04:45:31 +00:00
|
|
|
, rocm-device-libs
|
2020-07-18 16:06:22 +00:00
|
|
|
, rocm-thunk }:
|
|
|
|
|
2022-11-27 09:42:12 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-07-18 16:06:22 +00:00
|
|
|
pname = "rocm-runtime";
|
2022-12-17 10:02:37 +00:00
|
|
|
version = "5.4.0";
|
2020-07-18 16:06:22 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "RadeonOpenCompute";
|
|
|
|
repo = "ROCR-Runtime";
|
2022-11-27 09:42:12 +00:00
|
|
|
rev = "rocm-${finalAttrs.version}";
|
2022-12-17 10:02:37 +00:00
|
|
|
hash = "sha256-M9kv1Oe5ZZfd9H/+KUJUoK9L1EdyS2qRp2mJDK0dnPE=";
|
2020-07-18 16:06:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
sourceRoot = "source/src";
|
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
nativeBuildInputs = [ cmake pkg-config xxd ];
|
2020-07-18 16:06:22 +00:00
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
buildInputs = [ elfutils libdrm llvm numactl ];
|
2020-07-18 16:06:22 +00:00
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
cmakeFlags = [ "-DCMAKE_PREFIX_PATH=${rocm-thunk}" ];
|
2020-09-25 04:45:31 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
patchShebangs image/blit_src/create_hsaco_ascii_file.sh
|
2022-10-21 18:38:19 +00:00
|
|
|
patchShebangs core/runtime/trap_handler/create_trap_handler_header.sh
|
|
|
|
|
|
|
|
substituteInPlace CMakeLists.txt \
|
|
|
|
--replace 'hsa/include/hsa' 'include/hsa'
|
|
|
|
|
|
|
|
# We compile clang before rocm-device-libs, so patch it in afterwards
|
|
|
|
substituteInPlace image/blit_src/CMakeLists.txt \
|
|
|
|
--replace '-cl-denorms-are-zero' '-cl-denorms-are-zero --rocm-device-lib-path=${rocm-device-libs}/amdgcn/bitcode'
|
2020-07-18 16:06:22 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
fixupPhase = ''
|
2020-09-25 04:45:31 +00:00
|
|
|
rm -rf $out/hsa
|
2020-07-18 16:06:22 +00:00
|
|
|
'';
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
passthru.updateScript = rocmUpdateScript {
|
|
|
|
name = finalAttrs.pname;
|
|
|
|
owner = finalAttrs.src.owner;
|
|
|
|
repo = finalAttrs.src.repo;
|
|
|
|
};
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-07-18 16:06:22 +00:00
|
|
|
description = "Platform runtime for ROCm";
|
|
|
|
homepage = "https://github.com/RadeonOpenCompute/ROCR-Runtime";
|
|
|
|
license = with licenses; [ ncsa ];
|
2022-11-27 09:42:12 +00:00
|
|
|
maintainers = with maintainers; [ lovesegfault ] ++ teams.rocm.members;
|
2020-07-18 16:06:22 +00:00
|
|
|
};
|
2022-11-27 09:42:12 +00:00
|
|
|
})
|