commit:     ccb5830fe290c0fd8ae43546d188068cf4f60e91
Author:     Wilfried Holzke <gentoo <AT> holzke <DOT> net>
AuthorDate: Fri Apr  2 09:47:49 2021 +0000
Commit:     Craig Andrews <candrews <AT> gentoo <DOT> org>
CommitDate: Sun Apr 11 15:17:09 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ccb5830f

dev-util/hip: Version bump to 4.1.0

Signed-off-by: Wilfried Holzke <gentoo <AT> holzke.net>
Package-Manager: Portage-3.0.17, Repoman-3.0.2
Closes: https://github.com/gentoo/gentoo/pull/20228
Signed-off-by: Craig Andrews <candrews <AT> gentoo.org>

 dev-util/hip/Manifest                          |   1 +
 dev-util/hip/files/hip-4.1.0-DisableTest.patch |  37 ++++++++
 dev-util/hip/hip-4.1.0.ebuild                  | 114 +++++++++++++++++++++++++
 3 files changed, 152 insertions(+)

diff --git a/dev-util/hip/Manifest b/dev-util/hip/Manifest
index 5081a96f35a..fb6e7126f26 100644
--- a/dev-util/hip/Manifest
+++ b/dev-util/hip/Manifest
@@ -1 +1,2 @@
 DIST rocm-hip-4.0.0.tar.gz 1012154 BLAKE2B 
02343239a5b27c42dafd241f2c9b6f5195c50f78bfd717ae72bcb16d384bd6cf97ff6f2b86bfcf323aaaf022d6897f46d0987826c80d6f6279be4cb4792e15be
 SHA512 
cf840dbe28a9a15e3be14351bfa22d3c81e1654813a7aee55f53e71b2ee183f8dd0de14a79791617fabb5b357cadbf2ce2f476f78884b2843d30f206d65088f6
+DIST rocm-hip-4.1.0.tar.gz 954215 BLAKE2B 
c4b75ab2158e6921be1c34820ab5d1a5e2eb36112834b0143c50023caa27de384e0497f4837947cc7fe05554c6c95201340b1979eb916b31ebb4ffec8c923735
 SHA512 
420ffd7b79e2b4506873cbfc56e96395f8ed9d9375ce28df51626601199d4d8dca6920528e255d39a48ad66ee11f4b653f3b9f659df489d32b21886fb86c64b5

