public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Andrew Ammerlaan" <andrewammerlaan@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/hip/
Date: Sat,  5 Mar 2022 20:51:59 +0000 (UTC)	[thread overview]
Message-ID: <1646513511.cadd3e208390316e2bfb03345cfb922eb67555a1.andrewammerlaan@gentoo> (raw)

commit:     cadd3e208390316e2bfb03345cfb922eb67555a1
Author:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
AuthorDate: Sat Mar  5 14:03:17 2022 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
CommitDate: Sat Mar  5 20:51:51 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cadd3e20

dev-util/hip: fix compile, add missing dep

Co-authored-by: Dennis Schridde <devurandom <AT> gmx.net>
Co-authored-by: Paul Preney <paul <AT> preney.ca>
Closes: https://bugs.gentoo.org/790164
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>

 dev-util/hip/hip-4.3.0-r2.ebuild | 112 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 112 insertions(+)

diff --git a/dev-util/hip/hip-4.3.0-r2.ebuild b/dev-util/hip/hip-4.3.0-r2.ebuild
new file mode 100644
index 000000000000..9547abd69ae1
--- /dev/null
+++ b/dev-util/hip/hip-4.3.0-r2.ebuild
@@ -0,0 +1,112 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+inherit cmake 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
+	https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime/archive/rocm-${PV}.tar.gz -> rocm-opencl-runtime-${PV}.tar.gz"
+S="${WORKDIR}/HIP-rocm-${PV}"
+
+KEYWORDS="~amd64"
+LICENSE="MIT"
+SLOT="0/$(ver_cut 1-2)"
+
+IUSE="debug profile"
+
+DEPEND="
+	dev-libs/rocclr:${SLOT}
+	dev-util/rocminfo:${SLOT}
+	dev-libs/roct-thunk-interface:${SLOT}
+	=sys-devel/llvm-roc-${PV}*[runtime]
+	profile? ( dev-util/roctracer:${SLOT} )"
+RDEPEND="${DEPEND}
+	dev-perl/URI-Encode"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-4.1.0-DisableTest.patch"
+	"${FILESDIR}/${PN}-3.9.0-add-include-directories.patch"
+	"${FILESDIR}/${PN}-4.2.0-config-cmake-in.patch"
+	"${FILESDIR}/${PN}-4.3.0-hip_vector_types.patch"
+	"${FILESDIR}/${PN}-4.2.0-cancel-hcc-header-removal.patch"
+)
+
+src_prepare() {
+	cmake_src_prepare
+
+	# Use Gentoo slot number, otherwise git hash is attempted in vain.
+	sed -e "/set (HIP_LIB_VERSION_STRING/cset (HIP_LIB_VERSION_STRING ${SLOT#*/})" -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 CMakeLists.txt || die
+
+	# remove forcing set USE_PROF_API to 1
+	sed -e '/set(USE_PROF_API "1")/d' -i rocclr/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 "/FLAGS .= \" -isystem \$HSA_PATH/d" \
+		-e "s:\$ENV{'DEVICE_LIB_PATH'}:'/usr/lib/amdgcn/bitcode':" \
+		-e "/rpath/s,--rpath=[^ ]*,," \
+		-i bin/hipcc || 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}")
+
+	cp "$(prefixify_ro "${FILESDIR}"/hipvars.pm)" bin/ || die "failed to replace hipvars.pm"
+	sed -e "s,@HIP_BASE_VERSION_MAJOR@,$(ver_cut 1)," -e "s,@HIP_BASE_VERSION_MINOR@,$(ver_cut 2)," \
+		-e "s,@HIP_VERSION_PATCH@,$(ver_cut 3)," -i bin/hipvars.pm || die
+
+	cp -a "${WORKDIR}"/ROCm-OpenCL-Runtime-rocm-${PV}/amdocl/cl_vk_amd.hpp amdocl/ || die
+
+	# Bug 790164
+	rm amdocl/CL/cl{,_icd,_gl,_gl_ext,_platform}.h || die
+	sed -i 's/CL_EXT_SUFFIX/CL_API_SUFFIX/' amdocl/cl_icd_amd.h amdocl/CL/cl_ext.h rocclr/cl_lqdflash_amd.h || die
+}
+
+src_configure() {
+	use debug && CMAKE_BUILD_TYPE="Debug"
+
+	# 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)
+		-DPROF_API_HEADER_PATH="${EPREFIX}"/usr/include/roctracer/ext
+		-DROCclr_DIR="${EPREFIX}"/usr/include/rocclr
+	)
+
+	cmake_src_configure
+}
+
+src_install() {
+	echo "PATH=${EPREFIX}/usr/lib/hip/bin" >> 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
+
+	rm "${ED}/usr/lib/hip/include/hip/hcc_detail" || die
+}


             reply	other threads:[~2022-03-05 20:52 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-05 20:51 Andrew Ammerlaan [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-02-13  8:38 [gentoo-commits] repo/gentoo:master commit in: dev-util/hip/ Sam James
2025-02-08 10:07 Patrick Lauer
2024-12-01  7:57 Patrick Lauer
2024-07-28  8:04 Patrick Lauer
2024-06-26  9:21 Sam James
2024-06-26  9:21 Sam James
2024-03-12  2:25 Sam James
2024-03-08 19:22 Sam James
2024-03-08 19:22 Sam James
2024-03-08 19:22 Sam James
2024-01-06  7:21 Sam James
2024-01-06  7:21 Sam James
2023-12-23 10:43 罗百科
2023-12-14 15:02 Benda XU
2023-12-14 15:02 Benda XU
2023-11-19 11:30 罗百科
2023-10-30  9:22 罗百科
2023-10-27  8:14 Andrew Ammerlaan
2023-10-19 10:38 罗百科
2023-02-22 16:16 Sam James
2023-01-31 13:32 Benda XU
2023-01-31 13:32 Benda XU
2023-01-31 13:32 Benda XU
2023-01-31 13:32 Benda XU
2023-01-31 13:32 Benda XU
2023-01-31 13:32 Benda XU
2022-12-20  9:26 罗百科
2022-10-08 12:40 Arthur Zamarin
2022-09-12  8:41 Benda XU
2022-09-12  8:41 Benda XU
2022-06-22 13:03 Benda XU
2022-03-27  3:26 Benda XU
2022-03-27  3:18 Benda XU
2022-03-25 15:52 Benda XU
2022-01-24 14:46 Benda XU
2021-08-03  7:04 Benda XU
2021-08-03  1:35 Benda XU
2021-01-20  5:36 Benda XU

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1646513511.cadd3e208390316e2bfb03345cfb922eb67555a1.andrewammerlaan@gentoo \
    --to=andrewammerlaan@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox