The gfx803 "Fiji" device was deprecated in GCC 14, removed from LLVM 18, and
hasn't worked properly with the drivers since about ROCm 4.

This patch removes the device from GCC options and documentation, and removes
the direct mentions from the internals.

The TARGET_GCN3 support in the back-end is now unused and can be removed (in a
follow-up patch).

gcc/ChangeLog:

        * config.gcc (amdgcn-*-*): Remove "fiji" from with_arch checks.
        * config/gcn/gcn-hsa.h (ABI_VERSION_SPEC): Remove fiji alternative.
        (NO_XNACK): Likewise.
        (NO_SRAM_ECC): Likewise.
        (ASM_SPEC): Remove "%{}" around ABI_VERSION_SPEC.
        * config/gcn/gcn-opts.h (enum processor_type): Remove PROCESSOR_FIJI.
        (TARGET_FIJI): Delete.
        * config/gcn/gcn.cc (gcn_option_override): Remove Fiji.
        (gcn_omp_device_kind_arch_isa): Likewise.
        (output_file_start): Likewise.
        * config/gcn/gcn.h (TARGET_CPU_CPP_BUILTINS): Likewise.
        * config/gcn/gcn.opt (gpu_type): Likewise.
        (march, mtune): Change default to PROCESSOR_VEGA10.
        * config/gcn/mkoffload.cc (EF_AMDGPU_MACH_AMDGCN_GFX803): Delete.
        (copy_early_debug_info): Remove elf_flags_actual.
        Use ELFABIVERSION_AMDGPU_HSA_V4 unconditionally.
        (get_arch): Remove Fiji.
        (main): Remove gfx803.
        * config/gcn/t-omp-device
        (omp-device-properties-gcn): Remove fiji and gfx803.
        * doc/install.texi (amdgcn*-*-*): Remove fiji and special instructions.
        * doc/invoke.texi: Remove fiji.

libgomp/ChangeLog:

        * libgomp.texi: Remove fiji and gfx803.
        * testsuite/libgomp.c/declare-variant-4.h: Remove fiji and gfx803.
        * testsuite/libgomp.c/declare-variant-4-fiji.c: Removed.
        * testsuite/libgomp.c/declare-variant-4-gfx803.c: Removed.
---
 gcc/config.gcc                                |  2 +-
 gcc/config/gcn/gcn-hsa.h                      | 13 +++++--------
 gcc/config/gcn/gcn-opts.h                     |  2 --
 gcc/config/gcn/gcn.cc                         | 19 ++++---------------
 gcc/config/gcn/gcn.h                          |  7 +------
 gcc/config/gcn/gcn.opt                        |  7 ++-----
 gcc/config/gcn/mkoffload.cc                   | 17 +++--------------
 gcc/config/gcn/t-omp-device                   |  2 +-
 gcc/doc/install.texi                          |  8 +-------
 gcc/doc/invoke.texi                           |  5 -----
 libgomp/libgomp.texi                          |  3 +--
 .../libgomp.c/declare-variant-4-fiji.c        | 11 -----------
 .../libgomp.c/declare-variant-4-gfx803.c      | 10 ----------
 .../testsuite/libgomp.c/declare-variant-4.h   | 12 ------------
 14 files changed, 19 insertions(+), 99 deletions(-)
 delete mode 100644 libgomp/testsuite/libgomp.c/declare-variant-4-fiji.c
 delete mode 100644 libgomp/testsuite/libgomp.c/declare-variant-4-gfx803.c

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 08291f4b6e0..f09ce9f63a0 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -4618,7 +4618,7 @@ case "${target}" in
                for which in arch tune; do
                        eval "val=\$with_$which"
                        case ${val} in
-                       "" | fiji | gfx900 | gfx906 | gfx908 | gfx90a | gfx90c 
| gfx1030 | gfx1036 | gfx1100 | gfx1103)
+                       "" | gfx900 | gfx906 | gfx908 | gfx90a | gfx90c | 
gfx1030 | gfx1036 | gfx1100 | gfx1103)
                                # OK
                                ;;
                        *)
