]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
amdgcn: Add gfx1103 target
authorAndrew Stubbs <ams@baylibre.com>
Fri, 15 Mar 2024 14:26:15 +0000 (14:26 +0000)
committerAndrew Stubbs <ams@baylibre.com>
Fri, 22 Mar 2024 14:45:15 +0000 (14:45 +0000)
Add support for the gfx1103 RDNA3 APU integrated graphics devices.  The ROCm
documentation warns that these may not be supported, but it seems to work
at least partially.

gcc/ChangeLog:

* config.gcc (amdgcn): Add gfx1103 entries.
* config/gcn/gcn-hsa.h (NO_XNACK): Likewise.
(gcn_local_sym_hash): Likewise.
* config/gcn/gcn-opts.h (enum processor_type): Likewise.
(TARGET_GFX1103): New macro.
* config/gcn/gcn.cc (gcn_option_override): Handle gfx1103.
(gcn_omp_device_kind_arch_isa): Likewise.
(output_file_start): Likewise.
(gcn_hsa_declare_function_name): Use TARGET_RDNA3, not just gfx1100.
* config/gcn/gcn.h (TARGET_CPU_CPP_BUILTINS): Add __gfx1103__.
* config/gcn/gcn.opt: Add gfx1103.
* config/gcn/mkoffload.cc (EF_AMDGPU_MACH_AMDGCN_GFX1103): New.
(main): Handle gfx1103.
* config/gcn/t-omp-device: Add gfx1103 isa.
* doc/install.texi (amdgcn): Add gfx1103.
* doc/invoke.texi (-march): Likewise.

libgomp/ChangeLog:

* plugin/plugin-gcn.c (EF_AMDGPU_MACH): GFX1103.
(gcn_gfx1103_s): New.
(isa_hsa_name): Handle gfx1103.
(isa_code): Likewise.
(max_isa_vgprs): Likewise.

gcc/config.gcc
gcc/config/gcn/gcn-hsa.h
gcc/config/gcn/gcn-opts.h
gcc/config/gcn/gcn.cc
gcc/config/gcn/gcn.h
gcc/config/gcn/gcn.opt
gcc/config/gcn/mkoffload.cc
gcc/config/gcn/t-omp-device
gcc/doc/install.texi
gcc/doc/invoke.texi
libgomp/plugin/plugin-gcn.c

index 040afabd9ece03241ad2a802ca0ae620f279d149..87a5c92b6e3b96619f4841dde7c1f3de8a46bbfc 100644 (file)
@@ -4560,7 +4560,7 @@ case "${target}" in
                for which in arch tune; do
                        eval "val=\$with_$which"
                        case ${val} in
-                       "" | fiji | gfx900 | gfx906 | gfx908 | gfx90a | gfx1030 | gfx1100)
+                       "" | fiji | gfx900 | gfx906 | gfx908 | gfx90a | gfx1030 | gfx1100 | gfx1103)
                                # OK
                                ;;
                        *)
@@ -4576,7 +4576,7 @@ case "${target}" in
                        TM_MULTILIB_CONFIG=
                        ;;
                xdefault | xyes)
-                       TM_MULTILIB_CONFIG=`echo "gfx900,gfx906,gfx908,gfx90a,gfx1030,gfx1100" | sed "s/${with_arch},\?//;s/,$//"`
+                       TM_MULTILIB_CONFIG=`echo "gfx900,gfx906,gfx908,gfx90a,gfx1030,gfx1100,gfx1103" | sed "s/${with_arch},\?//;s/,$//"`
                        ;;
                *)
                        TM_MULTILIB_CONFIG="${with_multilib_list}"
index c75256dbac37199d764282b3447703b828a4340e..ac32b8a328fac1fefc90b3b5c40c8537f8bb9100 100644 (file)
@@ -90,7 +90,7 @@ extern unsigned int gcn_local_sym_hash (const char *name);
    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=gfx1100:;" \
+#define NO_XNACK "march=fiji:;march=gfx1030:;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:;"
@@ -106,8 +106,8 @@ extern unsigned int gcn_local_sym_hash (const char *name);
                  "%{" ABI_VERSION_SPEC "} " \
                  "%{" NO_XNACK XNACKOPT "} " \
                  "%{" NO_SRAM_ECC SRAMOPT "} " \
