Andrew Stubbs wrote:
On 27/11/2025 16:42, Tobias Burnus wrote:
This patch addresses the first one by adding the generic
architectures - with the plan to removed the specific ones
in GCC 17 (except for gfx908/gfx90a which do not have
a generic arch).


I'm in two minds whether to just go ahead and remove the older architectures right now? I wish I knew what devices people are using in the wild (or even *if* anyone is using it).

The question is also which ROCm they use – as generic requires
ROCm 6.4.0, released on April 11, 2025. Meanwhile, the latest
6.4 release is 6.4.3 and the lastest release is 7.1.1 (Nov 26, 2025).

Also, if we're changing the default multilib (which we will be, because explicit gfx900 is to be discontinued), then we need to think about what the new default should be. Selfish me would like gfx90a, but maybe one of the generics makes more sense?

For generic ones: gfx9-generic and gfx10-3-generic are still somewhat widely used; newer ones have gfx11-generic but the gfx12-generic share is increasing. (I ignore the few MI300 / gfx9-4-generic users).

* * *

Maybe we should just switch to the final plan now?

The attached patches (gcc + wwwdocs) now do so.

OK for GCC-16 mainline?

Tobias
GCN: Use generic instead of specific arch for default-built multilibs

GCC 15 and ROCm 4.8.0 (released April/May 2025) support generic archs.
Thus, by moving to generic archs, the number of multilibs build by GCC
can be reduced - while the number of supported devices increases.

This commit now replaces the specific gfx... by gfx{9,9-4,10-3,11}-generic,
keeping gfx908 and gfx09a as no generic exists for those.

When building for a device without a multilib but the generic one exists,
there is a diagnostic like:
  gcn mkoffload: fatal error: GCC was built without library support for
  ‘-march=gfx1150’; consider compiling for the associated generic
  architecture ‘-march=gfx11-generic’ instead

As gfx900 is no longer build by default, gfx90a was picked as new
default device.

gcc/ChangeLog:

	* config.gcc (amdgcn-*-*): Use gfx90a for 'with_arch'.
	For TM_MULTILIB_CONFIG, replace specific archs by
	gfx{9,9-4,10-3,11}-generic, keep gfx90{8,a}.
	* config/gcn/gcn.opt (march=, mtune=): Use gfx90a.
	* doc/install.texi (amdgcn): Update accordingly.

 gcc/config.gcc         |  4 ++--
 gcc/config/gcn/gcn.opt |  4 ++--
 gcc/doc/install.texi   | 19 ++++++++++---------
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 70355426396..e17354b3e65 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -4640,14 +4640,14 @@ case "${target}" in
 				exit 1
 			fi
 		done
-		[ "x$with_arch" = x ] && with_arch=gfx900
+		[ "x$with_arch" = x ] && with_arch=gfx90a
 
 		case "x${with_multilib_list}" in
 		x | xno)
 			TM_MULTILIB_CONFIG=
 			;;
 		xdefault | xyes)
-			TM_MULTILIB_CONFIG=`echo "gfx900,gfx906,gfx908,gfx90a,gfx90c,gfx1030,gfx1036,gfx1100,gfx1103" | sed "s/${with_arch},\?//;s/,$//"`
+			TM_MULTILIB_CONFIG=`echo "gfx908,gfx90a,gfx9-generic,gfx9-4-generic,gfx10-3-generic,gfx11-generic" | sed "s/${with_arch},\?//;s/,$//"`
 			;;
 		*)
 			TM_MULTILIB_CONFIG="${with_multilib_list}"
diff --git a/gcc/config/gcn/gcn.opt b/gcc/config/gcn/gcn.opt
index 99d6aeb2b30..99a2e1bcccf 100644
--- a/gcc/config/gcn/gcn.opt
+++ b/gcc/config/gcn/gcn.opt
@@ -22,11 +22,11 @@ HeaderInclude
 config/gcn/gcn-opts.h
 
 march=
-Target RejectNegative Negative(march=) Joined ToLower Enum(gpu_type) Var(gcn_arch) Init(PROCESSOR_GFX900)
+Target RejectNegative Negative(march=) Joined ToLower Enum(gpu_type) Var(gcn_arch) Init(PROCESSOR_GFX90A)
 Specify the name of the target GPU.
 
 mtune=
