diff --git a/pkgs/development/compilers/hip/default.nix b/pkgs/development/compilers/hip/default.nix index ff5a34330ede7..6a1e6383958da 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; + }; } diff --git a/pkgs/development/compilers/llvm/rocm/llvm/default.nix b/pkgs/development/compilers/llvm/rocm/llvm/default.nix index 05b6d9de08696..8f1fcef5bcb9c 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"; diff --git a/pkgs/development/libraries/rocclr/default.nix b/pkgs/development/libraries/rocclr/default.nix index c96753f9a4b27..eed5b998ee7be 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"; diff --git a/pkgs/development/libraries/rocm-comgr/default.nix b/pkgs/development/libraries/rocm-comgr/default.nix index 52a3cb6784d6a..ee646b008a048 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"; diff --git a/pkgs/development/libraries/rocm-device-libs/default.nix b/pkgs/development/libraries/rocm-device-libs/default.nix index 77dd4b721f2a1..e32331486569a 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"; diff --git a/pkgs/development/libraries/rocm-opencl-runtime/default.nix b/pkgs/development/libraries/rocm-opencl-runtime/default.nix index 04fba42525ed5..d5e45583c97b3 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"; diff --git a/pkgs/development/libraries/rocm-runtime/default.nix b/pkgs/development/libraries/rocm-runtime/default.nix index fc3c627a56286..ceaa164b867e4 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"; diff --git a/pkgs/development/libraries/rocm-thunk/default.nix b/pkgs/development/libraries/rocm-thunk/default.nix index 432688e1bfb5b..4d641f873021a 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"; diff --git a/pkgs/development/tools/build-managers/rocm-cmake/default.nix b/pkgs/development/tools/build-managers/rocm-cmake/default.nix index 31f4265597fed..ad6ac4fc2e5f9 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"; diff --git a/pkgs/development/tools/rocminfo/default.nix b/pkgs/development/tools/rocminfo/default.nix index bf95e15873fad..cef5d7e3666fb 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; + }; } diff --git a/pkgs/tools/system/rocm-smi/default.nix b/pkgs/tools/system/rocm-smi/default.nix index bbee315e9c700..52b75b7a4e9ed 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" ];