2021-09-18 10:52:07 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2020-07-18 16:06:22 +00:00
|
|
|
, fetchFromGitHub
|
2021-09-18 10:52:07 +00:00
|
|
|
, writeScript
|
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-11-27 09:42:12 +00:00
|
|
|
version = "5.3.3";
|
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-10-21 18:38:19 +00:00
|
|
|
hash = "sha256-26E7vA2JlC50zmpaQfDrFMlgjAqmfTdp9/A8g5caDqI=";
|
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
|
|
|
'';
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
passthru.updateScript = writeScript "update.sh" ''
|
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i bash -p curl jq common-updater-scripts
|
|
|
|
version="$(curl -sL "https://api.github.com/repos/RadeonOpenCompute/ROCR-Runtime/releases?per_page=1" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)"
|
2022-11-27 09:42:12 +00:00
|
|
|
update-source-version rocm-runtime "$version" --ignore-same-hash
|
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
|
|
|
})
|