1{ lib
2, stdenv
3, fetchFromGitHub
4, rocmUpdateScript
5, pkg-config
6, cmake
7, xxd
8, rocm-device-libs
9, rocm-thunk
10, libelf
11, libdrm
12, numactl
13, valgrind
14, libxml2
15}:
16
17stdenv.mkDerivation (finalAttrs: {
18 pname = "rocm-runtime";
19 version = "5.4.3";
20
21 src = fetchFromGitHub {
22 owner = "RadeonOpenCompute";
23 repo = "ROCR-Runtime";
24 rev = "rocm-${finalAttrs.version}";
25 hash = "sha256-JkTXTQmdESHSFbA6HZdMK3pYEApz9aoAlMzdXayzdyY=";
26 };
27
28 sourceRoot = "${finalAttrs.src.name}/src";
29
30 nativeBuildInputs = [
31 pkg-config
32 cmake
33 xxd
34 ];
35
36 buildInputs = [
37 rocm-thunk
38 libelf
39 libdrm
40 numactl
41 valgrind
42 libxml2
43 ];
44
45 postPatch = ''
46 patchShebangs image/blit_src/create_hsaco_ascii_file.sh
47 patchShebangs core/runtime/trap_handler/create_trap_handler_header.sh
48
49 substituteInPlace CMakeLists.txt \
50 --replace 'hsa/include/hsa' 'include/hsa'
51
52 # We compile clang before rocm-device-libs, so patch it in afterwards
53 substituteInPlace image/blit_src/CMakeLists.txt \
54 --replace '-cl-denorms-are-zero' '-cl-denorms-are-zero --rocm-device-lib-path=${rocm-device-libs}/amdgcn/bitcode'
55 '';
56
57 fixupPhase = ''
58 rm -rf $out/hsa/*
59 ln -s $out/{include,lib} $out/hsa
60 '';
61
62 passthru.updateScript = rocmUpdateScript {
63 name = finalAttrs.pname;
64 owner = finalAttrs.src.owner;
65 repo = finalAttrs.src.repo;
66 };
67
68 meta = with lib; {
69 description = "Platform runtime for ROCm";
70 homepage = "https://github.com/RadeonOpenCompute/ROCR-Runtime";
71 license = with licenses; [ ncsa ];
72 maintainers = with maintainers; [ lovesegfault ] ++ teams.rocm.members;
73 platforms = platforms.linux;
74 broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version;
75 };
76})