public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/hip/
Date: Wed, 26 Jun 2024 09:21:26 +0000 (UTC)	[thread overview]
Message-ID: <1719393569.440c80fe2dac37d4a6e970436d498f73c165d3fd.sam@gentoo> (raw)

commit:     440c80fe2dac37d4a6e970436d498f73c165d3fd
Author:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Tue Jun 25 21:05:06 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jun 26 09:19:29 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=440c80fe

dev-util/hip: 6.1.1 add cuda support

Add platform options via video_cards.
Make HIP / OpenCL for CLR optional.

Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/35998
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-util/hip/hip-6.1.1.ebuild | 86 +++++++++++++++++++++++++++++++++----------
 dev-util/hip/metadata.xml     |  6 +++
 2 files changed, 73 insertions(+), 19 deletions(-)

diff --git a/dev-util/hip/hip-6.1.1.ebuild b/dev-util/hip/hip-6.1.1.ebuild
index 3bc1a3162b5f..eab3697cf4ef 100644
--- a/dev-util/hip/hip-6.1.1.ebuild
+++ b/dev-util/hip/hip-6.1.1.ebuild
@@ -29,25 +29,42 @@ LICENSE="MIT"
 SLOT="0/$(ver_cut 1-2)"
 KEYWORDS="~amd64"
 
-IUSE="debug test"
+IUSE="debug +hip opencl test video_cards_amdgpu video_cards_nvidia"
 RESTRICT="!test? ( test )"
 
+REQUIRED_USE="
+	|| ( hip opencl )
+	^^ ( video_cards_amdgpu video_cards_nvidia )
+"
+
 DEPEND="
-	>=dev-util/rocminfo-5
-	$(llvm_gen_dep '
-		sys-devel/clang:${LLVM_SLOT}
-	')
-	dev-libs/rocm-comgr:${SLOT}
-	dev-libs/rocr-runtime:${SLOT}
+	video_cards_amdgpu? (
+		>=dev-util/rocminfo-5
+		$(llvm_gen_dep '
+			sys-devel/clang:${LLVM_SLOT}
+		')
+		dev-libs/rocm-comgr:${SLOT}
+		dev-libs/rocr-runtime:${SLOT}
+	)
+	video_cards_nvidia? (
+		dev-libs/hipother:${SLOT}
+	)
 	x11-base/xorg-proto
 	virtual/opengl
 "
-BDEPEND="test? ( dev-util/hipcc:${SLOT}[${LLVM_USEDEP}] )"
+BDEPEND="
+	video_cards_amdgpu? (
+		dev-util/hipcc:${SLOT}[${LLVM_USEDEP}]
+	)
+"
 RDEPEND="${DEPEND}
-	dev-util/hipcc:${SLOT}[${LLVM_USEDEP}]
-	dev-perl/URI-Encode
 	sys-devel/clang-runtime:=
-	>=dev-libs/roct-thunk-interface-5"
+	video_cards_amdgpu? (
+		dev-util/hipcc:${SLOT}[${LLVM_USEDEP}]
+		>=dev-libs/rocm-device-libs-${PV}
+		>=dev-libs/roct-thunk-interface-5
+	)
+"
 
 PATCHES=(
 	"${FILESDIR}/${PN}-5.7.1-no_asan_doc.patch"
@@ -117,27 +134,50 @@ src_configure() {
 
 	local mycmakeargs=(
 		-DCMAKE_PREFIX_PATH="$(get_llvm_prefix)"
-		-DCMAKE_BUILD_TYPE=${buildtype}
 		-DCMAKE_SKIP_RPATH=ON
-		-DHIP_PLATFORM=amd
+		-D__HIP_ENABLE_PCH="no"
+
+		-DCLR_BUILD_HIP="$(usex hip)"
+		-DCLR_BUILD_OCL="$(usex opencl)"
+
 		-DHIP_COMMON_DIR="${WORKDIR}/HIP-rocm-${PV}"
-		-DROCM_PATH="${EPREFIX}/usr"
-		-DUSE_PROF_API=0
-		-DFILE_REORG_BACKWARD_COMPATIBILITY=OFF
-		-DCLR_BUILD_HIP=ON
 		-DHIPCC_BIN_DIR="${EPREFIX}/usr/bin"
+		-DROCM_PATH="${EPREFIX}/usr"
+		-DUSE_PROF_API="no"
+		-DFILE_REORG_BACKWARD_COMPATIBILITY="no"
+
 		-DOpenGL_GL_PREFERENCE="GLVND"
 		-DCMAKE_DISABLE_FIND_PACKAGE_Git="yes"
 	)
 
+	if use video_cards_amdgpu; then
+		mycmakeargs+=(
+			-DHIP_PLATFORM="amd"
+		)
+	elif use video_cards_nvidia; then
+		mycmakeargs+=(
+			-DHIPNV_DIR="${EPREFIX}/usr"
+			-DHIP_PLATFORM="nvidia"
+		)
+	fi
+
 	cmake_src_configure
 
 	if use test; then
 		local mycmakeargs=(
-			-DROCM_PATH="${BUILD_DIR}"/hipamd
-			-DHIP_PLATFORM=amd
 			-DCMAKE_MODULE_PATH="${TEST_S}/external/Catch2/cmake/Catch2"
 		)
+		if use video_cards_amdgpu; then
+			mycmakeargs+=(
+				-DROCM_PATH="${BUILD_DIR}/hipamd"
+				-DHIP_PLATFORM="amd"
+			)
+		elif use video_cards_nvidia; then
+			mycmakeargs+=(
+				-DROCM_PATH="${BUILD_DIR}/hipother"
+				-DHIP_PLATFORM="nvidia"
+			)
+		fi
 		HIP_PATH="${EPREFIX}/usr" hip_test_wrapper cmake_src_configure
 	fi
 }
@@ -187,4 +227,12 @@ src_install() {
 	EOF
 
 	dosym -r /usr/include/rocm-core/rocm_version.h /usr/include/rocm_version.h
+
+	if use video_cards_nvidia; then
+		newenvd - 99hipconfig <<-EOF
+			HIP_PLATFORM="nvidia"
+			HIP_RUNTIME="cuda"
+			CUDA_PATH="${EPREFIX}/opt/cuda"
+		EOF
+	fi
 }

diff --git a/dev-util/hip/metadata.xml b/dev-util/hip/metadata.xml
index 0d035a139560..8746df97725c 100644
--- a/dev-util/hip/metadata.xml
+++ b/dev-util/hip/metadata.xml
@@ -24,4 +24,10 @@
   <upstream>
     <remote-id type="github">ROCm/HIP</remote-id>
   </upstream>
+  <use>
+    <flag name="hip">Build HIP runtime</flag>
+    <flag name="opencl">Build OpenCL runtime</flag>
+    <flag name="video_cards_amdgpu">Build for AMD platform</flag>
+    <flag name="video_cards_nvidia">Build for Nvidia platform</flag>
+  </use>
 </pkgmetadata>


             reply	other threads:[~2024-06-26  9:21 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-26  9:21 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-07-28  8:04 [gentoo-commits] repo/gentoo:master commit in: dev-util/hip/ Patrick Lauer
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-03-05 20:51 Andrew Ammerlaan
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=1719393569.440c80fe2dac37d4a6e970436d498f73c165d3fd.sam@gentoo \
    --to=sam@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