amdgcn: Add gfx908 support

gcc/

	* config/gcn/gcn-opts.h (enum processor_type): Add PROCESSOR_GFX908.
	* config/gcn/gcn.c (gcn_omp_device_kind_arch_isa): Add gfx908.
	(output_file_start): Add gfx908.
	* config/gcn/gcn.opt (gpu_type): Add gfx908.
	* config/gcn/t-gcn-hsa (MULTILIB_OPTIONS): Add march=gfx908.
	(MULTILIB_DIRNAMES): Add gfx908.
	* config/gcn/mkoffload.c (EF_AMDGPU_MACH_AMDGCN_GFX908): New define.
	(main): Recognize gfx908.
	* config/gcn/t-omp-device: Add gfx908.

libgomp/

	* plugin/plugin-gcn.c (EF_AMDGPU_MACH): Add
	EF_AMDGPU_MACH_AMDGCN_GFX908.
	(gcn_gfx908_s): New constant string.
	(isa_hsa_name): Add gfx908.
	(isa_code): Add gfx908.
This commit is contained in:
Andrew Stubbs 2020-10-22 21:23:48 +01:00
parent 9633e57976
commit 3535402e20
7 changed files with 22 additions and 4 deletions

View File

@ -22,7 +22,8 @@ enum processor_type
{
PROCESSOR_FIJI, // gfx803
PROCESSOR_VEGA10, // gfx900
PROCESSOR_VEGA20 // gfx906
PROCESSOR_VEGA20, // gfx906
PROCESSOR_GFX908 // as yet unnamed
};
/* Set in gcn_option_override. */

View File

@ -2589,6 +2589,8 @@ gcn_omp_device_kind_arch_isa (enum omp_device_kind_arch_isa trait,
return gcn_arch == PROCESSOR_VEGA10;
if (strcmp (name, "gfx906") == 0)
return gcn_arch == PROCESSOR_VEGA20;
if (strcmp (name, "gfx908") == 0)
return gcn_arch == PROCESSOR_GFX908;
return 0;
default:
gcc_unreachable ();
@ -5030,6 +5032,7 @@ output_file_start (void)
case PROCESSOR_FIJI: cpu = "gfx803"; break;
case PROCESSOR_VEGA10: cpu = "gfx900"; break;
case PROCESSOR_VEGA20: cpu = "gfx906"; break;
case PROCESSOR_GFX908: cpu = "gfx908+sram-ecc"; break;
default: gcc_unreachable ();
}

View File

@ -34,6 +34,9 @@ Enum(gpu_type) String(gfx900) Value(PROCESSOR_VEGA10)
EnumValue
Enum(gpu_type) String(gfx906) Value(PROCESSOR_VEGA20)
EnumValue
Enum(gpu_type) String(gfx908) Value(PROCESSOR_GFX908)
march=
Target RejectNegative Joined ToLower Enum(gpu_type) Var(gcn_arch) Init(PROCESSOR_FIJI)
Specify the name of the target GPU.

View File

@ -51,6 +51,8 @@
#define EF_AMDGPU_MACH_AMDGCN_GFX900 0x2c
#undef EF_AMDGPU_MACH_AMDGCN_GFX906
#define EF_AMDGPU_MACH_AMDGCN_GFX906 0x2f
#undef EF_AMDGPU_MACH_AMDGCN_GFX908
#define EF_AMDGPU_MACH_AMDGCN_GFX908 0x230 // Assume SRAM-ECC enabled.
#ifndef R_AMDGPU_NONE
#define R_AMDGPU_NONE 0
@ -856,6 +858,8 @@ main (int argc, char **argv)
elf_arch = EF_AMDGPU_MACH_AMDGCN_GFX900;
else if (strcmp (argv[i], "-march=gfx906") == 0)
elf_arch = EF_AMDGPU_MACH_AMDGCN_GFX906;
else if (strcmp (argv[i], "-march=gfx908") == 0)
elf_arch = EF_AMDGPU_MACH_AMDGCN_GFX908;
}
if (!(fopenacc ^ fopenmp))

View File

@ -42,8 +42,8 @@ ALL_HOST_OBJS += gcn-run.o
gcn-run$(exeext): gcn-run.o
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $< -ldl
MULTILIB_OPTIONS = march=gfx900/march=gfx906
MULTILIB_DIRNAMES = gfx900 gfx906
MULTILIB_OPTIONS = march=gfx900/march=gfx906/march=gfx908
MULTILIB_DIRNAMES = gfx900 gfx906 gfx908
gcn-tree.o: $(srcdir)/config/gcn/gcn-tree.c
$(COMPILE) $<

View File

@ -1,4 +1,4 @@
omp-device-properties-gcn: $(srcdir)/config/gcn/gcn.c
echo kind: gpu > $@
echo arch: gcn >> $@
echo isa: fiji gfx900 gfx906 >> $@
echo isa: fiji gfx900 gfx906 gfx908 >> $@

View File

@ -403,6 +403,7 @@ typedef enum {
EF_AMDGPU_MACH_AMDGCN_GFX803 = 0x02a,
EF_AMDGPU_MACH_AMDGCN_GFX900 = 0x02c,
EF_AMDGPU_MACH_AMDGCN_GFX906 = 0x02f,
EF_AMDGPU_MACH_AMDGCN_GFX908 = 0x030
} EF_AMDGPU_MACH;
const static int EF_AMDGPU_MACH_MASK = 0x000000ff;
@ -1596,6 +1597,7 @@ elf_gcn_isa_field (Elf64_Ehdr *image)
const static char *gcn_gfx803_s = "gfx803";
const static char *gcn_gfx900_s = "gfx900";
const static char *gcn_gfx906_s = "gfx906";
const static char *gcn_gfx908_s = "gfx908";
const static int gcn_isa_name_len = 6;
/* Returns the name that the HSA runtime uses for the ISA or NULL if we do not
@ -1611,6 +1613,8 @@ isa_hsa_name (int isa) {
return gcn_gfx900_s;
case EF_AMDGPU_MACH_AMDGCN_GFX906:
return gcn_gfx906_s;
case EF_AMDGPU_MACH_AMDGCN_GFX908:
return gcn_gfx908_s;
}
return NULL;
}
@ -1644,6 +1648,9 @@ isa_code(const char *isa) {
if (!strncmp (isa, gcn_gfx906_s, gcn_isa_name_len))
return EF_AMDGPU_MACH_AMDGCN_GFX906;
if (!strncmp (isa, gcn_gfx908_s, gcn_isa_name_len))
return EF_AMDGPU_MACH_AMDGCN_GFX908;
return -1;
}