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

Merge pull request #195403 from Flakebi/rocm

parents d0c935df 01819dae
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -29,13 +29,13 @@
let
  hip = stdenv.mkDerivation rec {
    pname = "hip";
    version = "5.2.3";
    version = "5.3.0";

    src = fetchFromGitHub {
      owner = "ROCm-Developer-Tools";
      repo = "HIP";
      rev = "rocm-${version}";
      hash = "sha256-QaN666Rku2Tkio2Gm5/3RD8D5JgmCZLe0Yun1fGxa8U=";
      hash = "sha256-UAodlVUiTU4n/EyvTIuQekTGh4izmBjKCRXOHXVKY4M=";
    };

    patches = [
@@ -102,20 +102,20 @@ let
      description = "C++ Heterogeneous-Compute Interface for Portability";
      homepage = "https://github.com/ROCm-Developer-Tools/HIP";
      license = licenses.mit;
      maintainers = with maintainers; [ lovesegfault ];
      maintainers = with maintainers; [ lovesegfault Flakebi ];
      platforms = platforms.linux;
    };
  };
in
stdenv.mkDerivation rec {
  pname = "hip";
  version = "5.2.3";
  version = "5.3.0";

  src = fetchFromGitHub {
    owner = "ROCm-Developer-Tools";
    repo = "hipamd";
    rev = "rocm-${version}";
    hash = "sha256-9YZBFn1jpOiX0X9rcpsFDNhas9vfxNkNnbsWSi7unPU=";
    hash = "sha256-gZGZiDP/HbdmzLQkG9Jq9lyMP9hoD6UzTMiX9cUmQNA=";
  };

  nativeBuildInputs = [ cmake python3 makeWrapper perl ];
@@ -133,11 +133,16 @@ stdenv.mkDerivation rec {
  patches = [
    (substituteAll {
      src = ./hipamd-config-paths.patch;
      inherit llvm hip;
      inherit clang llvm hip;
      rocm_runtime = rocm-runtime;
    })
  ];

  prePatch = ''
    sed -e 's,#!/bin/bash,#!${stdenv.shell},' \
        -i src/hip_embed_pch.sh
  '';

  preConfigure = ''
    export HIP_CLANG_PATH=${clang}/bin
    export DEVICE_LIB_PATH=${rocm-device-libs}/lib
@@ -189,7 +194,7 @@ stdenv.mkDerivation rec {
    description = "C++ Heterogeneous-Compute Interface for Portability";
    homepage = "https://github.com/ROCm-Developer-Tools/hipamd";
    license = licenses.mit;
    maintainers = with maintainers; [ lovesegfault ];
    maintainers = with maintainers; [ lovesegfault Flakebi ];
    platforms = platforms.linux;
  };
}
+4 −5
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@ diff --git a/hip-lang-config.cmake.in b/hip-lang-config.cmake.in
index 1a72643a..7f35031f 100644
--- a/hip-lang-config.cmake.in
+++ b/hip-lang-config.cmake.in
@@ -72,8 +72,8 @@ get_filename_component(_IMPORT_PREFIX "${_DIR}/../../../" REALPATH)
@@ -71,8 +71,8 @@ get_filename_component(_IMPORT_PREFIX "${_DIR}/../../../" REALPATH)
 
 
 #need _IMPORT_PREFIX to be set #FILE_REORG_BACKWARD_COMPATIBILITY
@@ -13,19 +13,18 @@ index 1a72643a..7f35031f 100644
 find_path(HIP_CLANG_INCLUDE_PATH __clang_cuda_math.h
     HINTS ${HIP_CLANG_INCLUDE_SEARCH_PATHS}
           ${HIP_CLANG_INCLUDE_SEARCH_PATHS_REORG}
@@ -88,10 +88,7 @@ endif()
@@ -87,9 +87,7 @@ endif()
 #if HSA is not under ROCm then provide CMAKE_PREFIX_PATH=<HSA_PATH>
 find_path(HSA_HEADER hsa/hsa.h
   PATHS
-    "${_IMPORT_PREFIX}/../include" #FILE_REORG_BACKWARD_COMPATIBILITY
-    "${_IMPORT_PREFIX}/include"
-    "${ROCM_PATH}/include"
-    /opt/rocm/include
+    "@rocm_runtime@/include"
 )
 
 if (HSA_HEADER-NOTFOUND)
@@ -99,7 +96,7 @@ if (HSA_HEADER-NOTFOUND)
 if (NOT HSA_HEADER)
@@ -97,7 +94,7 @@ if (HSA_HEADER-NOTFOUND)
 endif()
 
 get_filename_component(HIP_COMPILER_INSTALL_PATH ${CMAKE_HIP_COMPILER} DIRECTORY)
+27 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ index 89d1224e..120b68c6 100755
     endif()
   else()
-    set(HIP_CLANG_ROOT "${ROCM_PATH}/llvm")
+    set(HIP_CLANG_ROOT "@llvm@")
+    set(HIP_CLANG_ROOT "@clang@")
   endif()
   if(NOT HIP_CXX_COMPILER)
     set(HIP_CXX_COMPILER ${CMAKE_CXX_COMPILER})
@@ -45,3 +45,29 @@ index 89d1224e..120b68c6 100755
     )
   endif()
 endif()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 83866d83..4125d3aa 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -178,7 +178,7 @@ if(__HIP_ENABLE_PCH)
       ${ROCM_PATH}/llvm)
   # find_package(LLVM) returns the lib/cmake/llvm location. We require the root.
   if(NOT DEFINED HIP_LLVM_ROOT)
