public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: heroxbd@gentoo.org
To: gentoo-dev@lists.gentoo.org
Cc: Benda Xu <heroxbd@gentoo.org>
Subject: [gentoo-dev] [PATCH] rocm.eclass: add ROCM_SKIP_GLOBALS for the USE-flags exposure.
Date: Mon, 27 Nov 2023 08:47:35 +0800	[thread overview]
Message-ID: <20231127004752.174404-1-heroxbd@gentoo.org> (raw)

From: Benda Xu <heroxbd@gentoo.org>

Low level ebuilds such as dev-util/hip and
dev-libs/rocm-opencl-runtime, unconditionally supports all the AMDGPU
cards. They do not need to define amdgpu_targets_* USE-flags.  But
their src_test() call check_amdgpu() to confirm an AMDGPU is
available.

Signed-off-by: Benda Xu <heroxbd@gentoo.org>
---
 eclass/rocm.eclass | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/eclass/rocm.eclass b/eclass/rocm.eclass
index b78dfea1cc31..9804ecde97d0 100644
--- a/eclass/rocm.eclass
+++ b/eclass/rocm.eclass
@@ -125,11 +125,26 @@ _ROCM_ECLASS=1
 # DEPEND="sci-libs/rocBLAS[${ROCM_USEDEP}]"
 # @CODE
 
+# @ECLASS_VARIABLE: ROCM_SKIP_GLOBALS
+# @DESCRIPTION:
+# Controls whether _rocm_set_globals() is executed. This variable is for
+# ebuilds that call check_amdgpu() without the need to define amdgpu_targets_*
+# USE-flags, such as dev-util/hip and dev-libs/rocm-opencl-runtime.
+#
+# Example use:
+# @CODE
+# ROCM_SKIP_GLOBALS=1
+# inherit rocm
+# @CODE
+
 # @FUNCTION: _rocm_set_globals
 # @DESCRIPTION:
 # Set global variables useful to ebuilds: IUSE, ROCM_REQUIRED_USE, and
-# ROCM_USEDEP
+# ROCM_USEDEP, unless ROCM_SKIP_GLOBALS is set.
+
 _rocm_set_globals() {
+	[[ -n ${ROCM_SKIP_GLOBALS} ]] && return
+
 	# Two lists of AMDGPU_TARGETS of certain ROCm version.  Official support
 	# matrix:
 	# https://docs.amd.com/bundle/ROCm-Installation-Guide-v${ROCM_VERSION}/page/Prerequisite_Actions.html.
@@ -179,7 +194,6 @@ _rocm_set_globals() {
 _rocm_set_globals
 unset -f _rocm_set_globals
 
-
 # @FUNCTION: get_amdgpu_flags
 # @USAGE: get_amdgpu_flags
 # @DESCRIPTION:
-- 
2.41.0



                 reply	other threads:[~2023-11-27  0:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20231127004752.174404-1-heroxbd@gentoo.org \
    --to=heroxbd@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