diff --git a/dev-util/hip/files/hip-4.1.0-DisableTest.patch 
b/dev-util/hip/files/hip-4.1.0-DisableTest.patch
new file mode 100644
index 00000000000..49e7171b2f0
--- /dev/null
+++ b/dev-util/hip/files/hip-4.1.0-DisableTest.patch
@@ -0,0 +1,37 @@
+--- a/CMakeLists.txt   2021-03-28 18:02:34.755857717 +0200
++++ b/CMakeLists.txt   2021-03-28 18:04:54.217854203 +0200
+@@ -474,20 +474,20 @@
+ #############################
+ set(HIP_ROOT_DIR ${CMAKE_CURRENT_BINARY_DIR})
+ set(HIP_SRC_PATH ${CMAKE_CURRENT_SOURCE_DIR})
+-if(HIP_PLATFORM STREQUAL "nvidia")
+-    execute_process(COMMAND "${CMAKE_COMMAND}" -E copy_directory 
"${HIP_SRC_PATH}/include" "${HIP_ROOT_DIR}/include" RESULT_VARIABLE RUN_HIT 
ERROR_QUIET)
+-endif()
+-execute_process(COMMAND "${CMAKE_COMMAND}" -E copy_directory 
"${HIP_SRC_PATH}/cmake" "${HIP_ROOT_DIR}/cmake" RESULT_VARIABLE RUN_HIT 
ERROR_QUIET)
+-if(${RUN_HIT} EQUAL 0)
+-    execute_process(COMMAND "${CMAKE_COMMAND}" -E copy_directory 
"${HIP_SRC_PATH}/bin" "${HIP_ROOT_DIR}/bin" RESULT_VARIABLE RUN_HIT ERROR_QUIET)
+-endif()
+-if(${RUN_HIT} EQUAL 0)
+-    set(CMAKE_MODULE_PATH "${HIP_ROOT_DIR}/cmake" ${CMAKE_MODULE_PATH})
+-    include(${HIP_SRC_PATH}/tests/hit/HIT.cmake)
+-    include(${HIP_SRC_PATH}/tests/Tests.cmake)
+-else()
+-    message(STATUS "Testing targets will not be available. To enable them 
please ensure that the HIP installation directory is writeable. Use 
-DCMAKE_INSTALL_PREFIX to specify a suitable location")
+-endif()
++#if(HIP_PLATFORM STREQUAL "nvidia")
++#    execute_process(COMMAND "${CMAKE_COMMAND}" -E copy_directory 
"${HIP_SRC_PATH}/include" "${HIP_ROOT_DIR}/include" RESULT_VARIABLE RUN_HIT 
ERROR_QUIET)
++#endif()
++#execute_process(COMMAND "${CMAKE_COMMAND}" -E copy_directory 
"${HIP_SRC_PATH}/cmake" "${HIP_ROOT_DIR}/cmake" RESULT_VARIABLE RUN_HIT 
ERROR_QUIET)
++#if(${RUN_HIT} EQUAL 0)
++#    execute_process(COMMAND "${CMAKE_COMMAND}" -E copy_directory 
"${HIP_SRC_PATH}/bin" "${HIP_ROOT_DIR}/bin" RESULT_VARIABLE RUN_HIT ERROR_QUIET)
++#endif()
++#if(${RUN_HIT} EQUAL 0)
++#    set(CMAKE_MODULE_PATH "${HIP_ROOT_DIR}/cmake" ${CMAKE_MODULE_PATH})
++#    include(${HIP_SRC_PATH}/tests/hit/HIT.cmake)
++#    include(${HIP_SRC_PATH}/tests/Tests.cmake)
++#else()
++#    message(STATUS "Testing targets will not be available. To enable them 
please ensure that the HIP installation directory is writeable. Use 
-DCMAKE_INSTALL_PREFIX to specify a suitable location")
++#endif()
+ 
+ #############################
+ # Code analysis