diff --git a/gcc/config/gcn/gcn-hsa.h b/gcc/config/gcn/gcn-hsa.h
index 03220555075..7a1bfad49ca 100644
--- a/gcc/config/gcn/gcn-hsa.h
+++ b/gcc/config/gcn/gcn-hsa.h
@@ -79,21 +79,18 @@ extern unsigned int gcn_local_sym_hash (const char *name);
    default; however, when debugging symbols are turned on, mkoffload.cc
    writes a new AMD GPU object file and the ABI version needs to be the
    same. - LLVM <= 17 defaults to 4 while LLVM >= 18 defaults to 5.
-   GCC supports LLVM >= 13.0.1 and only LLVM >= 14 supports version 5.
-   Note that Fiji is only supported with LLVM <= 17 as version 3 is no longer
-   supported in LLVM >= 18.  */
-#define ABI_VERSION_SPEC "march=fiji:--amdhsa-code-object-version=3;" \
-                        "!march=*|march=*:--amdhsa-code-object-version=4"
+   GCC supports LLVM >= 13.0.1 and only LLVM >= 14 supports version 5.  */
+#define ABI_VERSION_SPEC "--amdhsa-code-object-version=4"
 
 /* Note that the XNACK and SRAM-ECC settings must match those in mkoffload.cc
    as the latter creates new ELF object file when debugging is enabled and
    the ELF flags (e_flags) of that generated file must be identical to those
    generated by the compiler.  */
 
-#define NO_XNACK 
"march=fiji:;march=gfx1030:;march=gfx1036:;march=gfx1100:;march=gfx1103:;" \
+#define NO_XNACK 
"march=gfx1030:;march=gfx1036:;march=gfx1100:;march=gfx1103:;" \
     /* These match the defaults set in gcn.cc.  */ \
     
"!mxnack*|mxnack=default:%{march=gfx900|march=gfx906|march=gfx908:-mattr=-xnack};"
-#define NO_SRAM_ECC 
"!march=*:;march=fiji:;march=gfx900:;march=gfx906:;march=gfx90c:;"
+#define NO_SRAM_ECC "!march=*:;march=gfx900:;march=gfx906:;march=gfx90c:;"
 
 /* In HSACOv4 no attribute setting means the binary supports "any" hardware
    configuration.  The name of the attribute also changed.  */
@@ -103,7 +100,7 @@ extern unsigned int gcn_local_sym_hash (const char *name);
 /* Use LLVM assembler and linker options.  */
 #define ASM_SPEC  "-triple=amdgcn--amdhsa "  \
                  "%{march=*:-mcpu=%*} " \
-                 "%{" ABI_VERSION_SPEC "} " \
+                 ABI_VERSION_SPEC " " \
                  "%{" NO_XNACK XNACKOPT "} " \
                  "%{" NO_SRAM_ECC SRAMOPT "} " \
                  
"%{march=gfx1030|march=gfx1036|march=gfx1100|march=gfx1103:-mattr=+wavefrontsize64}
 " \
diff --git a/gcc/config/gcn/gcn-opts.h b/gcc/config/gcn/gcn-opts.h
index 24e856bc0c3..a896a80cd0a 100644
--- a/gcc/config/gcn/gcn-opts.h
+++ b/gcc/config/gcn/gcn-opts.h
@@ -20,7 +20,6 @@
 /* Which processor to generate code or schedule for.  */
 enum processor_type
 {
-  PROCESSOR_FIJI,    // gfx803
   PROCESSOR_VEGA10,  // gfx900
   PROCESSOR_VEGA20,  // gfx906
   PROCESSOR_GFX908,
@@ -32,7 +31,6 @@ enum processor_type
   PROCESSOR_GFX1103
 };
 
