From 01819daec129639a040e86804af87842bdf734ca Mon Sep 17 00:00:00 2001 From: Sebastian Neubauer Date: Wed, 5 Oct 2022 11:52:20 +0000 Subject: [PATCH] =?UTF-8?q?hip:=205.2.3=20=E2=86=92=205.3.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkgs/development/compilers/hip/default.nix | 19 ++++++++----- .../compilers/hip/hip-config-paths.patch | 9 +++--- .../compilers/hip/hipamd-config-paths.patch | 28 ++++++++++++++++++- 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/pkgs/development/compilers/hip/default.nix b/pkgs/development/compilers/hip/default.nix index 329d523ddc23..fff2886246ff 100644 --- a/pkgs/development/compilers/hip/default.nix +++ b/pkgs/development/compilers/hip/default.nix @@ -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; }; } diff --git a/pkgs/development/compilers/hip/hip-config-paths.patch b/pkgs/development/compilers/hip/hip-config-paths.patch index 71e804c74482..25fa3b8da95a 100644 --- a/pkgs/development/compilers/hip/hip-config-paths.patch +++ b/pkgs/development/compilers/hip/hip-config-paths.patch @@ -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= 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) diff --git a/pkgs/development/compilers/hip/hipamd-config-paths.patch b/pkgs/development/compilers/hip/hipamd-config-paths.patch index 605b73f75c7a..78838836e9aa 100644 --- a/pkgs/development/compilers/hip/hipamd-config-paths.patch +++ b/pkgs/development/compilers/hip/hipamd-config-paths.patch @@ -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 + }