-                 "%{march=gfx1030|march=gfx1100:-mattr=+wavefrontsize64} " \
-                 "%{march=gfx1030|march=gfx1100:-mattr=+cumode} " \
+                 "%{march=gfx1030|march=gfx1100|march=gfx1103:-mattr=+wavefrontsize64} " \
+                 "%{march=gfx1030|march=gfx1100|march=gfx1103:-mattr=+cumode} " \
                  "-filetype=obj"
 #define LINK_SPEC "--pie --export-dynamic"
 #define LIB_SPEC  "-lc"
index 6be2c9204fa9c232540c4231e215a625005d7a63..285746f7f4dd67605f329198aef22596ad0c9142 100644 (file)
@@ -26,7 +26,8 @@ enum processor_type
   PROCESSOR_GFX908,
   PROCESSOR_GFX90a,
   PROCESSOR_GFX1030,
-  PROCESSOR_GFX1100
+  PROCESSOR_GFX1100,
+  PROCESSOR_GFX1103
 };
 
 #define TARGET_FIJI (gcn_arch == PROCESSOR_FIJI)
@@ -36,6 +37,7 @@ enum processor_type
 #define TARGET_GFX90a (gcn_arch == PROCESSOR_GFX90a)
 #define TARGET_GFX1030 (gcn_arch == PROCESSOR_GFX1030)
 #define TARGET_GFX1100 (gcn_arch == PROCESSOR_GFX1100)
+#define TARGET_GFX1103 (gcn_arch == PROCESSOR_GFX1103)
 
 /* Set in gcn_option_override.  */
 extern enum gcn_isa {
index fca001811e5dce69d4e056efa902ea6adf47df0a..498146dcde9457e90863adb8fb83a40d33ce16bf 100644 (file)
@@ -140,6 +140,7 @@ gcn_option_override (void)
       : gcn_arch == PROCESSOR_GFX90a ? ISA_CDNA2
       : gcn_arch == PROCESSOR_GFX1030 ? ISA_RDNA2
       : gcn_arch == PROCESSOR_GFX1100 ? ISA_RDNA3
+      : gcn_arch == PROCESSOR_GFX1103 ? ISA_RDNA3
       : ISA_UNKNOWN);
   gcc_assert (gcn_isa != ISA_UNKNOWN);
 
@@ -164,13 +165,15 @@ gcn_option_override (void)
   /* gfx803 "Fiji", gfx1030 and gfx1100 do not support XNACK.  */
   if (gcn_arch == PROCESSOR_FIJI
       || gcn_arch == PROCESSOR_GFX1030
-      || gcn_arch == PROCESSOR_GFX1100)
+      || 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_GFX1100 ? "gfx1100"
+               : gcn_arch == PROCESSOR_GFX1103 ? "gfx1103"
                : NULL));
       /* Allow HSACO_ATTR_ANY silently because that's the default.  */
       flag_xnack = HSACO_ATTR_OFF;
@@ -3048,6 +3051,8 @@ gcn_omp_device_kind_arch_isa (enum omp_device_kind_arch_isa trait,
        return gcn_arch == PROCESSOR_GFX1030;
       if (strcmp (name, "gfx1100") == 0)
        return gcn_arch == PROCESSOR_GFX1100;
+      if (strcmp (name, "gfx1103") == 0)
+       return gcn_arch == PROCESSOR_GFX1103;
       return 0;
     default:
       gcc_unreachable ();
@@ -6558,6 +6563,11 @@ output_file_start (void)
       xnack = "";
       sram_ecc = "";
       break;
+    case PROCESSOR_GFX1103:
+      cpu = "gfx1103";
+      xnack = "";
+      sram_ecc = "";
+      break;
     default: gcc_unreachable ();
     }
 
@@ -6705,7 +6715,7 @@ gcn_hsa_declare_function_name (FILE *file, const char *name,
           xnack_enabled,
           LDS_SIZE);
   /* Not supported with 'architected flat scratch'.  */
-  if (gcn_arch != PROCESSOR_GFX1100)
+  if (!TARGET_RDNA3)
     fprintf (file,
           "\t  .amdhsa_reserve_flat_scratch\t0\n");
   if (gcn_arch == PROCESSOR_GFX90a)
