• [gentoo-dev] [PATCH v4 0/2] *** rocm.eclass: new eclass ***

    From Yiyang Wu@21:1/5 to All on Sun Aug 28 07:30:02 2022
    The v4 patches fixes a bug about determining whether ${gpu_target} is in ${OFFICIAL_AMDGPU_TARGETS[*]}. Nothing else has changed, and the eclass
    works as expected in my experiment ebuilds on sci-libs/roc*.

    Yiyang Wu (2):
    rocm.eclass: new eclass
    profiles/desc: add amdgpu_targets.desc for USE_EXPAND

    eclass/rocm.eclass | 278 ++++++++++++++++++++++++++++++
    profiles/base/make.defaults | 2 +-
    profiles/desc/amdgpu_targets.desc | 15 ++
    3 files changed, 294 insertions(+), 1 deletion(-)
    create mode 100644 eclass/rocm.eclass
    create mode 100644 profiles/desc/amdgpu_targets.desc

    Interdiff against v3:
    diff --git a/eclass/rocm.eclass b/eclass/rocm.eclass
    index 4b220db0aa81..225329df4876 100644
    --- a/eclass/rocm.eclass
    +++ b/eclass/rocm.eclass
    @@ -159,7 +159,7 @@ _rocm_set_globals() {

    ROCM_REQUIRED_USE+=" || ("
    for gpu_target in "${ALL_AMDGPU_TARGETS[@]}"; do
    - if has ${gpu_target} "${OFFICIAL_AMDGPU_TARGETS[*]}"; then
    + if has "${gpu_target}" ${OFFICIAL_AMDGPU_TARGETS[*]}; then
    IUSE+=" ${gpu_target/#/+amdgpu_targets_}"
    else
    IUSE+=" ${gpu_target/#/amdgpu_targets_}"
    --
    2.34.1

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Yiyang Wu@21:1/5 to All on Sun Aug 28 07:30:01 2022
    This eclass provides utilities for ROCm libraries in https://github.com/ROCmSoftwarePlatform, e.g. rocBLAS, rocFFT.
    It contains a USE_EXPAND, amdgpu_targets_*, which handles the GPU
    architecture to compile, and keep targets coherent among dependencies.
    Packages that depend on ROCm libraries, like cupy, can also make use of
    this eclass, mainly specify GPU architecture and it's corresponding dependencies via USE_EXPAND.

    Closes: https://bugs.gentoo.org/810619
    Bugs: https://bugs.gentoo.org/817440
    Signed-off-by: Yiyang Wu <xgreenlandforwyy@gmail.com>
    ---
    eclass/rocm.eclass | 278 ++++++++++++++++++++++++++++++++++++
    profiles/base/make.defaults | 2 +-
    2 files changed, 279 insertions(+), 1 deletion(-)
    create mode 100644 eclass/rocm.eclass

    diff --git a/eclass/rocm.eclass b/eclass/rocm.eclass
    new file mode 100644
    index 000000000000..225329df4876
    --- /dev/null
    +++ b/eclass/rocm.eclass
    @@ -0,0 +1,278 @@
    +# Copyright 2022 Gentoo Authors
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# @ECLASS: rocm.eclass
    +# @MAINTAINER:
    +# Gentoo Science Project <sci@gentoo.org>
    +# @AUTHOR:
    +# Yiyang Wu <xgreenlandforwyy@gmail.com>
    +# @SUPPORTED_EAPIS: 7 8
    +# @BLURB: Common functions and variables for ROCm packages written in HIP
    +# @DESCRIPTION:
    +# ROCm packages such as sci-libs/<roc|hip>* can utilize functions in this
    +# eclass. Currently, it handles the AMDGPU_TARGETS variable via USE_EXPAND, so
    +# user can use USE flag to control which GPU architecture to compile, and
    +# ensure coherence among dependencies. I
  • From Ulrich Mueller@21:1/5 to All on Sun Aug 28 08:40:01 2022
    On Sun, 28 Aug 2022, Yiyang Wu wrote:

    - if has ${gpu_target} "${OFFICIAL_AMDGPU_TARGETS[*]}"; then
    + if has "${gpu_target}" ${OFFICIAL_AMDGPU_TARGETS[*]}; then

    This still doesn't look right. It should be:

    if has "${gpu_target}" "${OFFICIAL_AMDGPU_TARGETS[@]}"; then

    From Bash documentation:

    | If the word is double-quoted, '${NAME[*]}' expands to a single word
    | with the value of each array member separated by the first character
    | of the 'IFS' variable, and '${NAME[@]}' expands each element of NAME
    | to a separate word.

    Ulrich

    --=-=-Content-Type: application/pgp-signature; name="signature.asc"

    -----BEGIN PGP SIGNATURE-----

    iQFDBAEBCAAtFiEEtDnZ1O9xIP68rzDbUYgzUIhBXi4FAmMLDPEPHHVsbUBnZW50 b28ub3JnAAoJEFGIM1CIQV4u4XUH/3lfHuNQA42DUVDP5Jd62YZqS3eOL44BZLDp 7gjsxJnjJlt8D11Ssr98AH6ieANjM0JXrMRLl1g3wyz3izNQ0Bu4NqocynJESms1 tWS3bCUxg2sXK64pm1BnQM7RmnwwnwOUdqlAJ1+60YC10OEeXKqzlf+pf53GZacy 9sAcBswiQA3n4alpMnAuYF2whOjZ+laXlX7XBB0gs2sAGphrtcFJlolHPaJbVu7I noJllHA4FjzxDOeLLWX3ltfArOFBbx82OjQdCyR7BukwZfI0/yC7QVfb8Jdm1f8i GCkryOh+g8SdqJHxvoC6aH5USYJEc0TxE2WSOf4khYmHiPNASFE=zqm+
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)