]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[gcn] Fix the output amdhsa.version
authorTobias Burnus <tburnus@baylibre.com>
Fri, 7 Feb 2025 12:22:08 +0000 (13:22 +0100)
committerTobias Burnus <tburnus@baylibre.com>
Fri, 7 Feb 2025 12:22:08 +0000 (13:22 +0100)
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.

gcc/config/gcn/gcn.cc
gcc/config/gcn/gen-gcn-device-macros.awk

index 82fc6ff1e4134194dce5af1b28de1fd5e67b23ef..b0c06d5e6320902f6baee4e594f91f16325e8902 100644 (file)
@@ -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);
index aa271004c27bf5a3bb5dd635427fad47c0eea438..d227e6fcedfd1a1704cf57f42ce24441261be622 100644 (file)
@@ -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 ""