index c314c7b4ae8e7b947ba07c56e5b7fcab740a0ca4..b003db6cd26d0250f2fbc1b61dbdbbac39fcf497 100644 (file)
@@ -51,6 +51,8 @@
        builtin_define ("__gfx1030");                                          \
       else if (TARGET_GFX1100)                                                 \
        builtin_define ("__gfx1100__");                                        \
+      else if (TARGET_GFX1103)                                                 \
+       builtin_define ("__gfx1103__");                                        \
       else                                                                     \
        gcc_unreachable ();                                                    \
   } while (0)
index 842fd36d25c941291d01e8902b87c6f663facc41..e06a2849d909306aa570be8aff26b08803e87531 100644 (file)
@@ -46,6 +46,9 @@ Enum(gpu_type) String(gfx1030) Value(PROCESSOR_GFX1030)
 EnumValue
 Enum(gpu_type) String(gfx1100) Value(PROCESSOR_GFX1100)
 
+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)
 Specify the name of the target GPU.
index fe443abba2176f209294a3b39f080b31e5f3254b..58eeada82958161baba565be07186f1ffd228dcb 100644 (file)
@@ -61,6 +61,8 @@
 #define EF_AMDGPU_MACH_AMDGCN_GFX1030 0x36
 #undef  EF_AMDGPU_MACH_AMDGCN_GFX1100
 #define EF_AMDGPU_MACH_AMDGCN_GFX1100 0x41
+#undef  EF_AMDGPU_MACH_AMDGCN_GFX1103
+#define EF_AMDGPU_MACH_AMDGCN_GFX1103 0x44
 
 #define EF_AMDGPU_FEATURE_XNACK_V4     0x300  /* Mask.  */
 #define EF_AMDGPU_FEATURE_XNACK_UNSUPPORTED_V4 0x000
@@ -971,6 +973,8 @@ main (int argc, char **argv)
        elf_arch = EF_AMDGPU_MACH_AMDGCN_GFX1030;
       else if (strcmp (argv[i], "-march=gfx1100") == 0)
        elf_arch = EF_AMDGPU_MACH_AMDGCN_GFX1100;
+      else if (strcmp (argv[i], "-march=gfx1103") == 0)
+       elf_arch = EF_AMDGPU_MACH_AMDGCN_GFX1103;
 #define STR "-mstack-size="
       else if (startswith (argv[i], STR))
        gcn_stack_size = atoi (argv[i] + strlen (STR));
@@ -1013,6 +1017,7 @@ main (int argc, char **argv)
     case EF_AMDGPU_MACH_AMDGCN_GFX803:
     case EF_AMDGPU_MACH_AMDGCN_GFX1030:
     case EF_AMDGPU_MACH_AMDGCN_GFX1100:
+    case EF_AMDGPU_MACH_AMDGCN_GFX1103:
       SET_XNACK_UNSET (elf_flags);
       SET_SRAM_ECC_UNSET (elf_flags);
       break;
index 2315ad594a380489bea14787ae49e13563d635d3..037df2657ccf2d537ac24c2ba72d8ab877deddc4 100644 (file)
@@ -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 gfx1030 gfx1100 >> $@
+       echo isa: fiji gfx803 gfx900 gfx906 gfx908 gfx90a gfx1030 gfx1100 gfx1103 >> $@
index 014ca25aa628d6d140334cf7a7181d585dc75678..a9872e86beefe43eecf0223de477d36898888783 100644 (file)
@@ -1266,11 +1266,11 @@ default set of libraries is selected based on the value of
 @item amdgcn*-*-*
 @var{list} is a comma separated list of ISA names (allowed values: @code{fiji},
 @code{gfx900}, @code{gfx906}, @code{gfx908}, @code{gfx90a}, @code{gfx1030},
-@code{gfx1100}).  It ought not include the name of the default ISA, specified
-via @option{--with-arch}.  If @var{list} is empty, then there will be no
-multilibs and only the default run-time library will be built.  If @var{list}
-is @code{default} or @option{--with-multilib-list=} is not specified, then
-the default set of libraries is selected.
+@code{gfx1100}, @code{gfx1103}).  It ought not include the name of the default
+ISA, specified via @option{--with-arch}.  If @var{list} is empty, then there
+will be no multilibs and only the default run-time library will be built.  If
+@var{list} is @code{default} or @option{--with-multilib-list=} is not
+specified, then the default set of libraries is selected.
 
 @item arm*-*-*
 @var{list} is a comma separated list of @code{aprofile} and
