aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTobias Burnus <tburnus@baylibre.com>2025-02-07 13:22:08 +0100
committerTobias Burnus <tburnus@baylibre.com>2025-02-07 13:22:08 +0100
commit6aa3329b3430c6362ddf51e403d147e0b10d7401 (patch)
treefdec8a15b14b679d7a27d937a05553d0a944e3a2 /gcc
parent8561e4e2903ae0b4aff1ed1dc9e9871c89df6b43 (diff)
downloadgcc-6aa3329b3430c6362ddf51e403d147e0b10d7401.zip
gcc-6aa3329b3430c6362ddf51e403d147e0b10d7401.tar.gz
gcc-6aa3329b3430c6362ddf51e403d147e0b10d7401.tar.bz2
[gcn] Fix the output amdhsa.version
The amdhsa.version depends on the code object version; while V3 had 1.0, V4 has 1.1 and V5 (and V6) have 1.2. GCC used 1.0 but generated since a while either V4 or, with -march=gfx...-generic, V6. Now it uses the proper version again. gcc/ChangeLog: * config/gcn/gcn.cc (gcn_hsa_declare_function_name): Update 'amdhsa.version' output to match used code version. * config/gcn/gen-gcn-device-macros.awk: Add a comment to crosslink.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/gcn/gcn.cc17
-rw-r--r--gcc/config/gcn/gen-gcn-device-macros.awk4
2 files changed, 14 insertions, 7 deletions
diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc
index 82fc6ff..b0c06d5 100644
--- a/gcc/config/gcn/gcn.cc
+++ b/gcc/config/gcn/gcn.cc
@@ -6671,12 +6671,17 @@ gcn_hsa_declare_function_name (FILE *file, const char *name,
#if 1
/* The following is YAML embedded in assembler; tabs are not allowed. */
- fputs (" .amdgpu_metadata\n"
- " amdhsa.version:\n"
- " - 1\n"
- " - 0\n"
- " amdhsa.kernels:\n"
- " - .name: ", file);
+
+ /* 'amdhsa.version': code object V3 = 1.0, V4 = 1.1, V5/V6 = 1.2. */
+ /* Keep in sync with 'amdhsa-code-object' in gen-gcn-device-macros.awk. */
+ fprintf (file,
+ " .amdgpu_metadata\n"
+ " amdhsa.version:\n"
+ " - 1\n"
+ " - %d\n"
+ " amdhsa.kernels:\n"
+ " - .name: ",
+ gcn_devices[gcn_arch].generic_version ? 2 /* V6 */ : 1 /* V4 */);
assemble_name (file, name);
fputs ("\n .symbol: ", file);
assemble_name (file, name);
diff --git a/gcc/config/gcn/gen-gcn-device-macros.awk b/gcc/config/gcn/gen-gcn-device-macros.awk
index aa27100..d227e6f 100644
--- a/gcc/config/gcn/gen-gcn-device-macros.awk
+++ b/gcc/config/gcn/gen-gcn-device-macros.awk
@@ -117,7 +117,9 @@ BEGIN {
# 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.
# Code object V6 is supported since LLVM 19.
-
+#
+# Keep in sync with 'amdhsa.version' in gcn.cc
+#
END {
print ""
print ""