nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, stdenv
3, fetchFromGitHub
4, fetchpatch
5, rocmUpdateScript
6, rocm-comgr
7}:
8
9stdenv.mkDerivation (finalAttrs: {
10 pname = "rocclr";
11 version = "5.4.4";
12
13 src = fetchFromGitHub {
14 owner = "ROCm-Developer-Tools";
15 repo = "ROCclr";
16 rev = "rocm-${finalAttrs.version}";
17 hash = "sha256-DbN7kL8oyaPeYQB19Q96L3wX66v62TMSWl0Yor7Q4kE=";
18 };
19
20 patches = [
21 # Enable support for gfx8 again
22 # See the upstream issue: https://github.com/RadeonOpenCompute/ROCm/issues/1659
23 # And the arch patch: https://github.com/rocm-arch/rocm-arch/pull/742
24 (fetchpatch {
25 url = "https://raw.githubusercontent.com/John-Gee/rocm-arch/d6812d308fee3caf2b6bb01b4d19fe03a6a0e3bd/rocm-opencl-runtime/enable-gfx800.patch";
26 hash = "sha256-59jFDIIsTTZcNns9RyMVWPRUggn/bSlAGrky4quu8B4=";
27 })
28 ];
29
30 postPatch = ''
31 substituteInPlace device/comgrctx.cpp \
32 --replace "libamd_comgr.so" "${rocm-comgr}/lib/libamd_comgr.so"
33 '';
34
35 dontConfigure = true;
36 dontBuild = true;
37
38 installPhase = ''
39 runHook preInstall
40
41 mkdir -p $out
42 cp -a * $out/
43
44 runHook postInstall
45 '';
46
47 passthru.updateScript = rocmUpdateScript {
48 name = finalAttrs.pname;
49 owner = finalAttrs.src.owner;
50 repo = finalAttrs.src.repo;
51 };
52
53 meta = with lib; {
54 description = "Source package of the Radeon Open Compute common language runtime";
55 homepage = "https://github.com/ROCm-Developer-Tools/ROCclr";
56 license = licenses.mit;
57 maintainers = with maintainers; [ lovesegfault ] ++ teams.rocm.members;
58 # rocclr seems to have some AArch64 ifdefs, but does not seem
59 # to be supported yet by the build infrastructure. Recheck in
60 # the future.
61 platforms = [ "x86_64-linux" ];
62 broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version;
63 };
64})