Merge pull request #95489 from danieldk/rocm-3.7.0

Update ROCm to 3.7.0
This commit is contained in:
Daniël de Kok 2020-08-22 13:30:01 +02:00 committed by GitHub
commit 280147c510
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 56 additions and 152 deletions

View file

@ -70,35 +70,12 @@ Platform Vendor Advanced Micro Devices, Inc.</screen>
Core Next</link> (GCN) GPUs are supported through the
<package>rocm-opencl-icd</package> package. Adding this package to
<xref linkend="opt-hardware.opengl.extraPackages"/> enables OpenCL
support. However, OpenCL Image support is provided through the
non-free <package>rocm-runtime-ext</package> package. This package can
be added to the same configuration option, but requires that
<varname>allowUnfree</varname> option is is enabled for nixpkgs. Full
OpenCL support on supported AMD GPUs is thus enabled as follows:
support:
<programlisting><xref linkend="opt-hardware.opengl.extraPackages"/> = [
rocm-opencl-icd
rocm-runtime-ext
];</programlisting>
</para>
<para>
It is also possible to use the OpenCL Image extension without a
system-wide installation of the <package>rocm-runtime-ext</package>
package by setting the <varname>ROCR_EXT_DIR</varname> environment
variable to the directory that contains the extension:
<screen><prompt>$</prompt> export \
ROCR_EXT_DIR=`nix-build '&lt;nixpkgs&gt;' --no-out-link -A rocm-runtime-ext`/lib/rocm-runtime-ext</screen>
</para>
<para>
With either approach, you can verify that OpenCL Image support
is indeed working with the <command>clinfo</command> command:
<screen><prompt>$</prompt> clinfo | grep Image
Image support Yes</screen>
</para>
</section>
<section xml:id="sec-gpu-accel-opencl-intel">

View file

@ -4,7 +4,6 @@
, python
, llvm
, clang-tools-extra_src ? null
, rocm-runtime
, lld
, version
@ -18,7 +17,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ cmake python ];
buildInputs = [ llvm rocm-runtime ];
buildInputs = [ llvm ];
hardeningDisable = [ "all" ];

View file

