Hi Andrew,
it it looks good at a glance. We surely will need add more columns in
the future.
In particular, I would add a new first column for the generic version,
albeit currently unused; consider to include it already now.*
Tobias
(*) When eventually adding 'gfx-*-generic' support, more work will be
needed,like switching to code object V6 (only) for them (implies a
rather new LLVM) and to handling them in libgomp and mkoffload.cc. But
IMHO, we could include this change already to avoid later column order
changes (and IMHO having gen_ver first makes sense). Add 'unsigned gen_ver;' to the struct, 0 == non-generic, 1 to 255 for the
generic version. Currently, we have only '0' - now as first entry in
gcn-devices.def.
gcc/config/gcn/gcn-devices.def | 37 ++++++++++++++++----------------
gcc/config/gcn/gcn-opts.h | 2 +-
gcc/config/gcn/gcn.cc | 4 ++--
gcc/config/gcn/gcn.h | 1 +
gcc/config/gcn/gen-gcn-device-macros.awk | 2 +-
gcc/config/gcn/gen-opt-tables.awk | 2 +-
gcc/config/gcn/mkoffload.cc | 10 +++++----
7 files changed, 31 insertions(+), 27 deletions(-)
diff --git a/gcc/config/gcn/gcn-devices.def b/gcc/config/gcn/gcn-devices.def
index f2dbe18b6ae..d308e032721 100644
--- a/gcc/config/gcn/gcn-devices.def
+++ b/gcc/config/gcn/gcn-devices.def
@@ -37 +37,2 @@
- 0 "name" (text, external)
+ 0 Generic flag/version (0 = non-generic, 1 to 255 = generic version)
+ 1 "name" (text, external)
@@ -40 +41 @@
- 1 "NAME" (text, external)
+ 2 "NAME" (text, external)
@@ -42 +43 @@
- 2 "ELF" (hex integer, external)
+ 3 "ELF" (hex integer, external)
@@ -44 +45 @@
- 3 "ISA" (enum gcn_isa, internal)
+ 4 "ISA" (enum gcn_isa, internal)
@@ -46 +47 @@
- 4 "XNACK default" (enum hsaco_attr_type, internal)
+ 5 "XNACK default" (enum hsaco_attr_type, internal)
@@ -49 +50 @@
- 5 "SRAM_ECC default" (enum hsaco_attr_type, internal)
+ 6 "SRAM_ECC default" (enum hsaco_attr_type, internal)
@@ -52 +53 @@
- 6 "WAVE64 mode" (enum hsaco_attr_type, internal)
+ 7 "WAVE64 mode" (enum hsaco_attr_type, internal)
@@ -56 +57 @@
- 7 "CU mode" (enum hsaco_attr_type, internal)
+ 8 "CU mode" (enum hsaco_attr_type, internal)
@@ -60 +61 @@
- 8 "Max ISA VGPRs" (integer, internal)
+ 9 "Max ISA VGPRs" (integer, internal)
@@ -71 +72 @@
-GCN_DEVICE(gfx900, GFX900, 0x2c, ISA_GCN5,
+GCN_DEVICE(0, gfx900, GFX900, 0x2c, ISA_GCN5,
@@ -79 +80 @@ GCN_DEVICE(gfx900, GFX900, 0x2c, ISA_GCN5,
-GCN_DEVICE(gfx906, GFX906, 0x2f, ISA_GCN5,
+GCN_DEVICE(0, gfx906, GFX906, 0x2f, ISA_GCN5,
@@ -87 +88 @@ GCN_DEVICE(gfx906, GFX906, 0x2f, ISA_GCN5,
-GCN_DEVICE(gfx908, GFX908, 0x30, ISA_CDNA1,
+GCN_DEVICE(0, gfx908, GFX908, 0x30, ISA_CDNA1,
@@ -95 +96 @@ GCN_DEVICE(gfx908, GFX908, 0x30, ISA_CDNA1,
-GCN_DEVICE(gfx90a, GFX90A, 0x3f, ISA_CDNA2,
+GCN_DEVICE(0, gfx90a, GFX90A, 0x3f, ISA_CDNA2,
@@ -103 +104 @@ GCN_DEVICE(gfx90a, GFX90A, 0x3f, ISA_CDNA2,
-GCN_DEVICE(gfx90c, GFX90C, 0x32, ISA_GCN5,
+GCN_DEVICE(0, gfx90c, GFX90C, 0x32, ISA_GCN5,
@@ -111 +112 @@ GCN_DEVICE(gfx90c, GFX90C, 0x32, ISA_GCN5,
-GCN_DEVICE(gfx1030, GFX1030, 0x36, ISA_RDNA2,
+GCN_DEVICE(0, gfx1030, GFX1030, 0x36, ISA_RDNA2,
@@ -119 +120 @@ GCN_DEVICE(gfx1030, GFX1030, 0x36, ISA_RDNA2,
-GCN_DEVICE(gfx1036, GFX1036, 0x45, ISA_RDNA2,
+GCN_DEVICE(0, gfx1036, GFX1036, 0x45, ISA_RDNA2,
@@ -127 +128 @@ GCN_DEVICE(gfx1036, GFX1036, 0x45, ISA_RDNA2,
-GCN_DEVICE(gfx1100, GFX1100, 0x41, ISA_RDNA3,
+GCN_DEVICE(0, gfx1100, GFX1100, 0x41, ISA_RDNA3,
@@ -135 +136 @@ GCN_DEVICE(gfx1100, GFX1100, 0x41, ISA_RDNA3,
-GCN_DEVICE(gfx1103, GFX1103, 0x44, ISA_RDNA3,
+GCN_DEVICE(0, gfx1103, GFX1103, 0x44, ISA_RDNA3,
diff --git a/gcc/config/gcn/gcn-opts.h b/gcc/config/gcn/gcn-opts.h
index 0026becdedc..8447660e89f 100644
--- a/gcc/config/gcn/gcn-opts.h
+++ b/gcc/config/gcn/gcn-opts.h
@@ -23 +23 @@ enum processor_type
-#define GCN_DEVICE(name, NAME, ...) \
+#define GCN_DEVICE(gen_ver, name, NAME, ...) \
diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc
index 3dc6acfa950..fa14f0c54f8 100644
--- a/gcc/config/gcn/gcn.cc
+++ b/gcc/config/gcn/gcn.cc
@@ -104,2 +104,2 @@ const struct gcn_device_def gcn_devices[] = {
-#define GCN_DEVICE(name, NAME, ELF, ISA, XNACK, SRAMECC, WAVE64, CU, VGPRS) \
- {PROCESSOR_ ## NAME, #name, #NAME, ISA, XNACK, SRAMECC, WAVE64, CU, VGPRS},
+#define GCN_DEVICE(gen_ver, name, NAME, ELF, ISA, XNACK, SRAMECC, WAVE64, CU, VGPRS) \
+ {gen_ver, PROCESSOR_ ## NAME, #name, #NAME, ISA, XNACK, SRAMECC, WAVE64, CU, VGPRS},
diff --git a/gcc/config/gcn/gcn.h b/gcc/config/gcn/gcn.h
index ff508406ff1..1855b03db14 100644
--- a/gcc/config/gcn/gcn.h
+++ b/gcc/config/gcn/gcn.h
@@ -19,0 +20 @@ extern const struct gcn_device_def {
+ unsigned gen_ver;
diff --git a/gcc/config/gcn/gen-gcn-device-macros.awk b/gcc/config/gcn/gen-gcn-device-macros.awk
index 6352fa5fa3e..bb17d04d531 100644
--- a/gcc/config/gcn/gen-gcn-device-macros.awk
+++ b/gcc/config/gcn/gen-gcn-device-macros.awk
@@ -31 +31 @@ BEGIN {
- gfx=$2
+ gfx=$3
diff --git a/gcc/config/gcn/gen-opt-tables.awk b/gcc/config/gcn/gen-opt-tables.awk
index 9fbe4cfe81f..0a1131351b6 100644
--- a/gcc/config/gcn/gen-opt-tables.awk
+++ b/gcc/config/gcn/gen-opt-tables.awk
@@ -54 +54 @@ BEGIN {
- print "Enum(gpu_type) String(" $2 ") Value(PROCESSOR_" $3 ")"
+ print "Enum(gpu_type) String(" $3 ") Value(PROCESSOR_" $4 ")"
diff --git a/gcc/config/gcn/mkoffload.cc b/gcc/config/gcn/mkoffload.cc
index cebb9e506fb..bd111631844 100644
--- a/gcc/config/gcn/mkoffload.cc
+++ b/gcc/config/gcn/mkoffload.cc
@@ -54 +54 @@ enum elf_arch_code {
-#define GCN_DEVICE(name, NAME, ELF_ARCH, ...) \
+#define GCN_DEVICE(gen_ver, name, NAME, ELF_ARCH, ...) \
@@ -71,0 +72,2 @@ enum elf_arch_code {
+#define EF_AMDGPU_GENERIC_VERSION_V 0xff000000 /* Mask. */
+
@@ -791 +793 @@ get_arch (const char *str, const char *with_arch_str)
-#define GCN_DEVICE(name, NAME, ELF, ...) \
+#define GCN_DEVICE(gen_ver, name, NAME, ELF, ...) \
@@ -1008 +1010 @@ main (int argc, char **argv)
-#define GCN_DEVICE(name, NAME, ELF, ISA, XNACK, SRAM, ...) \
+#define GCN_DEVICE(gen_ver, name, NAME, ELF, ISA, XNACK, SRAM, ...) \
@@ -1025 +1027 @@ main (int argc, char **argv)
-#define GCN_DEVICE(name, NAME, ELF, ISA, XNACK, SRAM, ...) \
+#define GCN_DEVICE(gen_ver, name, NAME, ELF, ISA, XNACK, SRAM, ...) \