@@ -3940,7 +3940,8 @@ Instead of GNU Binutils, you will need to install LLVM 15, or later, and copy
 @file{bin/llvm-nm} to @file{amdgcn-amdhsa/bin/nm}, and
 @file{bin/llvm-ar} to both @file{bin/amdgcn-amdhsa-ar} and
 @file{bin/amdgcn-amdhsa-ranlib}.  Note that LLVM 13.0.1 or LLVM 14 can be used
-by specifying a @code{--with-multilib-list=} that does not list @code{gfx1100}.
+by specifying a @code{--with-multilib-list=} that does not list @code{gfx1100}
+and @code{gfx1103}.
 
 Use Newlib (4.3.0 or newer; 4.4.0 or later is recommended).
 
index e0950ca5dc2add6716d530bafe7ffd8aab12db4d..e7b96212354479a78e828bc9bb3a7409abec828a 100644 (file)
@@ -21795,6 +21795,9 @@ Compile for RDNA2 gfx1030 devices (GFX10 series).
 @item gfx1100
 Compile for RDNA3 gfx1100 devices (GFX11 series).
 
+@item gfx1103
+Compile for RDNA3 gfx1103 devices (GFX11 series).
+
 @end table
 
 @opindex msram-ecc
index 7e141a85f310fd66c32ed00b2bdd1328ea16efe1..53dc1c7d23ad69e9e1eaa5047749e24d6e60a83d 100644 (file)
@@ -391,7 +391,8 @@ typedef enum {
   EF_AMDGPU_MACH_AMDGCN_GFX908 = 0x030,
   EF_AMDGPU_MACH_AMDGCN_GFX90a = 0x03f,
   EF_AMDGPU_MACH_AMDGCN_GFX1030 = 0x036,
-  EF_AMDGPU_MACH_AMDGCN_GFX1100 = 0x041
+  EF_AMDGPU_MACH_AMDGCN_GFX1100 = 0x041,
+  EF_AMDGPU_MACH_AMDGCN_GFX1103 = 0x044
 } EF_AMDGPU_MACH;
 
 const static int EF_AMDGPU_MACH_MASK = 0x000000ff;
@@ -1677,6 +1678,7 @@ const static char *gcn_gfx908_s = "gfx908";
 const static char *gcn_gfx90a_s = "gfx90a";
 const static char *gcn_gfx1030_s = "gfx1030";
 const static char *gcn_gfx1100_s = "gfx1100";
+const static char *gcn_gfx1103_s = "gfx1103";
 const static int gcn_isa_name_len = 7;
 
 /* Returns the name that the HSA runtime uses for the ISA or NULL if we do not
@@ -1700,6 +1702,8 @@ isa_hsa_name (int isa) {
       return gcn_gfx1030_s;
     case EF_AMDGPU_MACH_AMDGCN_GFX1100:
       return gcn_gfx1100_s;
+    case EF_AMDGPU_MACH_AMDGCN_GFX1103:
+      return gcn_gfx1103_s;
     }
   return NULL;
 }
@@ -1745,6 +1749,9 @@ isa_code(const char *isa) {
   if (!strncmp (isa, gcn_gfx1100_s, gcn_isa_name_len))
     return EF_AMDGPU_MACH_AMDGCN_GFX1100;
 
+  if (!strncmp (isa, gcn_gfx1103_s, gcn_isa_name_len))
+    return EF_AMDGPU_MACH_AMDGCN_GFX1103;
+
   return EF_AMDGPU_MACH_UNSUPPORTED;
 }
 
@@ -1765,6 +1772,7 @@ max_isa_vgprs (int isa)
     case EF_AMDGPU_MACH_AMDGCN_GFX1030:
       return 512;  /* 512 SIMD32 = 256 wavefrontsize64.  */
     case EF_AMDGPU_MACH_AMDGCN_GFX1100:
+    case EF_AMDGPU_MACH_AMDGCN_GFX1103:
       return 1536; /* 1536 SIMD32 = 768 wavefrontsize64.  */
     }
   GOMP_PLUGIN_fatal ("unhandled ISA in max_isa_vgprs");