Unverified Commit fc6c79f7 authored by Bernardo Meurer's avatar Bernardo Meurer Committed by GitHub
Browse files

Merge pull request #204378 from Madouura/pr/rocm-related

parents 6cb5aad7 75d7299d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -59,4 +59,4 @@ let
  ) // privateAttrs // passthruAttrs // { inherit name; };
in

fetcher fetcherArgs // { meta = newMeta; inherit rev; }
fetcher fetcherArgs // { meta = newMeta; inherit rev owner repo; }
+23 −9
Original line number Diff line number Diff line
@@ -30,13 +30,13 @@
let
  hip = stdenv.mkDerivation (finalAttrs: {
    pname = "hip";
    version = "5.3.3";
    version = "5.4.0";

    src = fetchFromGitHub {
      owner = "ROCm-Developer-Tools";
      repo = "HIP";
      rev = "rocm-${finalAttrs.version}";
      hash = "sha256-kmRvrwnT0h2dBMI+H9d1vmeW3TmDBD+qW4YYhaMV2dE=";
      hash = "sha256-34SJM2n3jZWIS2uwpboWOXVFhaVWGK5ELPKD/cJc1zw=";
    };

    patches = [
@@ -60,9 +60,6 @@ let
            -i "$f"
      done

      substituteInPlace bin/hip_embed_pch.sh \
        --replace '$LLVM_DIR/bin/' ""

      sed 's,#!/usr/bin/python,#!${python3.interpreter},' -i hip_prof_gen.py

      sed -e 's,$ROCM_AGENT_ENUM = "''${ROCM_PATH}/bin/rocm_agent_enumerator";,$ROCM_AGENT_ENUM = "${rocminfo}/bin/rocm_agent_enumerator";,' \
@@ -110,13 +107,13 @@ let
in
stdenv.mkDerivation (finalAttrs: {
  pname = "hip";
  version = "5.3.3";
  version = "5.4.0";

  src = fetchFromGitHub {
    owner = "ROCm-Developer-Tools";
    repo = "hipamd";
    rev = "rocm-${finalAttrs.version}";
    hash = "sha256-i7hT/j+V0LT6Va2XcQyyKXF1guoIyhcOHvn842wCRx4=";
    hash = "sha256-VL0vZVv099pZPX0J2pXPFvrhkVO/b6X+ZZDaD9B1hYI=";
  };

  nativeBuildInputs = [ cmake python3 makeWrapper perl ];
@@ -168,10 +165,19 @@ stdenv.mkDerivation (finalAttrs: {
    wrapProgram $out/bin/hipconfig --set HIP_PATH $out --set HSA_PATH ${rocm-runtime} --set HIP_CLANG_PATH ${clang}/bin
  '';

  # TODO: Separate HIP and hipamd into separate derivations
  passthru.updateScript = writeScript "update.sh" ''
    #!/usr/bin/env nix-shell
    #!nix-shell -i bash -p curl jq common-updater-scripts nix-prefetch-github
    version="$(curl ''${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} -sL "https://api.github.com/repos/ROCm-Developer-Tools/HIP/tags" | jq '.[].name | split("-") | .[1] | select( . != null )' --raw-output | sort -n | tail -1)"
    version="$(curl ''${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \
      -sL "https://api.github.com/repos/ROCm-Developer-Tools/HIP/releases?per_page=1" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)"

    IFS='.' read -a version_arr <<< "$version"

    if [ "''${#version_arr[*]}" == 2 ]; then
      version="''${version}.0"
    fi

    current_version="$(grep "version =" pkgs/development/compilers/hip/default.nix | head -n1 | cut -d'"' -f2)"
    if [[ "$version" != "$current_version" ]]; then
      tarball_meta="$(nix-prefetch-github ROCm-Developer-Tools HIP --rev "rocm-$version")"
@@ -183,7 +189,15 @@ stdenv.mkDerivation (finalAttrs: {
      echo hip already up-to-date
    fi

    version="$(curl ''${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} -sL "https://api.github.com/repos/ROCm-Developer-Tools/hipamd/tags" | jq '.[].name | split("-") | .[1] | select( . != null )' --raw-output | sort -n | tail -1)"
    version="$(curl ''${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \
      -sL "https://api.github.com/repos/ROCm-Developer-Tools/hipamd/releases?per_page=1" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)"

    IFS='.' read -a version_arr <<< "$version"

    if [ "''${#version_arr[*]}" == 2 ]; then
      version="''${version}.0"
    fi

    current_version="$(grep "version =" pkgs/development/compilers/hip/default.nix | tail -n1 | cut -d'"' -f2)"
    if [[ "$version" != "$current_version" ]]; then
      tarball_meta="$(nix-prefetch-github ROCm-Developer-Tools hipamd --rev "rocm-$version")"
+2 −2
Original line number Diff line number Diff line
{ stdenv, lib, buildPackages, fetchFromGitHub, callPackage, wrapCCWith, overrideCC }:

let
  version = "5.3.3";
  version = "5.4.0";
  src = fetchFromGitHub {
    owner = "RadeonOpenCompute";
    repo = "llvm-project";
    rev = "rocm-${version}";
    hash = "sha256-IKo7N8wWvh5PBrZ2mh1Vu5s3uUXhanqYtC4qLV/+JBs=";
    hash = "sha256-rlVo77h344PLGj/mIzsw+/ndWywsBsiKDXsEDpWSUno=";
  };
in rec {
  clang = wrapCCWith rec {
+0 −23
Original line number Diff line number Diff line
diff --git a/llvm/cmake/modules/LLVMInstallSymlink.cmake b/llvm/cmake/modules/LLVMInstallSymlink.cmake
index b5c35f706cb7..ac25e40b1436 100644
--- a/cmake/modules/LLVMInstallSymlink.cmake
+++ b/cmake/modules/LLVMInstallSymlink.cmake
@@ -4,11 +4,16 @@
 
 include(GNUInstallDirs)
 
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../cmake/Modules" ${CMAKE_MODULE_PATH})
+include(ExtendPath)
+
 function(install_symlink name target outdir)
   set(DESTDIR $ENV{DESTDIR})
-  set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}")
+  message(STATUS "Creating ${name} at ${bindir} (${CMAKE_MODULE_PATH})")
+  extend_path(prefixed_outdir "${CMAKE_INSTALL_PREFIX}" "${outdir}")
+  set(bindir "${DESTDIR}${prefixed_outdir}")
 
-  message(STATUS "Creating ${name}")
+  message(STATUS "Creating ${name} at ${bindir}")
 
   execute_process(
     COMMAND "${CMAKE_COMMAND}" -E create_symlink "${target}" "${name}"
+28 −22
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ in stdenv.mkDerivation (finalAttrs: {
    "-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
    "-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
    "-DLLVM_TARGETS_TO_BUILD=AMDGPU;${llvmNativeTarget}"
    "-DLLVM_ENABLE_PROJECTS=clang;lld;compiler-rt;clang-tools-extra"
    "-DLLVM_ENABLE_PROJECTS=clang;lld;compiler-rt"
  ]
  ++ lib.optionals enableManpages [
    "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include"
@@ -52,21 +52,28 @@ in stdenv.mkDerivation (finalAttrs: {
    "-DSPHINX_WARNINGS_AS_ERRORS=OFF"
  ];

  patches = [
    ./install-symlinks.patch
  ];

  postPatch = ''
    patchShebangs lib/OffloadArch/make_generated_offload_arch_h.sh
    substituteInPlace ../clang/cmake/modules/CMakeLists.txt \
      --replace 'FILES_MATCHING' 'NO_SOURCE_PERMISSIONS FILES_MATCHING'
  '';

  passthru = {
    isClang = true;

    updateScript = writeScript "update.sh" ''
      #!/usr/bin/env nix-shell
      #!nix-shell -i bash -p curl jq common-updater-scripts nix-prefetch-github

    version="$(curl ''${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} -sL "https://api.github.com/repos/RadeonOpenCompute/llvm-project/releases?per_page=1" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)"
      version="$(curl ''${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \
        -sL "https://api.github.com/repos/RadeonOpenCompute/llvm-project/releases?per_page=1" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)"

      IFS='.' read -a version_arr <<< "$version"

      if [ "''${#version_arr[*]}" == 2 ]; then
        version="''${version}.0"
      fi

      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")"
@@ -78,8 +85,7 @@ in stdenv.mkDerivation (finalAttrs: {
        echo rocm-llvm already up-to-date
      fi
    '';

  passthru.isClang = true;
    };

  meta = with lib; {
    description = "ROCm fork of the LLVM compiler infrastructure";
Loading