From 52e1574f251cafac2c8520bf48db6353178b0f12 Mon Sep 17 00:00:00 2001 From: Sebastian Neubauer Date: Wed, 8 Sep 2021 15:04:31 +0200 Subject: [PATCH 01/11] rocm-smi: add update script and fix url --- pkgs/tools/system/rocm-smi/default.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/system/rocm-smi/default.nix b/pkgs/tools/system/rocm-smi/default.nix index bbee315e9c70..52b75b7a4e9e 100644 --- a/pkgs/tools/system/rocm-smi/default.nix +++ b/pkgs/tools/system/rocm-smi/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub, cmake, wrapPython }: +{ lib, stdenv, fetchFromGitHub, writeScript, cmake, wrapPython }: stdenv.mkDerivation rec { pname = "rocm-smi"; @@ -42,9 +42,16 @@ stdenv.mkDerivation rec { wrapPythonProgramsIn $out/bin ''; + 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/rocm_smi_lib/releases?per_page=1" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)" + update-source-version rocm-smi "$version" + ''; + meta = with lib; { description = "System management interface for AMD GPUs supported by ROCm"; - homepage = "https://github.com/RadeonOpenCompute/ROC-smi"; + homepage = "https://github.com/RadeonOpenCompute/rocm_smi_lib"; license = with licenses; [ mit ]; maintainers = with maintainers; [ lovesegfault ]; platforms = [ "x86_64-linux" ]; From f73811932b7e149babbbf157a0c29d3b81e144be Mon Sep 17 00:00:00 2001 From: Sebastian Neubauer Date: Wed, 8 Sep 2021 16:14:08 +0200 Subject: [PATCH 02/11] rocm-cmake: add update script --- .../tools/build-managers/rocm-cmake/default.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/development/tools/build-managers/rocm-cmake/default.nix b/pkgs/development/tools/build-managers/rocm-cmake/default.nix index 31f4265597fe..ad6ac4fc2e5f 100644 --- a/pkgs/development/tools/build-managers/rocm-cmake/default.nix +++ b/pkgs/development/tools/build-managers/rocm-cmake/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub, cmake }: +{ lib, stdenv, fetchFromGitHub, writeScript, cmake }: stdenv.mkDerivation rec { pname = "rocm-cmake"; @@ -13,6 +13,13 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake ]; + 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/rocm-cmake/tags" | jq '.[].name | split("-") | .[1] | select( . != null )' --raw-output | sort -n | tail -1)" + update-source-version rocm-cmake "$version" + ''; + meta = with lib; { description = "CMake modules for common build tasks for the ROCm stack"; homepage = "https://github.com/RadeonOpenCompute/rocm-cmake"; From ea2a723c00f7c3f083042aa45b967655a74ab6a3 Mon Sep 17 00:00:00 2001 From: Sebastian Neubauer Date: Wed, 8 Sep 2021 16:14:29 +0200 Subject: [PATCH 03/11] rocm-thunk: add update script --- pkgs/development/libraries/rocm-thunk/default.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/development/libraries/rocm-thunk/default.nix b/pkgs/development/libraries/rocm-thunk/default.nix index 432688e1bfb5..4d641f873021 100644 --- a/pkgs/development/libraries/rocm-thunk/default.nix +++ b/pkgs/development/libraries/rocm-thunk/default.nix @@ -1,5 +1,6 @@ { lib, stdenv , fetchFromGitHub +, writeScript , cmake , pkg-config , numactl @@ -28,6 +29,13 @@ stdenv.mkDerivation rec { cp -r $src/include $out ''; + 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/ROCT-Thunk-Interface/tags" | jq '.[].name | split("-") | .[1] | select( . != null )' --raw-output | sort -n | tail -1)" + update-source-version rocm-thunk "$version" + ''; + meta = with lib; { description = "Radeon open compute thunk interface"; homepage = "https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface"; From 315631dfe3645fd92f75de90c39932164a38ebbd Mon Sep 17 00:00:00 2001 From: Sebastian Neubauer Date: Wed, 8 Sep 2021 16:14:49 +0200 Subject: [PATCH 04/11] rocm-runtime: add update script --- pkgs/development/libraries/rocm-runtime/default.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/development/libraries/rocm-runtime/default.nix b/pkgs/development/libraries/rocm-runtime/default.nix index fc3c627a5628..ceaa164b867e 100644 --- a/pkgs/development/libraries/rocm-runtime/default.nix +++ b/pkgs/development/libraries/rocm-runtime/default.nix @@ -1,6 +1,7 @@ { stdenv , lib , fetchFromGitHub +, writeScript , addOpenGLRunpath , clang-unwrapped , cmake @@ -41,6 +42,13 @@ stdenv.mkDerivation rec { 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"; From c3aa2d2e27f365779fce182b6b70d3cd961bbb3b Mon Sep 17 00:00:00 2001 From: Sebastian Neubauer Date: Wed, 8 Sep 2021 16:14:59 +0200 Subject: [PATCH 05/11] rocm-opencl-runtime: add update script --- .../development/libraries/rocm-opencl-runtime/default.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/development/libraries/rocm-opencl-runtime/default.nix b/pkgs/development/libraries/rocm-opencl-runtime/default.nix index 04fba42525ed..d5e45583c97b 100644 --- a/pkgs/development/libraries/rocm-opencl-runtime/default.nix +++ b/pkgs/development/libraries/rocm-opencl-runtime/default.nix @@ -1,6 +1,7 @@ { stdenv , lib , fetchFromGitHub +, writeScript , addOpenGLRunpath , cmake , rocm-cmake @@ -74,6 +75,13 @@ stdenv.mkDerivation rec { echo 'add_dependencies(amdocl64 OpenCL)' >> amdocl/CMakeLists.txt ''; + 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/ROCm-OpenCL-Runtime/tags" | jq '.[].name | split("-") | .[1] | select( . != null )' --raw-output | sort -n | tail -1)" + update-source-version rocm-opencl-runtime "$version" + ''; + meta = with lib; { description = "OpenCL runtime for AMD GPUs, part of the ROCm stack"; homepage = "https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime"; From 1ab7362a4e1c3176a1a6a5fec8c0ab1c9541e767 Mon Sep 17 00:00:00 2001 From: Sebastian Neubauer Date: Wed, 8 Sep 2021 16:15:14 +0200 Subject: [PATCH 06/11] rocm-device-libs: add update script --- pkgs/development/libraries/rocm-device-libs/default.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/development/libraries/rocm-device-libs/default.nix b/pkgs/development/libraries/rocm-device-libs/default.nix index 77dd4b721f2a..e32331486569 100644 --- a/pkgs/development/libraries/rocm-device-libs/default.nix +++ b/pkgs/development/libraries/rocm-device-libs/default.nix @@ -1,5 +1,6 @@ { lib, stdenv , fetchFromGitHub +, writeScript , cmake , clang , clang-unwrapped @@ -30,6 +31,13 @@ stdenv.mkDerivation rec { "-DCLANG=${clang}/bin/clang" ]; + 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/ROCm-Device-Libs/releases?per_page=1" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)" + update-source-version rocm-device-libs "$version" + ''; + meta = with lib; { description = "Set of AMD-specific device-side language runtime libraries"; homepage = "https://github.com/RadeonOpenCompute/ROCm-Device-Libs"; From d99dfe5821103299c7b37cbbf1d9fc674ae5b135 Mon Sep 17 00:00:00 2001 From: Sebastian Neubauer Date: Wed, 8 Sep 2021 16:15:25 +0200 Subject: [PATCH 07/11] rocm-comgr: add update script --- pkgs/development/libraries/rocm-comgr/default.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/rocm-comgr/default.nix b/pkgs/development/libraries/rocm-comgr/default.nix index 52a3cb6784d6..ee646b008a04 100644 --- a/pkgs/development/libraries/rocm-comgr/default.nix +++ b/pkgs/development/libraries/rocm-comgr/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub, cmake, clang, rocm-device-libs, lld, llvm }: +{ lib, stdenv, fetchFromGitHub, writeScript, cmake, clang, rocm-device-libs, lld, llvm }: stdenv.mkDerivation rec { pname = "rocm-comgr"; @@ -36,6 +36,13 @@ stdenv.mkDerivation rec { -i CMakeLists.txt ''; + 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/ROCm-CompilerSupport/releases?per_page=1" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)" + update-source-version rocm-comgr "$version" + ''; + meta = with lib; { description = "APIs for compiling and inspecting AMDGPU code objects"; homepage = "https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/tree/amd-stg-open/lib/comgr"; From 61a2864b18b0a79e701650a7b517b06aa4efcb3b Mon Sep 17 00:00:00 2001 From: Sebastian Neubauer Date: Wed, 8 Sep 2021 16:15:45 +0200 Subject: [PATCH 08/11] llvmPackages_rocm: add update script --- .../compilers/llvm/rocm/llvm/default.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pkgs/development/compilers/llvm/rocm/llvm/default.nix b/pkgs/development/compilers/llvm/rocm/llvm/default.nix index 05b6d9de0869..8f1fcef5bcb9 100644 --- a/pkgs/development/compilers/llvm/rocm/llvm/default.nix +++ b/pkgs/development/compilers/llvm/rocm/llvm/default.nix @@ -1,6 +1,7 @@ { stdenv , lib , fetchFromGitHub +, writeScript , cmake , python3 , libxml2 @@ -88,6 +89,23 @@ in stdenv.mkDerivation rec { passthru.src = src; + updateScript = writeScript "update.sh" '' + #!/usr/bin/env nix-shell + #!nix-shell -i bash -p curl jq common-updater-scripts nix-prefetch-github + + version="$(curl -sL "https://api.github.com/repos/RadeonOpenCompute/llvm-project/releases?per_page=1" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)" + current_version="$(grep "version =" pkgs/development/compilers/llvm/rocm/default.nix | cut -d'"' -f2)" + if [[ "$version" != "$current_version" ]]; then + tarball_meta="$(nix-prefetch-github RadeonOpenCompute llvm-project --rev "rocm-$version")" + tarball_hash="$(nix to-base64 sha256-$(jq -r '.sha256' <<< "$tarball_meta"))" + sed -i "pkgs/development/compilers/llvm/rocm/default.nix" \ + -e 's,version = "\(.*\)",version = "'"$version"'",' \ + -e 's,hash = "\(.*\)",hash = "sha256-'"$tarball_hash"'",' + else + echo rocm-llvm already up-to-date + fi + ''; + meta = with lib; { description = "ROCm fork of the LLVM compiler infrastructure"; homepage = "https://github.com/RadeonOpenCompute/llvm-project"; From 6e93fa31f27d49787448f20c7ebe1c16656e7ad4 Mon Sep 17 00:00:00 2001 From: Sebastian Neubauer Date: Wed, 8 Sep 2021 19:12:32 +0200 Subject: [PATCH 09/11] rocclr: add update script --- pkgs/development/libraries/rocclr/default.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/development/libraries/rocclr/default.nix b/pkgs/development/libraries/rocclr/default.nix index c96753f9a4b2..eed5b998ee7b 100644 --- a/pkgs/development/libraries/rocclr/default.nix +++ b/pkgs/development/libraries/rocclr/default.nix @@ -1,5 +1,6 @@ { lib, stdenv , fetchFromGitHub +, writeScript , cmake , rocm-cmake , clang @@ -51,6 +52,13 @@ stdenv.mkDerivation rec { --replace "/build/source/build" "$out" ''; + 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/ROCm-Developer-Tools/ROCclr/tags" | jq '.[].name | split("-") | .[1] | select( . != null )' --raw-output | sort -n | tail -1)" + update-source-version rocclr "$version" + ''; + meta = with lib; { description = "Radeon Open Compute common language runtime"; homepage = "https://github.com/ROCm-Developer-Tools/ROCclr"; From 9d269a87e1284ef7a9816fef7bc62e93e9dc1f4e Mon Sep 17 00:00:00 2001 From: Sebastian Neubauer Date: Thu, 9 Sep 2021 13:49:30 +0200 Subject: [PATCH 10/11] rocminfo: add update script --- pkgs/development/tools/rocminfo/default.nix | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pkgs/development/tools/rocminfo/default.nix b/pkgs/development/tools/rocminfo/default.nix index bf95e15873fa..cef5d7e3666f 100644 --- a/pkgs/development/tools/rocminfo/default.nix +++ b/pkgs/development/tools/rocminfo/default.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, fetchFromGitHub, fetchpatch, cmake, rocm-runtime, python3, rocm-cmake, busybox, gnugrep +{ stdenv, lib, fetchFromGitHub, writeScript, fetchpatch, cmake, rocm-runtime, python3, rocm-cmake, busybox, gnugrep # rocminfo requires that the calling user have a password and be in # the video group. If we let rocm_agent_enumerator rely upon # rocminfo's output, then it, too, has those requirements. Instead, @@ -35,4 +35,19 @@ stdenv.mkDerivation rec { '' + lib.optionalString (defaultTargets != []) '' echo '${lib.concatStringsSep "\n" defaultTargets}' > $out/bin/target.lst ''; + + 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/rocminfo/tags" | jq '.[].name | split("-") | .[1] | select( . != null )' --raw-output | sort -n | tail -1)" + update-source-version rocminfo "$version" + ''; + + meta = with lib; { + description = "ROCm Application for Reporting System Info"; + homepage = "https://github.com/RadeonOpenCompute/rocminfo"; + license = licenses.ncsa; + maintainers = with maintainers; [ lovesegfault ]; + platforms = platforms.linux; + }; } From 48a54cc8203c3a7dab60e3e87132087a9e3d946f Mon Sep 17 00:00:00 2001 From: Sebastian Neubauer Date: Thu, 9 Sep 2021 14:02:40 +0200 Subject: [PATCH 11/11] hip: add update script --- pkgs/development/compilers/hip/default.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pkgs/development/compilers/hip/default.nix b/pkgs/development/compilers/hip/default.nix index ff5a34330ede..6a1e6383958d 100644 --- a/pkgs/development/compilers/hip/default.nix +++ b/pkgs/development/compilers/hip/default.nix @@ -20,6 +20,7 @@ , rocm-runtime , rocm-thunk , rocminfo +, writeScript , writeText }: @@ -163,4 +164,19 @@ stdenv.mkDerivation rec { wrapProgram $out/bin/hipcc --set HIP_PATH $out --set HSA_PATH ${rocm-runtime} --set HIP_CLANG_PATH ${clang}/bin --prefix PATH : ${lld}/bin --set NIX_CC_WRAPPER_TARGET_HOST_${stdenv.cc.suffixSalt} 1 --prefix NIX_LDFLAGS ' ' -L${compiler-rt}/lib --prefix NIX_LDFLAGS_FOR_TARGET ' ' -L${compiler-rt}/lib wrapProgram $out/bin/hipconfig --set HIP_PATH $out --set HSA_PATH ${rocm-runtime} --set HIP_CLANG_PATH ${clang}/bin ''; + + 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/ROCm-Developer-Tools/HIP/tags" | jq '.[].name | split("-") | .[1] | select( . != null )' --raw-output | sort -n | tail -1)" + update-source-version hip "$version" + ''; + + meta = with lib; { + description = "C++ Heterogeneous-Compute Interface for Portability"; + homepage = "https://github.com/ROCm-Developer-Tools/HIP"; + license = licenses.mit; + maintainers = with maintainers; [ lovesegfault ]; + platforms = platforms.linux; + }; }