@ -1,12 +1,12 @@
{ stdenv, fetchFromGitHub, callPackage, wrapCCWith }:
let
version = "3.5.1";
version = "3.7.0";
src = fetchFromGitHub {
owner = "RadeonOpenCompute";
repo = "llvm-project";
rev = "rocm-${version}";
sha256 = "03k2xp8wf4awf1zcjc2hb3kf9bqp567c3s569gp1q3q1zjg6r2ib";
sha256 = "02p0s041wwsi4q0dhs1sj5l6059y02s31az505h0f22agz3jnpfn";
};
in rec {
clang = wrapCCWith rec {

View file

@ -10,24 +10,25 @@
, libelf
, libglvnd
, libX11
, numactl
}:
stdenv.mkDerivation rec {
pname = "rocclr";
version = "3.5.0";
version = "3.7.0";
src = fetchFromGitHub {
owner = "ROCm-Developer-Tools";
repo = "ROCclr";
rev = "roc-${version}";
sha256 = "0j70lxpwrdrb1v4lbcyzk7kilw62ip4py9fj149d8k3x5x6wkji1";
rev = "rocm-${version}";
sha256 = "0sx4irbmjgs5bm8dc8jc9fl1jmfdnrp3ar14hdhrsmbani7gqah3";
};
nativeBuildInputs = [ cmake rocm-cmake ];
buildInputs = [ clang rocm-comgr rocm-runtime rocm-thunk ];
propagatedBuildInputs = [ libelf libglvnd libX11 ];
propagatedBuildInputs = [ libelf libglvnd libX11 numactl ];
prePatch = ''
substituteInPlace CMakeLists.txt \
@ -45,10 +46,9 @@ stdenv.mkDerivation rec {
];
preFixup = ''
mv $out/include/include/* $out/include
ln -s $out/include/compiler/lib/include/* $out/include/include
ln -s $out/include/compiler/lib/include/* $out/include
sed "s|^\([[:space:]]*IMPORTED_LOCATION_RELEASE \).*|\1 \"$out/lib/libamdrocclr_static.a\"|" -i $out/lib/cmake/amdrocclr_staticTargets.cmake
substituteInPlace $out/lib/cmake/rocclr/ROCclrConfig.cmake \
--replace "/build/source/build" "$out"
'';
meta = with stdenv.lib; {

View file

@ -2,13 +2,13 @@
stdenv.mkDerivation rec {
pname = "rocm-comgr";
version = "3.5.0";
version = "3.7.0";
src = fetchFromGitHub {
owner = "RadeonOpenCompute";
repo = "ROCm-CompilerSupport";
rev = "rocm-${version}";
sha256 = "0h9bxz98sskgzc3xpnp469iq1wi59nbijbqprlylha91y10hqb88";
sha256 = "1r7arfdqfh6pfvjza6x2dzd5gjmkndngrp688d3n2ab92n5ijiqf";
};
sourceRoot = "source/lib/comgr";

View file

@ -5,23 +5,22 @@
, clang-unwrapped
, lld
, llvm
, rocm-runtime
}:
stdenv.mkDerivation rec {
pname = "rocm-device-libs";
version = "3.5.1";
version = "3.7.0";
src = fetchFromGitHub {
owner = "RadeonOpenCompute";
repo = "ROCm-Device-Libs";
rev = "rocm-${version}";
sha256 = "180bx05l293hrhzk2ymx41j5lhskysywvx33igbbsngzailwsc22";
sha256 = "1sg7wzj2mi5vhba53cp52gnya7c799f0p325ig262vi70r7mr7n2";
};
nativeBuildInputs = [ cmake ];
buildInputs = [ clang lld llvm rocm-runtime ];
buildInputs = [ clang lld llvm ];
cmakeBuildType = "Release";

View file

@ -2,7 +2,7 @@
stdenv.mkDerivation rec {
pname = "rocm-opencl-icd";
version = "3.5.0";
version = rocm-opencl-runtime.version;
dontUnpack = true;

View file

@ -5,7 +5,8 @@
, rocm-cmake
, clang
, clang-unwrapped
, libGLU
, glew
, libglvnd
, libX11
, lld
, llvm
@ -18,20 +19,15 @@
, rocm-thunk
}:
let
version = "3.5.0";
tag = "roc-${version}";
in stdenv.mkDerivation rec {
inherit version;
stdenv.mkDerivation rec {
pname = "rocm-opencl-runtime";
version = "3.7.0";
src = fetchFromGitHub {
owner = "RadeonOpenCompute";
repo = "ROCm-OpenCL-Runtime";
rev = tag;
sha256 = "1wrr6mmn4gf6i0vxp4yqk0ny2wglvj1jfj50il8czjwy0cwmhykk";
name = "ROCm-OpenCL-Runtime-${tag}-src";
rev = "rocm-${version}";
sha256 = "15rz11a8qwvxmd0kkaikj04q1glfg9sgqqblcqp3iahr3by8z0wd";
};
nativeBuildInputs = [ cmake rocm-cmake ];
@ -39,7 +35,8 @@ in stdenv.mkDerivation rec {
buildInputs = [
clang
clang-unwrapped
libGLU
glew
libglvnd
libX11
lld
llvm
@ -63,6 +60,12 @@ in stdenv.mkDerivation rec {
dontStrip = true;
# Remove clinfo, which is already provided through the
# `clinfo` package.
postInstall = ''
rm -rf $out/bin
'';
# Fix the ICD installation path for NixOS
postPatch = ''
substituteInPlace khronos/icd/loader/linux/icd_linux.c \
@ -70,10 +73,6 @@ in stdenv.mkDerivation rec {
echo 'add_dependencies(amdocl64 OpenCL)' >> amdocl/CMakeLists.txt
'';
preFixup = ''
patchelf --set-rpath "$out/lib" $out/bin/clinfo
'';
meta = with stdenv.lib; {
description = "OpenCL runtime for AMD GPUs, part of the ROCm stack";
homepage = "https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime";

View file

@ -1,42 +0,0 @@
{ stdenv, fetchurl, autoPatchelfHook, rpmextract, rocm-runtime }:
stdenv.mkDerivation rec {
pname = "rocm-runtime-ext";
version = "3.5.1";
src = fetchurl {
url = "https://repo.radeon.com/rocm/yum/3.5.1/hsa-ext-rocr-dev-1.1.30501.0-rocm-rel-3.5-34-def83d8a-Linux.rpm";
sha256 = "0r7lrmnplr10hs6wrji55i3dnczfzlmp8jahm1g3mhq2x12zmly0";
};
nativeBuildInputs = [ autoPatchelfHook rpmextract ];
buildInputs = [ rocm-runtime stdenv.cc.cc ];
unpackPhase = "rpmextract ${src}";
installPhase = ''
mkdir -p $out/lib
cp -R opt/rocm-${version}/hsa/lib $out/lib/rocm-runtime-ext
'';
setupHook = ./setup-hook.sh;
meta = with stdenv.lib; {
description = "Platform runtime for ROCm (closed-source extensions)";
longDescription = ''
This package provides closed-source extensions to the ROCm
runtime. Currently this adds support for OpenCL image
processing.
In order for the ROCm runtime to pick up the extension, you
should either set the ROCR_EXT_DIR environment variable should
be set to ''${rocm-runtime-ext}/lib/rocm-runtime-ext or this
package should be added to the hardware.opengl.extraPackages
NixOS configuration option.
'';
homepage = "https://github.com/RadeonOpenCompute/ROCR-Runtime";
license = with licenses; [ unfreeRedistributable ];
maintainers = with maintainers; [ danieldk ];
};
}

View file

@ -1,7 +0,0 @@
addRocmRuntimeExtDir () {
if [[ -z "${ROCR_EXT_DIR-}" ]]; then
export ROCR_EXT_DIR="@out@/lib/rocm-runtime-ext"
fi
}
addEnvHooks "$hostOffset" addRocmRuntimeExtDir

View file

@ -1,41 +1,42 @@
{ stdenv
, fetchFromGitHub
, addOpenGLRunpath
, clang-unwrapped
, cmake
, xxd
, elfutils
, llvm
, rocm-device-libs
, rocm-thunk }:
stdenv.mkDerivation rec {
pname = "rocm-runtime";
version = "3.5.0";
version = "3.7.0";
src = fetchFromGitHub {
owner = "RadeonOpenCompute";
repo = "ROCR-Runtime";
rev = "rocm-${version}";
sha256 = "028x1f0if6lw41cpfpysp82ikp6c3fdxxd2a6ixs0vpm4424svb1";
sha256 = "1lm4cbx1d727zll85vjc1kykc72mk82nfhyyhjljv82gd4mnz00c";
};
sourceRoot = "source/src";
buildInputs = [ cmake elfutils ];
nativeBuildInputs = [ cmake xxd ];
cmakeFlags = [ "-DCMAKE_PREFIX_PATH=${rocm-thunk}" ];
buildInputs = [ clang-unwrapped elfutils llvm ];
# Use the ROCR_EXT_DIR environment variable and/or OpenGL driver
# link path to try to find binary-only ROCm runtime extension
# libraries. Without this change, we would have to rely on
# LD_LIBRARY_PATH to let the HSA runtime discover the shared
# libraries.
patchPhase = ''
substitute '${./rocr-ext-dir.diff}' ./rocr-ext-dir.diff \
--subst-var-by rocrExtDir "${addOpenGLRunpath.driverLink}/lib/rocm-runtime-ext"
patch -p2 < ./rocr-ext-dir.diff
cmakeFlags = [
"-DBITCODE_DIR=${rocm-device-libs}/lib"
"-DCMAKE_PREFIX_PATH=${rocm-thunk}"
];
postPatch = ''
patchShebangs image/blit_src/create_hsaco_ascii_file.sh
'';
fixupPhase = ''
rm -r $out/lib $out/include
mv $out/hsa/lib $out/hsa/include $out
rm -rf $out/hsa
'';
meta = with stdenv.lib; {

View file

@ -1,23 +0,0 @@
diff --git a/src/core/runtime/runtime.cpp b/src/core/runtime/runtime.cpp
index dd6a15c..fb6de49 100644
--- a/src/core/runtime/runtime.cpp
+++ b/src/core/runtime/runtime.cpp
@@ -1358,7 +1358,17 @@ void Runtime::LoadExtensions() {
core::HsaApiTable::HSA_EXT_FINALIZER_API_TABLE_ID);
// Update Hsa Api Table with handle of Image extension Apis
- extensions_.LoadImage(kImageLib[os_index(os::current_os)]);
+ //
+ // Use ROCR_EXT_DIR when it is non-empty. Otherwise, try to load the
+ // library from the OpenGL driver path.
+ std::string extDirVar = os::GetEnvVar("ROCR_EXT_DIR");
+ if (!extDirVar.empty()) {
+ extensions_.LoadImage(extDirVar + "/" + kImageLib[os_index(os::current_os)]);
+ } else {
+ std::string globalDriverDir("@rocrExtDir@");
+ extensions_.LoadImage(globalDriverDir + "/" + kImageLib[os_index(os::current_os)]);
+ }
+
hsa_api_table_.LinkExts(&extensions_.image_api,
core::HsaApiTable::HSA_EXT_IMAGE_API_TABLE_ID);
}

View file

@ -7,13 +7,13 @@
stdenv.mkDerivation rec {
pname = "rocm-thunk";
version = "3.5.0";
version = "3.7.0";
src = fetchFromGitHub {
owner = "RadeonOpenCompute";
repo = "ROCT-Thunk-Interface";
rev = "rocm-${version}";
sha256 = "0xn1z0xc3phjc9vabwxgph5any4ffhc8wgs5yb15m5wpg87l8x1z";
sha256 = "05963lxip3175g4b7k45r94yayp9gcwl3fpma9g5mdkbrlbvwlvz";
};
preConfigure = ''

View file

@ -2,7 +2,7 @@
stdenv.mkDerivation rec {
pname = "rocm-cmake";
version = "3.5.0";
version = "3.7.0";
src = fetchFromGitHub {
owner = "RadeonOpenCompute";

View file

@ -2,13 +2,13 @@
buildPythonApplication rec {
pname = "rocm-smi";
version = "3.5.0";
version = "3.7.0";
src = fetchFromGitHub {
owner = "RadeonOpenCompute";
repo = "ROC-smi";
rev = "rocm-${version}";
sha256 = "189mpvmcv46nfwshyc1wla6k71kbraldik5an20g4v9s13ycrpx9";
sha256 = "00g9cbni73x9da05lx7hiffp303mdkj1wpxiavfylr4q4z84yhrz";
};
format = "other";

View file

@ -465,6 +465,7 @@ mapAliases ({
rhc = throw "deprecated in 2019-04-09: abandoned by upstream.";
rng_tools = rng-tools; # added 2018-10-24
robomongo = robo3t; #added 2017-09-28
rocm-runtime-ext = throw "rocm-runtime-ext has been removed, since its functionality was added to rocm-runtime"; #added 2020-08-21
rssglx = rss-glx; #added 2015-03-25
recordmydesktop = throw "recordmydesktop has been removed from nixpkgs, as it's unmaintained and uses deprecated libraries"; # added 2019-12-10
gtk-recordmydesktop = throw "gtk-recordmydesktop has been removed from nixpkgs, as it's unmaintained and uses deprecated libraries"; # added 2019-12-10

View file

@ -9411,9 +9411,9 @@ in
inherit (llvmPackages_rocm) clang clang-unwrapped lld llvm;
};
rocm-runtime = callPackage ../development/libraries/rocm-runtime { };
rocm-runtime-ext = callPackage ../development/libraries/rocm-runtime-ext { };
rocm-runtime = callPackage ../development/libraries/rocm-runtime {
inherit (llvmPackages_rocm) clang-unwrapped llvm;
};
# Python >= 3.8 still gives a bunch of warnings.
rocm-smi = python37.pkgs.callPackage ../tools/system/rocm-smi { };