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
|
2020-09-25 04:45:31 +00:00
|
|
|
, clang-unwrapped
|
2020-07-18 16:06:22 +00:00
|
|
|
, cmake
|
2020-09-25 04:45:31 +00:00
|
|
|
, xxd
|
2020-07-18 16:06:22 +00:00
|
|
|
, elfutils
|
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 }:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "rocm-runtime";
|
2021-12-24 04:21:11 +00:00
|
|
|
version = "4.5.2";
|
2020-07-18 16:06:22 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "RadeonOpenCompute";
|
|
|
|
repo = "ROCR-Runtime";
|
|
|
|
rev = "rocm-${version}";
|
2021-12-24 04:21:11 +00:00
|
|
|
hash = "sha256-DJDlEHnXhegcenO8BIY/8GnZdHldVs0GFLrQy4Z6heY=";
|
2020-07-18 16:06:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
sourceRoot = "source/src";
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
nativeBuildInputs = [ cmake xxd ];
|
2020-07-18 16:06:22 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
buildInputs = [ clang-unwrapped elfutils llvm numactl ];
|
2020-07-18 16:06:22 +00:00
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
cmakeFlags = [
|
2020-11-06 00:33:48 +00:00
|
|
|
"-DBITCODE_DIR=${rocm-device-libs}/amdgcn/bitcode"
|
2020-09-25 04:45:31 +00:00
|
|
|
"-DCMAKE_PREFIX_PATH=${rocm-thunk}"
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
patchShebangs image/blit_src/create_hsaco_ascii_file.sh
|
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)"
|
|
|
|
update-source-version rocm-runtime "$version"
|
|
|
|
'';
|
|
|
|
|
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 ];
|
2021-09-18 10:52:07 +00:00
|
|
|
maintainers = with maintainers; [ lovesegfault ];
|
2020-07-18 16:06:22 +00:00
|
|
|
};
|
|
|
|
}
|