-#define TARGET_FIJI (gcn_arch == PROCESSOR_FIJI)
 #define TARGET_VEGA10 (gcn_arch == PROCESSOR_VEGA10)
 #define TARGET_VEGA20 (gcn_arch == PROCESSOR_VEGA20)
 #define TARGET_GFX908 (gcn_arch == PROCESSOR_GFX908)
diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc
index 17316a7ddb8..89aab6fe8e4 100644
--- a/gcc/config/gcn/gcn.cc
+++ b/gcc/config/gcn/gcn.cc
@@ -133,8 +133,7 @@ gcn_option_override (void)
   if (!flag_pic)
     flag_pic = flag_pie;
 
-  gcn_isa = (gcn_arch == PROCESSOR_FIJI ? ISA_GCN3
-      : gcn_arch == PROCESSOR_VEGA10 ? ISA_GCN5
+  gcn_isa = (gcn_arch == PROCESSOR_VEGA10 ? ISA_GCN5
       : gcn_arch == PROCESSOR_VEGA20 ? ISA_GCN5
       : gcn_arch == PROCESSOR_GFX908 ? ISA_CDNA1
       : gcn_arch == PROCESSOR_GFX90a ? ISA_CDNA2
@@ -164,17 +163,15 @@ gcn_option_override (void)
        acc_lds_size = 32768;
     }
 
-  /* gfx803 "Fiji", gfx1030 and gfx1100 do not support XNACK.  */
-  if (gcn_arch == PROCESSOR_FIJI
-      || gcn_arch == PROCESSOR_GFX1030
+  /* gfx1030 and gfx1100 do not support XNACK.  */
+  if (gcn_arch == PROCESSOR_GFX1030
       || gcn_arch == PROCESSOR_GFX1036
       || gcn_arch == PROCESSOR_GFX1100
       || gcn_arch == PROCESSOR_GFX1103)
     {
       if (flag_xnack == HSACO_ATTR_ON)
        error ("%<-mxnack=on%> is incompatible with %<-march=%s%>",
-              (gcn_arch == PROCESSOR_FIJI ? "fiji"
-               : gcn_arch == PROCESSOR_GFX1030 ? "gfx1030"
+              (gcn_arch == PROCESSOR_GFX1030 ? "gfx1030"
                : gcn_arch == PROCESSOR_GFX1036 ? "gfx1036"
                : gcn_arch == PROCESSOR_GFX1100 ? "gfx1100"
                : gcn_arch == PROCESSOR_GFX1103 ? "gfx1103"
@@ -190,7 +187,6 @@ gcn_option_override (void)
   if (flag_xnack == HSACO_ATTR_DEFAULT)
     switch (gcn_arch)
       {
-      case PROCESSOR_FIJI:
       case PROCESSOR_VEGA10:
       case PROCESSOR_VEGA20:
       case PROCESSOR_GFX908:
@@ -3050,8 +3046,6 @@ gcn_omp_device_kind_arch_isa (enum 
omp_device_kind_arch_isa trait,
     case omp_device_arch:
       return strcmp (name, "amdgcn") == 0 || strcmp (name, "gcn") == 0;
     case omp_device_isa:
-      if (strcmp (name, "fiji") == 0 || strcmp (name, "gfx803") == 0)
-       return gcn_arch == PROCESSOR_FIJI;
       if (strcmp (name, "gfx900") == 0)
        return gcn_arch == PROCESSOR_VEGA10;
       if (strcmp (name, "gfx906") == 0)
@@ -6587,11 +6581,6 @@ output_file_start (void)
   const char *cpu;
   switch (gcn_arch)
     {
-    case PROCESSOR_FIJI:
-      cpu = "gfx803";
-      xnack = "";
-      sram_ecc = "";
-      break;
     case PROCESSOR_VEGA10:
       cpu = "gfx900";
       sram_ecc = "";
diff --git a/gcc/config/gcn/gcn.h b/gcc/config/gcn/gcn.h
index bd2afa61c10..a48fdc8f262 100644
--- a/gcc/config/gcn/gcn.h
+++ b/gcc/config/gcn/gcn.h
@@ -34,12 +34,7 @@
        builtin_define ("__RDNA3__");                                          \
       else                                                                     
\
        gcc_unreachable ();                                                    \
-      if (TARGET_FIJI)                                                         
\
-       {                                                                      \
-         builtin_define ("__fiji__");                                         \
-         builtin_define ("__gfx803__");                                       \
-       }                                                                      \
-      else if (TARGET_VEGA10)                                                  
\
+      if (TARGET_VEGA10)                                                       
\
        builtin_define ("__gfx900__");                                         \
       else if (TARGET_VEGA20)                                                  
\
        builtin_define ("__gfx906__");                                         \
diff --git a/gcc/config/gcn/gcn.opt b/gcc/config/gcn/gcn.opt
index 3317c492507..69ecca8a500 100644
--- a/gcc/config/gcn/gcn.opt
+++ b/gcc/config/gcn/gcn.opt
@@ -25,9 +25,6 @@ Enum
 Name(gpu_type) Type(enum processor_type)
 GCN GPU type to use:
 
-EnumValue
-Enum(gpu_type) String(fiji) Value(PROCESSOR_FIJI)
-
 EnumValue
 Enum(gpu_type) String(gfx900) Value(PROCESSOR_VEGA10)
 
@@ -56,11 +53,11 @@ EnumValue
 Enum(gpu_type) String(gfx1103) Value(PROCESSOR_GFX1103)
 
 march=
-Target RejectNegative Negative(march=) Joined ToLower Enum(gpu_type) 
Var(gcn_arch) Init(PROCESSOR_FIJI)
+Target RejectNegative Negative(march=) Joined ToLower Enum(gpu_type) 
Var(gcn_arch) Init(PROCESSOR_VEGA10)
 Specify the name of the target GPU.
 
 mtune=
-Target RejectNegative Negative(mtune=) Joined ToLower Enum(gpu_type) 
Var(gcn_tune) Init(PROCESSOR_FIJI)
+Target RejectNegative Negative(mtune=) Joined ToLower Enum(gpu_type) 
Var(gcn_tune) Init(PROCESSOR_VEGA10)
 Specify the name of the target GPU.
 
 m32
diff --git a/gcc/config/gcn/mkoffload.cc b/gcc/config/gcn/mkoffload.cc
index 810298a799b..b8d981878ed 100644
--- a/gcc/config/gcn/mkoffload.cc
+++ b/gcc/config/gcn/mkoffload.cc
@@ -49,8 +49,6 @@
 #undef  ELFABIVERSION_AMDGPU_HSA_V4
 #define ELFABIVERSION_AMDGPU_HSA_V4 2
 
-#undef  EF_AMDGPU_MACH_AMDGCN_GFX803
-#define EF_AMDGPU_MACH_AMDGCN_GFX803 0x2a
 #undef  EF_AMDGPU_MACH_AMDGCN_GFX900
 #define EF_AMDGPU_MACH_AMDGCN_GFX900 0x2c
 #undef  EF_AMDGPU_MACH_AMDGCN_GFX906
@@ -352,18 +350,12 @@ copy_early_debug_info (const char *infile, const char 
*outfile)
   /* We only support host relocations of x86_64, for now.  */
   gcc_assert (ehdr.e_machine == EM_X86_64);
 
-  /* Fiji devices use HSACOv3 regardless of the assembler.  */
-  uint32_t elf_flags_actual = (elf_arch == EF_AMDGPU_MACH_AMDGCN_GFX803
-                              ? 0 : elf_flags);
-
   /* Patch the correct elf architecture flag into the file.  */
   ehdr.e_ident[7] = ELFOSABI_AMDGPU_HSA;
-  ehdr.e_ident[8] = (elf_arch == EF_AMDGPU_MACH_AMDGCN_GFX803
-                    ? ELFABIVERSION_AMDGPU_HSA_V3
-                    : ELFABIVERSION_AMDGPU_HSA_V4);
+  ehdr.e_ident[8] = ELFABIVERSION_AMDGPU_HSA_V4;
   ehdr.e_type = ET_REL;
   ehdr.e_machine = EM_AMDGPU;
-  ehdr.e_flags = elf_arch | elf_flags_actual;
+  ehdr.e_flags = elf_arch | elf_flags;
 
   /* Load the section headers so we can walk them later.  */
   Elf64_Shdr *sections = (Elf64_Shdr *)xmalloc (sizeof (Elf64_Shdr)
@@ -853,9 +845,7 @@ compile_native (const char *infile, const char *outfile, 
const char *compiler,
 static int
 get_arch (const char *str, const char *with_arch_str)
 {
-  if (strcmp (str, "fiji") == 0)
-    return EF_AMDGPU_MACH_AMDGCN_GFX803;
-  else if (strcmp (str, "gfx900") == 0)
+  if (strcmp (str, "gfx900") == 0)
     return EF_AMDGPU_MACH_AMDGCN_GFX900;
   else if (strcmp (str, "gfx906") == 0)
     return EF_AMDGPU_MACH_AMDGCN_GFX906;
@@ -1076,7 +1066,6 @@ main (int argc, char **argv)
      and ASM_SPEC.  */
   switch (elf_arch)
     {
-    case EF_AMDGPU_MACH_AMDGCN_GFX803:
     case EF_AMDGPU_MACH_AMDGCN_GFX1030:
     case EF_AMDGPU_MACH_AMDGCN_GFX1036:
     case EF_AMDGPU_MACH_AMDGCN_GFX1100:
diff --git a/gcc/config/gcn/t-omp-device b/gcc/config/gcn/t-omp-device
index b92e19bb6d6..233da0fcf6f 100644
--- a/gcc/config/gcn/t-omp-device
+++ b/gcc/config/gcn/t-omp-device
@@ -1,4 +1,4 @@
 omp-device-properties-gcn: $(srcdir)/config/gcn/gcn.cc
        echo kind: gpu > $@
        echo arch: amdgcn gcn >> $@
-       echo isa: fiji gfx803 gfx900 gfx906 gfx908 gfx90a gfx90c gfx1030 
gfx1036 gfx1100 gfx1103 >> $@
+       echo isa: gfx900 gfx906 gfx908 gfx90a gfx90c gfx1030 gfx1036 gfx1100 
gfx1103 >> $@
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index f871227f684..d22ccdd9667 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -1276,7 +1276,7 @@ default set of libraries is selected based on the value of
 @option{--target}.
 
 @item amdgcn*-*-*
-@var{list} is a comma separated list of ISA names (allowed values: @code{fiji},
+@var{list} is a comma separated list of ISA names (allowed values:
 @code{gfx900}, @code{gfx906}, @code{gfx908}, @code{gfx90a}, @code{gfx90c}, 
 @code{gfx1030}, @code{gfx1036}, @code{gfx1100}, @code{gfx1103}).
 It ought not include the name of the default
@@ -3965,12 +3965,6 @@ To run the binaries, install the HSA Runtime from the
 @file{libexec/gcc/amdhsa-amdhsa/@var{version}/gcn-run} to launch them
 on the GPU.
 
-To enable support for GCN3 Fiji devices (gfx803), GCC has to be configured with
-@option{--with-arch=@code{fiji}} or
-@option{--with-multilib-list=@code{fiji},...}.  Note that support for Fiji
-devices has been removed in ROCm 4.0 and support in LLVM was deprecated and has
-been removed in LLVM 18.
-
 @html
 <hr />
 @end html
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 1dede8234d3..43afb0984e5 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -22049,11 +22049,6 @@ Set architecture type or tuning for @var{gpu}. 
Supported values for @var{gpu}
 are
 
 @table @samp
-@item fiji
-Compile for GCN3 Fiji devices (gfx803).  Support deprecated; availablility
-depends on how GCC has been configured, see @option{--with-arch} and
-@option{--with-multilib-list}.
-
 @item gfx900
 Compile for GCN5 Vega 10 devices (gfx900).
 
diff --git a/libgomp/libgomp.texi b/libgomp/libgomp.texi
index fe25d879788..e8003df6f02 100644
--- a/libgomp/libgomp.texi
+++ b/libgomp/libgomp.texi
@@ -6330,8 +6330,7 @@ on more architectures, GCC currently does not match any 
@code{arch} or
       @code{i586}, @code{i686}, @code{ia32}
       @tab See @code{-m...} flags in ``x86 Options'' (without @code{-m})
 @item @code{amdgcn}, @code{gcn}
-      @tab See @code{-march=} in ``AMD GCN Options''@footnote{Additionally,
-      @code{gfx803} is supported as an alias for @code{fiji}.}
+      @tab See @code{-march=} in ``AMD GCN Options''
 @item @code{nvptx}, @code{nvptx64}
       @tab See @code{-march=} in ``Nvidia PTX Options''
 @end multitable
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-fiji.c 
b/libgomp/testsuite/libgomp.c/declare-variant-4-fiji.c
deleted file mode 100644
index 654f9bc655c..00000000000
--- a/libgomp/testsuite/libgomp.c/declare-variant-4-fiji.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/* { dg-do link { target { offload_target_amdgcn } } } */
-/* { dg-additional-options -foffload=amdgcn-amdhsa } */
-/* { dg-additional-options -foffload=-march=fiji } */
-/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */
-
-/* { dg-xfail-if "fiji/gfx803 is no longer enabled by default & deprectated in 
ROCm/LLVM/GCC" { *-*-* } } */
-
-#define USE_FIJI_FOR_GFX803
-#include "declare-variant-4.h"
-
-/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump 
"= gfx803 \\(\\);" "optimized" } } */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx803.c 
b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx803.c
deleted file mode 100644
index b447631e52e..00000000000
--- a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx803.c
+++ /dev/null
@@ -1,10 +0,0 @@
-/* { dg-do link { target { offload_target_amdgcn } } } */
-/* { dg-additional-options -foffload=amdgcn-amdhsa } */
-/* { dg-additional-options -foffload=-march=fiji } */
-/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */
-
-/* { dg-xfail-if "fiji/gfx803 is no longer enabled by default & deprectated in 
ROCm/LLVM/GCC" { *-*-* } } */
-
-#include "declare-variant-4.h"
-
-/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump 
"= gfx803 \\(\\);" "optimized" } } */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4.h 
b/libgomp/testsuite/libgomp.c/declare-variant-4.h
index f244d09c655..53788d2f922 100644
--- a/libgomp/testsuite/libgomp.c/declare-variant-4.h
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4.h
@@ -1,12 +1,5 @@
 #pragma omp declare target
 
-__attribute__ ((noipa))
-int
-gfx803 (void)
-{
-  return 0x803;
-}
-
 __attribute__ ((noipa))
 int
 gfx900 (void)
@@ -70,11 +63,6 @@ gfx1103 (void)
   return 0x1103;
 }
 
-#ifdef USE_FIJI_FOR_GFX803
-#pragma omp declare variant(gfx803) match(device = {isa("fiji")})
-#else
-#pragma omp declare variant(gfx803) match(device = {isa("gfx803")})
-#endif
 #pragma omp declare variant(gfx900) match(device = {isa("gfx900")})
 #pragma omp declare variant(gfx906) match(device = {isa("gfx906")})
 #pragma omp declare variant(gfx908) match(device = {isa("gfx908")})
-- 
2.45.2

Reply via email to