2023-01-20 10:41:00 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-07-18 16:06:22 +00:00
|
|
|
, fetchFromGitHub
|
2022-12-17 10:02:37 +00:00
|
|
|
, rocmUpdateScript
|
2022-10-21 18:38:19 +00:00
|
|
|
, pkg-config
|
2023-01-20 10:41:00 +00:00
|
|
|
, cmake
|
2020-09-25 04:45:31 +00:00
|
|
|
, xxd
|
2023-01-20 10:41:00 +00:00
|
|
|
, rocm-device-libs
|
|
|
|
, rocm-thunk
|
2024-06-05 15:53:02 +00:00
|
|
|
, elfutils
|
2022-10-21 18:38:19 +00:00
|
|
|
, libdrm
|
2021-09-18 10:52:07 +00:00
|
|
|
, numactl
|
2023-01-20 10:41:00 +00:00
|
|
|
, valgrind
|
|
|
|
, libxml2
|
|
|
|
}:
|
2020-07-18 16:06:22 +00:00
|
|
|
|
2022-11-27 09:42:12 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-07-18 16:06:22 +00:00
|
|
|
pname = "rocm-runtime";
|
2023-11-16 04:20:00 +00:00
|
|
|
version = "5.7.1";
|
2020-07-18 16:06:22 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2024-01-02 11:29:13 +00:00
|
|
|
owner = "ROCm";
|
2020-07-18 16:06:22 +00:00
|
|
|
repo = "ROCR-Runtime";
|
2022-11-27 09:42:12 +00:00
|
|
|
rev = "rocm-${finalAttrs.version}";
|
2023-10-19 13:55:26 +00:00
|
|
|
hash = "sha256-D7Ahan5cxDhqPtV5iDDNys0A4FlxQ9oVRa2EeMoY5Qk=";
|
2020-07-18 16:06:22 +00:00
|
|
|
};
|
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
sourceRoot = "${finalAttrs.src.name}/src";
|
2020-07-18 16:06:22 +00:00
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
cmake
|
|
|
|
xxd
|
|
|
|
];
|
2020-07-18 16:06:22 +00:00
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
buildInputs = [
|
|
|
|
rocm-thunk
|
2024-06-05 15:53:02 +00:00
|
|
|
elfutils
|
2023-01-20 10:41:00 +00:00
|
|
|
libdrm
|
|
|
|
numactl
|
|
|
|
valgrind
|
|
|
|
libxml2
|
|
|
|
];
|
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
|
2024-01-02 11:29:13 +00:00
|
|
|
# Replace object version: https://github.com/ROCm/ROCR-Runtime/issues/166 (TODO: Remove on LLVM update?)
|
2022-10-21 18:38:19 +00:00
|
|
|
substituteInPlace image/blit_src/CMakeLists.txt \
|
2023-10-19 13:55:26 +00:00
|
|
|
--replace '-cl-denorms-are-zero' '-cl-denorms-are-zero --rocm-device-lib-path=${rocm-device-libs}/amdgcn/bitcode' \
|
|
|
|
--replace '-mcode-object-version=4' '-mcode-object-version=5'
|
2020-07-18 16:06:22 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
fixupPhase = ''
|
2023-01-20 10:41:00 +00:00
|
|
|
rm -rf $out/hsa/*
|
|
|
|
ln -s $out/{include,lib} $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";
|
2024-01-02 11:29:13 +00:00
|
|
|
homepage = "https://github.com/ROCm/ROCR-Runtime";
|
2020-07-18 16:06:22 +00:00
|
|
|
license = with licenses; [ ncsa ];
|
2022-11-27 09:42:12 +00:00
|
|
|
maintainers = with maintainers; [ lovesegfault ] ++ teams.rocm.members;
|
2023-01-20 10:41:00 +00:00
|
|
|
platforms = platforms.linux;
|
2024-01-02 11:29:13 +00:00
|
|
|
broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version || versionAtLeast finalAttrs.version "6.0.0";
|
2020-07-18 16:06:22 +00:00
|
|
|
};
|
2022-11-27 09:42:12 +00:00
|
|
|
})
|