diff --git a/dev-util/hip/hip-4.1.0.ebuild b/dev-util/hip/hip-4.1.0.ebuild
new file mode 100644
index 00000000000..e6e6a374a78
--- /dev/null
+++ b/dev-util/hip/hip-4.1.0.ebuild
@@ -0,0 +1,114 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+inherit cmake flag-o-matic prefix
+
+DESCRIPTION="C++ Heterogeneous-Compute Interface for Portability"
+HOMEPAGE="https://github.com/ROCm-Developer-Tools/HIP";
+SRC_URI="https://github.com/ROCm-Developer-Tools/HIP/archive/rocm-${PV}.tar.gz 
-> rocm-hip-${PV}.tar.gz"
+
+KEYWORDS="~amd64"
+LICENSE="MIT"
+SLOT="0/$(ver_cut 1-2)"
+
+IUSE="debug profile"
+
+# Don't strip to prevent some tests from failing.
+RESTRICT="strip"
+
+DEPEND=">=dev-libs/rocclr-$(ver_cut 1-2)
+       >=dev-util/rocminfo-$(ver_cut 1-2)
+       =sys-devel/llvm-roc-${PV}*[runtime]"
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-4.1.0-DisableTest.patch"
+       "${FILESDIR}/${PN}-3.9.0-add-include-directories.patch"
+       "${FILESDIR}/${PN}-3.5.1-config-cmake-in.patch"
+       "${FILESDIR}/${PN}-3.5.1-hip_vector_types.patch"
+       "${FILESDIR}/${PN}-3.9.0-lpl_ca-add-include.patch"
+)
+
+S="${WORKDIR}/HIP-rocm-${PV}"
+
+src_prepare() {
+       cmake_src_prepare
+       eapply_user
+
+       # Use Gentoo version number, otherwise git hash is attempted in vain.
+       sed -e "/set (HIP_LIB_VERSION_STRING/cset (HIP_LIB_VERSION_STRING 
${PVR})" -i CMakeLists.txt || die
+
+       # disable PCH, because it results in a build error in ROCm 4.0.0
+       sed -e "s:option(__HIP_ENABLE_PCH:#option(__HIP_ENABLE_PCH:" -i 
"${S}/CMakeLists.txt" || die
+
+       # "hcc" is deprecated and not installed, new platform is "rocclr";
+       # Setting HSA_PATH to "/usr" results in setting "-isystem /usr/include"
+       # which makes "stdlib.h" not found when using "#include_next" in header 
files;
+       sed -e "/HIP_PLATFORM.*HIP_COMPILER.*clang/s:hcc:rocclr:" \
+               -e "/FLAGS .= \" -isystem \$HSA_PATH/d" \
+               -e "s:\$ENV{'DEVICE_LIB_PATH'}:'/usr/lib/amdgcn/bitcode':" \
+               -i bin/hipcc || die
+
+       # replace hcc remnants with modern rocclr.
+       sed -e "/HIP_PLATFORM.*STREQUAL/s:hcc:rocclr:" -i 
cmake/FindHIP/run_hipcc.cmake || die
+
+       # correctly find HIP_CLANG_INCLUDE_PATH using cmake
+       sed -e 
"/set(HIP_CLANG_ROOT/s:\"\${ROCM_PATH}/llvm\":/usr/lib/llvm/roc:" -i 
hip-config.cmake.in || die
+
+       # change --hip-device-lib-path to "/usr/lib/amdgcn/bitcode", must align 
with "dev-libs/rocm-device-libs"
+       sed -e "s:\${AMD_DEVICE_LIBS_PREFIX}/lib:/usr/lib/amdgcn/bitcode:" \
+               -i "${S}/hip-config.cmake.in" || die
+
+       einfo "prefixing hipcc and its utils..."
+       hprefixify $(grep -rl --exclude-dir=build/ "/usr" "${S}")
+}
+
+src_configure() {
+       strip-flags
+       if ! use debug; then
+               append-cflags "-DNDEBUG"
+               append-cxxflags "-DNDEBUG"
+               buildtype="Release"
+       else
+               buildtype="Debug"
+       fi
+
+       # TODO: Currently a GENTOO configuration is build,
+       # this is also used in the cmake configuration files
+       # which will be installed to find HIP;
+       # Other ROCm packages expect a "RELEASE" configuration,
+       # see "hipBLAS"
+       local mycmakeargs=(
+               -DCMAKE_PREFIX_PATH="${EPREFIX}/usr/lib/llvm/roc"
+               -DCMAKE_BUILD_TYPE=${buildtype}
+               -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/hip"
+               -DBUILD_HIPIFY_CLANG=OFF
+               -DHIP_PLATFORM=rocclr
+               -DHIP_COMPILER=clang
+               -DROCM_PATH="${EPREFIX}/usr"
+               -DHSA_PATH="${EPREFIX}/usr"
+               -DUSE_PROF_API=$(usex profile 1 0)
+               -DROCclr_DIR="${EPREFIX}"/usr/include/rocclr
+       )
+
+       cmake_src_configure
+}
+
+src_install() {
+       echo "HSA_PATH=${EPREFIX}/usr" > 99hip || die
+       echo "ROCM_PATH=${EPREFIX}/usr" >> 99hip || die
+       echo "HIP_PLATFORM=amd" >> 99hip || die
+       echo "HIP_RUNTIME=rocclr" >> 99hip || die
+       echo "HIP_COMPILER=clang" >> 99hip || die
+       echo "HIP_CLANG_PATH=${EPREFIX}/usr/lib/llvm/roc/bin" >> 99hip || die
+
+       echo "PATH=${EPREFIX}/usr/lib/hip/bin" >> 99hip || die
+       echo "HIP_PATH=${EPREFIX}/usr/lib/hip" >> 99hip || die
+       echo "LDPATH=${EPREFIX}/usr/lib/hip/lib" >> 99hip || die
+       echo "ROOTPATH=${EPREFIX}/usr/lib/hip/bin" >> 99hip || die
+
+       doenvd 99hip
+
+       cmake_src_install
+}

Reply via email to