2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv
|
2020-07-18 16:06:22 +00:00
|
|
|
, fetchFromGitHub
|
2022-05-18 14:49:53 +00:00
|
|
|
, fetchpatch
|
2021-09-18 10:52:07 +00:00
|
|
|
, writeScript
|
2020-07-18 16:06:22 +00:00
|
|
|
, rocm-comgr
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "rocclr";
|
2022-04-27 09:35:20 +00:00
|
|
|
version = "5.1.0";
|
2020-07-18 16:06:22 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ROCm-Developer-Tools";
|
|
|
|
repo = "ROCclr";
|
2020-09-25 04:45:31 +00:00
|
|
|
rev = "rocm-${version}";
|
2022-04-27 09:35:20 +00:00
|
|
|
hash = "sha256-SFWEGKffhuiTE7ICbkElVV5cldXu4Xbwvjb6LiNmijA=";
|
2020-07-18 16:06:22 +00:00
|
|
|
};
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
patches = [
|
|
|
|
# Enable support for gfx8 again
|
|
|
|
# See the upstream issue: https://github.com/RadeonOpenCompute/ROCm/issues/1659
|
|
|
|
# And the arch patch: https://github.com/rocm-arch/rocm-arch/pull/742
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://raw.githubusercontent.com/John-Gee/rocm-arch/d6812d308fee3caf2b6bb01b4d19fe03a6a0e3bd/rocm-opencl-runtime/enable-gfx800.patch";
|
|
|
|
hash = "sha256-59jFDIIsTTZcNns9RyMVWPRUggn/bSlAGrky4quu8B4=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2020-07-18 16:06:22 +00:00
|
|
|
prePatch = ''
|
|
|
|
substituteInPlace device/comgrctx.cpp \
|
|
|
|
--replace "libamd_comgr.so" "${rocm-comgr}/lib/libamd_comgr.so"
|
|
|
|
'';
|
|
|
|
|
2021-12-24 04:21:11 +00:00
|
|
|
buildPhase = "";
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
2020-07-18 16:06:22 +00:00
|
|
|
|
2021-12-24 04:21:11 +00:00
|
|
|
mkdir -p $out
|
|
|
|
cp -r * $out/
|
2020-11-06 00:33:48 +00:00
|
|
|
|
2021-12-24 04:21:11 +00:00
|
|
|
runHook postInstall
|
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/ROCm-Developer-Tools/ROCclr/tags" | jq '.[].name | split("-") | .[1] | select( . != null )' --raw-output | sort -n | tail -1)"
|
|
|
|
update-source-version rocclr "$version"
|
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2021-12-24 04:21:11 +00:00
|
|
|
description = "Source package of the Radeon Open Compute common language runtime";
|
2020-07-18 16:06:22 +00:00
|
|
|
homepage = "https://github.com/ROCm-Developer-Tools/ROCclr";
|
|
|
|
license = licenses.mit;
|
2021-09-18 10:52:07 +00:00
|
|
|
maintainers = with maintainers; [ lovesegfault ];
|
2020-07-18 16:06:22 +00:00
|
|
|
# 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" ];
|
|
|
|
};
|
|
|
|
}
|