• [gentoo-dev] [PATCH v3 0/2] rocm.eclass: new eclass for ROCm packages

    From Yiyang Wu@21:1/5 to All on Sun Aug 21 09:30:01 2022
    From: YiyangWu <xgreenlandforwyy@gmail.com>

    This v3 fixes various problems pointed out by Ulrich. The most important change, is that check_rw_permission cannot accept wildcards (it is
    previously designed to enable wildcard, but I implemented it with bugs,
    so I turned to disabling wildcard and loop around devices).

    Updated patch is also accessible in https://github.com/gentoo/gentoo/pull/26784, with QA check by qa-bot.

    Changelog compare to v2:
    1. Re-wrap description, <80 characters;
    2. correct version detection;
    3. decorate code block using @CODE;
    4. standardize EAPI check copied from multilib-minimal.eclass;
    5. correct quotation mark usage (which fixes ROCM_TESTS iteration);
    6. use has function to test variable inside array;
    7. fix typo;
    8. avoid using internal portage variables;
    9. disable wildcard in check_rw_permission; iterate devices to check;
    10. referece bug #817440 in commit message.

    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 v2:
    diff --git a/eclass/rocm.eclass b/eclass/rocm.eclass
    index 8ca2c051ddce..4b220db0aa81 100644
    --- a/eclass/rocm.eclass
    +++ b/eclass/rocm.eclass
    @@ -9,12 +9,12 @@
    # @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. It also specify CXX=hipcc, to let hipcc compile. Another -# important function is src_test, which checks whether a valid KFD device exists
    -# for testing, and then execute the test program.
    +# 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. It also specify CXX=hipcc, to let hipcc +# compile. Another important function is src_test,
  • From Yiyang Wu@21:1/5 to All on Sun Aug 21 09: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..4b220db0aa81
    --- /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