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

    From Yiyang Wu@21:1/5 to All on Sun Aug 28 13:10:01 2022
    The v5 patches corrects the usage of bash array expansion on OFFICIAL_AMDGPU_TARGETS.

    The updated Github PR is located at
    https://github.com/gentoo/gentoo/pull/26784

    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 v4:
    diff --git a/eclass/rocm.eclass b/eclass/rocm.eclass
    index 225329df4876..679b1af54e0a 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 13:10:01 2022
    Signed-off-by: Yiyang Wu <xgreenlandforwyy@gmail.com>
    ---
    profiles/desc/amdgpu_targets.desc | 15 +++++++++++++++
    1 file changed, 15 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..8a3db2b56dab
    --- /dev/null
    +++ b/profiles/desc/amdgpu_targets.desc
    @@ -0,0 +1,15 @@
    +# Copyright 1999-2022 Gentoo Authors.
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# Copied from 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 Pro V320/V340/SSG, Radeon Instinct MI25
    +gfx906 - Vega GPU, codename vega20, including Radeon (Pro) VII, Radeon Instinct MI50/MI
  • From Yiyang Wu@21:1/5 to All on Sun Aug 28 13:10: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..679b1af54e0a
    --- /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 Gordon Pettey@21:1/5 to All on Sun Aug 28 14:40:01 2022
    IMHO... much preferable to align these with names, i.e. vega10, vega20,
    rather than some ID number. USE should be self-explanatory wherever
    possible.

    On Sun, Aug 28, 2022 at 6:01 AM Yiyang Wu <xgreenlandforwyy@gmail.com>
    wrote:

    Signed-off-by: Yiyang Wu <xgreenlandforwyy@gmail.com>
    ---
    profiles/desc/amdgpu_targets.desc | 15 +++++++++++++++
    1 file changed, 15 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..8a3db2b56dab
    --- /dev/null
    +++ b/profiles/desc/amdgpu_targets.desc
    @@ -0,0 +1,15 @@
    +# Copyright 1999-2022 Gentoo Authors.
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# Copied from 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 Pro V320/V340/SSG, Radeon Instinct MI25
    +gfx906 - Vega GPU, codename vega20, including Radeon (Pro) VII, Radeon Instinct MI50/MI60
    +gfx908 - CDNA Accelerator, codename arcturus, including AMD Instinct
    MI100 Accelerator
    +gfx90a - CDNA2 Accelerator, codename aldebaran, including AMD Instinct
    MI200 series Accelerators
    +gfx1010 - RDNA GPU, codename navi10, including Radeon RX 5700XT/5700/5700M/5700B/5700XTB/5600XT/5600/5600M, Radeon Pro 5700XT/5700, Radeon Pro W5700X/W5700
    +gfx1011 - RDNA GPU, codename navi12, including Radeon Pro 5600M/V520 +gfx1012 - RDNA GPU, codename navi14, including Radeon RX 5500XT/5500/5500M/5500XTB/5300/5300M, Radeon Pro 5500XT/5500M/5300/5300M, Radeon Pro W5500X/W5500/W5500M/W5300M
    +gfx1030 - RDNA2 GPU, codename navi21/sienna cichlid, including Radeon RX 6950XT/6900XT/6800XT/6800, Radeon Pro W6800
    +gfx1031 - RDNA2 GPU, codename navi22/navy flounder, including Radeon RX 6750XT/6700XT/6800M/6700M
    --
    2.34.1




    <div dir="ltr">IMHO... much preferable to align these with names, i.e. vega10, vega20, rather than some ID number. USE should be self-explanatory wherever possible.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Aug 28,
    2022 at 6:01 AM Yiyang Wu &lt;<a href="mailto:xgreenlandforwyy@gmail.com">xgreenlandforwyy@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Signed-
    off-by: Yiyang Wu &lt;<a href="mailto:xgreenlandforwyy@gmail.com" target="_blank">xgreenlandforwyy@gmail.com</a>&gt;<br>
    ---<br>
     profiles/desc/amdgpu_targets.desc | 15 +++++++++++++++<br>
     1 file changed, 15 insertions(+)<br>
     create mode 100644 profiles/desc/amdgpu_targets.desc<br>

    diff --git a/profiles/desc/amdgpu_targets.desc b/profiles/desc/amdgpu_targets.desc<br>
    new file mode 100644<br>
    index 000000000000..8a3db2b56dab<br>
    --- /dev/null<br>
    +++ b/profiles/desc/amdgpu_targets.desc<br>
    @@ -0,0 +1,15 @@<br>
    +# Copyright 1999-2022 Gentoo Authors.<br>
    +# Distributed under the terms of the GNU General Public License v2<br>
    +<br>
    +# Copied from <a href="https://www.coelacanth-dream.com/posts/2019/12/30/did-rid-product-matome-p2/#fn:67" rel="noreferrer" target="_blank">https://www.coelacanth-dream.com/posts/2019/12/30/did-rid-product-matome-p2/#fn:67</a><br>
    +<br>
    +gfx803 - Fiji GPU, codename fiji, including Radeon R9 Nano/Fury/FuryX, Radeon Pro Duo, FirePro S9300x2, Radeon Instinct MI8 <br>
    +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 Pro V320/V340/SSG, Radeon Instinct MI25<br>
    +gfx906 - Vega GPU, codename vega20, including Radeon (Pro) VII, Radeon Instinct MI50/MI60<br>
    +gfx908 - CDNA Accelerator, codename arcturus, including AMD Instinct MI100 Accelerator<br>
    +gfx90a - CDNA2 Accele
  • From wuyy@21:1/5 to Gordon Pettey on Tue Aug 30 05:00:01 2022
    On Sun, Aug 28, 2022 at 07:34:57AM -0500, Gordon Pettey wrote:
    IMHO... much preferable to align these with names, i.e. vega10, vega20, rather than some ID number. USE should be self-explanatory wherever
    possible.

    On Sun, Aug 28, 2022 at 6:01 AM Yiyang Wu <xgreenlandforwyy@gmail.com>
    wrote:


    Thanks for the suggestion. However, the gfx*** can be directly used in compilation flags and src_configure (just like LLVM_TARGETS); changing
    the USE flag name means extra lines of translation codes in the eclass.

    Also, I turned on the "professional" cards officially supported by AMD,
    so the support is out of box for "enterprise" users. For normal ROCm
    users in Gentoo, I believe they will have a look of the use flag
    description.

    --
    Yiyang Wu

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