nixpkgs-suyu/pkgs/development/libraries/rocm-runtime/default.nix
Sebastian Neubauer ec590fdd24 llvmPackages_rocm: compile as one derivation
This is the supported way rocm is tested.
It makes packaging in nix a *lot* easier (see the code size).

An important change is the dontLink detection in the clang/clang++
wrapper script: When compiling with --cuda-device-only,
the linker must not be set, otherwise e.g. the blender kernels fail to
compile.
2022-08-16 19:20:55 +02:00

57 lines
1.3 KiB
Nix

{ stdenv
, lib
, fetchFromGitHub
, writeScript
, addOpenGLRunpath
, cmake
, xxd
, elfutils
, llvm
, numactl
, rocm-device-libs
, rocm-thunk }:
stdenv.mkDerivation rec {
pname = "rocm-runtime";
version = "5.2.0";
src = fetchFromGitHub {
owner = "RadeonOpenCompute";
repo = "ROCR-Runtime";
rev = "rocm-${version}";
hash = "sha256-TY0YPgNzxBLXAj7fncLQ01cSJyydveOLHrimCmLS32o=";
};
sourceRoot = "source/src";
nativeBuildInputs = [ cmake xxd ];
buildInputs = [ elfutils llvm numactl ];
cmakeFlags = [
"-DBITCODE_DIR=${rocm-device-libs}/amdgcn/bitcode"
"-DCMAKE_PREFIX_PATH=${rocm-thunk}"
];
postPatch = ''
patchShebangs image/blit_src/create_hsaco_ascii_file.sh
'';
fixupPhase = ''
rm -rf $out/hsa
'';
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"
'';
meta = with lib; {
description = "Platform runtime for ROCm";
homepage = "https://github.com/RadeonOpenCompute/ROCR-Runtime";
license = with licenses; [ ncsa ];
maintainers = with maintainers; [ lovesegfault ];
};
}