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

    From Yiyang Wu@21:1/5 to All on Mon Sep 5 15:40:01 2022
    Comparing to v6, rocn.eclass refactorized a lot in v7, thanks to
    MichaƂ's critical comments on
    https://github.com/gentoo/gentoo/pull/26784.

    Now the eclass code base is much cleaner, mostly because specific codes
    in phase functions are removed.

    Changelog against v6:

    1. Remove phase functions rocm_src_configure and rocm_src_test. The code duplication among ROCm ebuilds are not so large that a common phase
    function is necessary. Writing a all-in-one phase function would cause
    the eclass hard to maintain.

    2. check_rw_permission -> check_amdgpu. Limit the function to check
    amdgpu device, and move `addwrite /dev/kfd` from rocm_src_test into it.
    So ebuilds can simply call check_amdgpu in src_test and do the reset of testing.

    3. Standardize and simplify codes including bash array handling.

    4. ROCM_VERSION is required for all packages, not assumed to be ${PV}.

    5. Reshaped the examples according to the changes.

    6. Update reference of AMDGPU device map, pointing to codes in an
    official repo rather than a summarize hosted on a third-party web page.

    I would also like to ask a question. In check_amdgpu, if GPU access
    denied, the eclass suggest the user to check whether the portage user is
    in render group or not. I would like to print the username, so I tried
    use ${USER} but it is not set during src_test. Previously, I used ${PORTAGE_USERNAME} but its a potage internal variable. Is there an
    approach to print the portage username? Would $(whoami) suitable for
    this job?

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

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

    --
    2.34.1

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Yiyang Wu@21:1/5 to All on Mon Sep 5 15:40:01 2022
    Signed-off-by: Yiyang Wu <xgreenlandforwyy@gmail.com>
    ---
    profiles/desc/amdgpu_targets.desc | 17 +++++++++++++++++
    1 file changed, 17 insertions(+)
    create mode 100644 profiles/desc/amdgpu_targets.desc

    diff --git a/profiles/desc/amdgpu_targets.desc b/profiles/desc/amdgpu_targets.desc
    new file mode 100644
    index 000000000000..66a9a7a85935
    --- /dev/null
    +++ b/profiles/desc/amdgpu_targets.desc
    @@ -0,0 +1,17 @@
    +# Copyright 1999-2022 Gentoo Authors.
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# Reference:
    +# GPU name and Architecture codename: https://github.com/GPUOpen-Tools/device_info/blob/master/DeviceInfo.cpp
    +# See also: https://www.coelacanth-dream.com/posts/2019/12/30/did-rid-product-matome-p2/#fn:67
    +
    +gfx803 - Fiji GPU, codename fiji, including Radeon R9 Nano/Fury/FuryX, Radeon Pro Duo, FirePro S9300x2, Radeon Instinct MI8
    +gfx900 - Vega GPU, codename vega10, including Radeon Vega Frontier Edition, Radeon RX Vega 56/64, Radeon RX Vega 64 Liquid, Radeon Pro Vega 48/56/64/64X, Radeon Pro WX 8200/9100, Radeon Pr
  • From Yiyang Wu@21:1/5 to All on Mon Sep 5 15:40: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 | 223 ++++++++++++++++++++++++++++++++++++
    profiles/base/make.defaults | 2 +-
    2 files changed, 224 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..4c8fd39f2491
    --- /dev/null
    +++ b/eclass/rocm.eclass
    @@ -0,0 +1,223 @@
    +# 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>*, and packages built on top of ROCm +# libraries, can utilize variables and functions provided by this eclass.
    +# It handles the AMDGPU_TARGETS variable via USE_EXPAND, so user can
    +# edit USE flag to control which GPU architect