-    set(HIP_LLVM_ROOT "${LLVM_DIR}/../../..")
+    set(HIP_LLVM_ROOT "@clang@")
   endif()

   execute_process(COMMAND sh -c "${CMAKE_CURRENT_SOURCE_DIR}/hip_embed_pch.sh ${HIP_COMMON_INCLUDE_DIR} ${PROJECT_BINARY_DIR}/include ${PROJECT_SOURCE_DIR}/include ${HIP_LLVM_ROOT}" COMMAND_ECHO STDERR RESULT_VARIABLE EMBED_PCH_RC)
diff --git a/src/hip_embed_pch.sh b/src/hip_embed_pch.sh
index 0a1572b2..aa855d63 100755
--- a/src/hip_embed_pch.sh
+++ b/src/hip_embed_pch.sh
@@ -149,7 +149,7 @@ EOF

   $LLVM_DIR/bin/clang -cc1 -O3 -emit-pch -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-linux-gnu -fcuda-is-device -std=c++17 -fgnuc-version=4.2.1 -o $tmp/hip_wave64.pch -x hip-cpp-output - <$tmp/pch_wave64.cui &&

-  $LLVM_DIR/bin/llvm-mc -o hip_pch.o $tmp/hip_pch.mcin --filetype=obj &&
+  @llvm@/bin/llvm-mc -o hip_pch.o $tmp/hip_pch.mcin --filetype=obj &&

   rm -rf $tmp
 }
+2 −2
Original line number Diff line number Diff line
{ stdenv, lib, buildPackages, fetchFromGitHub, callPackage, wrapCCWith, overrideCC }:

let
  version = "5.2.3";
  version = "5.3.0";
  src = fetchFromGitHub {
    owner = "RadeonOpenCompute";
    repo = "llvm-project";
    rev = "rocm-${version}";
    hash = "sha256-sudH8hnjReyuCFm2CBEPd8W88SjAARgCd1MTIJaDjTI=";
    hash = "sha256-MN7W4Gl6+a1nCozdn9gMzIXOiBPquoOP87x26boeSCA=";
  };
in rec {
  clang = wrapCCWith rec {
+3 −3
Original line number Diff line number Diff line
@@ -7,13 +7,13 @@

stdenv.mkDerivation rec {
  pname = "rocclr";
  version = "5.2.3";
  version = "5.3.0";

  src = fetchFromGitHub {
    owner = "ROCm-Developer-Tools";
    repo = "ROCclr";
    rev = "rocm-${version}";
    hash = "sha256-DER6PBYXmZRgwFNVU5rpn87HrXMR+HnQf8cwHioUals=";
    hash = "sha256-l14+l8FkiFmGuRZ9dyD/PEYH9nHVRRg1vMXMnVhg3K4=";
  };

  patches = [
@@ -53,7 +53,7 @@ stdenv.mkDerivation rec {
    description = "Source package of the Radeon Open Compute common language runtime";
    homepage = "https://github.com/ROCm-Developer-Tools/ROCclr";
    license = licenses.mit;
    maintainers = with maintainers; [ lovesegfault ];
    maintainers = with maintainers; [ lovesegfault Flakebi ];
    # rocclr seems to have some AArch64 ifdefs, but does not seem
    # to be supported yet by the build infrastructure. Recheck in
    # the future.
Loading