-Target RejectNegative Negative(mtune=) Joined ToLower Enum(gpu_type) Var(gcn_tune) Init(PROCESSOR_GFX900)
+Target RejectNegative Negative(mtune=) Joined ToLower Enum(gpu_type) Var(gcn_tune) Init(PROCESSOR_GFX90A)
 Specify the name of the target GPU.
 
 m32
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 7f4321c424b..1ca0119fe76 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -4084,16 +4084,17 @@ supported ISAs as multilib; use @code{--with-multilib-list=} to tailor the built
 multilibs.  Note that mixing ISAs in the same binary is not supported and gives
 a linker error.
 
-By default, multilib support is built for @code{gfx900}, @code{gfx906},
-@code{gfx908}, @code{gfx90a}, @code{gfx90c}, @code{gfx1030}, @code{gfx1036},
-@code{gfx1100} and @code{gfx1103}.  The default multilib configuration
-requires LLVM 15 or newer.  LLVM 13.0.1 or LLVM 14 can be used by specifying
-a @code{--with-multilib-list=} that does not list any GFX 11 device nor
-@code{gfx1036}.  At least LLVM 16 is required for @code{gfx1150} and
-@code{gfx1151}, LLVM 18 for @code{gfx942}, LLVM 19 for the generic
+By default, multilib support is built for @code{gfx908}, @code{gfx90a},
 @code{gfx9-generic}, @code{gfx9-4-generic}, @code{gfx10-3-generic}, and
-@code{gfx11-generic} targets and for @code{gfx1152}, while LLVM 20 is required
-for @code{gfx950} and @code{gfx1153}.
+@code{gfx11-generic}, which covers all supported archs.  The default multilib
+configuration requires LLVM 19 or newer.  LLVM 13.0.1 or LLVM 14 can be used by
+specifying a @code{--with-multilib-list=} that only lists GFX9 or GFX10-3
+devices, while LLVM 15 is required for GFX 11 device and @code{gfx1036}.
+At least LLVM 16 is required for @code{gfx1150} and @code{gfx1151},
+LLVM 18 for @code{gfx942}, LLVM 19 for the generic @code{gfx9-generic},
+@code{gfx9-4-generic}, @code{gfx10-3-generic}, and @code{gfx11-generic}
+targets and for @code{gfx1152}, while LLVM 20 is required for
+@code{gfx950} and @code{gfx1153}.
 
 The supported ISA architectures are listed in the GCC manual. The generic
 ISA targets @code{gfx9-generic}, @code{gfx10-3-generic}, and
gcc-16/changes.html: Update AMD GPU (gcn) for updated multilib support

diff --git a/htdocs/gcc-16/changes.html b/htdocs/gcc-16/changes.html
index da9756f1..82886671 100644
--- a/htdocs/gcc-16/changes.html
+++ b/htdocs/gcc-16/changes.html
@@ -229,9 +229,25 @@ for general information.</p>
 <ul>
   <li>Experimental support for AMD Instinct MI300 (<code>gfx942</code>) devices
       has been added, including the generic <code>gfx9-4-generic</code> and
-      mostly compatible <code>gfx950</code>. Consult GCC's
-      <a href="https://gcc.gnu.org/install/specific.html#amdgcn-x-amdhsa";>
-      installation notes</a> on how to enable multilib support for them.</li>
+      mostly compatible <code>gfx950</code>.</li>
+  <li>By default, the following multilibs are now built: <code>gfx908</code>,
+      <code>gfx90a</code>, <code>gfx9-generic</code>,
+      <code>gfx9-4-generic</code>, <code>gfx10-3-generic</code>, and
+      <code>gfx11-generic</code>. Multilibs for specific devices are no longer
+      built by default if a generic arch exists. Note:
+      <ul>
+        <li>When compiling for a specific arch and the multilib only exists
+            for the associated generic arch, GCC's error message suggests
+            the command-line option to do so.</li>
+        <li>Generic architectures require ROCm 6.4.0 or newer.</li>
+        <li>The new default-built set of multilibs now requires the assembler
+            and linker of LLVM 19 or newer.</li>
+        <li>Consult GCC's
+            <a href="https://gcc.gnu.org/install/specific.html#amdgcn-x-amdhsa";>
+            AMD installation notes</a> and
+            <a href="https://gcc.gnu.org/install/configure.html#:~:text=%2D%2Dwith%2Dmultilib%2Dlist";>
+            configuration notes</a> for setting the multilibs to be build.</li>
+      </ul></li>
 </ul>
 
 <!-- <h3 id="mips">MIPS</h3> -->

Reply via email to