summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSv. Lockal <lockalsash@gmail.com>2024-05-19 19:34:26 +0000
committerSam James <sam@gentoo.org>2024-06-26 10:19:04 +0100
commit02b51f39e527fc53a2acff2822fa2834e668285f (patch)
tree706b850d45c4ffacf4428149501078d7da0079bd
parentdev-util/hipcc: fix RDEPDEND; use llvm-r1.eclass (diff)
downloadgentoo-02b51f39e527fc53a2acff2822fa2834e668285f.tar.gz
gentoo-02b51f39e527fc53a2acff2822fa2834e668285f.tar.bz2
gentoo-02b51f39e527fc53a2acff2822fa2834e668285f.zip
dev-util/hip: use llvm-r1 and add rocm_version.h file
Signed-off-by: Sv. Lockal <lockalsash@gmail.com> Signed-off-by: Yiyang Wu <xgreenlandforwyy@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--dev-util/hip/files/hip-6.1.0-install.patch9
-rw-r--r--dev-util/hip/hip-6.1.1.ebuild40
2 files changed, 36 insertions, 13 deletions
diff --git a/dev-util/hip/files/hip-6.1.0-install.patch b/dev-util/hip/files/hip-6.1.0-install.patch
index 44038a25ca08..416663f6ea48 100644
--- a/dev-util/hip/files/hip-6.1.0-install.patch
+++ b/dev-util/hip/files/hip-6.1.0-install.patch
@@ -1,7 +1,6 @@
-Index: clr-rocm-6.1.0/hipamd/CMakeLists.txt
-===================================================================
---- clr-rocm-6.1.0.orig/hipamd/CMakeLists.txt
-+++ clr-rocm-6.1.0/hipamd/CMakeLists.txt
+These files already installed by hipcc, which is a runtime dep
+--- a/hipamd/CMakeLists.txt
++++ b/hipamd/CMakeLists.txt
@@ -401,16 +401,7 @@ if (NOT ${HIPCC_BIN_DIR} STREQUAL "")
set(hipcc_bin ${hipcc_bin}.exe)
set(hipconfig_bin ${hipconfig_bin}.exe)
@@ -18,4 +17,4 @@ Index: clr-rocm-6.1.0/hipamd/CMakeLists.txt
- install(PROGRAMS ${HIPCC_BIN_DIR}/hipvars.pm DESTINATION bin)
if(WIN32)
install(PROGRAMS ${HIPCC_BIN_DIR}/hipcc.bat DESTINATION bin)
- install(PROGRAMS ${HIPCC_BIN_DIR}/hipconfig.bat DESTINATION bin)
+ install(PROGRAMS ${HIPCC_BIN_DIR}/hipconfig.bat DESTINATION bin) \ No newline at end of file
diff --git a/dev-util/hip/hip-6.1.1.ebuild b/dev-util/hip/hip-6.1.1.ebuild
index 494d9e0306d9..098dc8211bd8 100644
--- a/dev-util/hip/hip-6.1.1.ebuild
+++ b/dev-util/hip/hip-6.1.1.ebuild
@@ -7,9 +7,9 @@ DOCS_BUILDER="doxygen"
DOCS_DEPEND="media-gfx/graphviz"
ROCM_SKIP_GLOBALS=1
-inherit cmake docs flag-o-matic llvm rocm
+LLVM_COMPAT=( 18 )
-LLVM_MAX_SLOT=18
+inherit cmake docs flag-o-matic llvm-r1 rocm
TEST_PV=${PV}
@@ -21,18 +21,20 @@ SRC_URI="https://github.com/ROCm/clr/archive/refs/tags/rocm-${PV}.tar.gz -> rocm
S="${WORKDIR}/clr-rocm-${PV}/"
TEST_S="${WORKDIR}/hip-tests-rocm-${TEST_PV}/catch"
-KEYWORDS="~amd64"
LICENSE="MIT"
SLOT="0/$(ver_cut 1-2)"
+KEYWORDS="~amd64"
-RESTRICT="!test? ( test )"
IUSE="debug test"
+RESTRICT="!test? ( test )"
DEPEND="
>=dev-util/rocminfo-5
- sys-devel/clang:${LLVM_MAX_SLOT}
+ $(llvm_gen_dep '
+ sys-devel/clang:${LLVM_SLOT}
+ ')
dev-libs/rocm-comgr:${SLOT}
- >=dev-libs/rocr-runtime-5.6
+ dev-libs/rocr-runtime:${SLOT}
x11-base/xorg-proto
virtual/opengl
"
@@ -61,11 +63,18 @@ src_prepare() {
# FindHIP.cmake module. But the reality is some package relies on it.
# Set HIP and HIP Clang paths directly, don't search using heuristics
sed -e "s:# Search for HIP installation:set(HIP_ROOT_DIR \"${EPREFIX}/usr\"):" \
- -e "s:#Set HIP_CLANG_PATH:set(HIP_CLANG_PATH \"$(get_llvm_prefix -d ${LLVM_MAX_SLOT})/bin\"):" \
+ -e "s:#Set HIP_CLANG_PATH:set(HIP_CLANG_PATH \"$(get_llvm_prefix -d)/bin\"):" \
-i "${WORKDIR}"/HIP-rocm-${PV}/cmake/FindHIP.cmake || die
cmake_src_prepare
+ # With Clang>17 -amdgpu-early-inline-all=true causes OOMs in dependencies
+ # https://github.com/llvm/llvm-project/issues/86332
+ if [ "$LLVM_SLOT" != "17" ]; then
+ sed -e "s/-mllvm=-amdgpu-early-inline-all=true //" -i hipamd/hip-config-amd.cmake || die
+ sed -e "s/-mllvm=-amdgpu-early-inline-all=true;//" -i "${WORKDIR}"/HIP-rocm-${PV}/hip-lang-config.cmake.in
+ fi
+
local PATCHES=(
"${FILESDIR}"/hip-test-6.0.2-hipcc-system-install.patch
"${FILESDIR}"/hip-test-5.7.1-remove-incompatible-flag.patch
@@ -90,7 +99,7 @@ src_configure() {
append-ldflags $(test-flags-CCLD -Wl,--undefined-version)
local mycmakeargs=(
- -DCMAKE_PREFIX_PATH="$(get_llvm_prefix "${LLVM_MAX_SLOT}")"
+ -DCMAKE_PREFIX_PATH="$(get_llvm_prefix)"
-DCMAKE_BUILD_TYPE=${buildtype}
-DCMAKE_SKIP_RPATH=ON
-DHIP_PLATFORM=amd
@@ -145,3 +154,18 @@ src_test() {
MAKEOPTS="-j1" hip_test_wrapper cmake_src_test
}
+
+src_install() {
+ cmake_src_install
+
+ # add version file that is required by some libraries
+ mkdir "${ED}"/usr/include/rocm-core || die
+ cat <<EOF > "${ED}"/usr/include/rocm-core/rocm_version.h || die
+#pragma once
+#define ROCM_VERSION_MAJOR $(ver_cut 1)
+#define ROCM_VERSION_MINOR $(ver_cut 2)
+#define ROCM_VERSION_PATCH $(ver_cut 3)
+#define ROCM_BUILD_INFO "$(ver_cut 1-3).0-9999-unknown"
+EOF
+ dosym -r /usr/include/rocm-core/rocm_version.h /usr/include/rocm_version.h
+}