public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] amdgcn: Match new XNACK defaults in mkoffload
@ 2024-01-08 10:03 Andrew Stubbs
  0 siblings, 0 replies; only message in thread
From: Andrew Stubbs @ 2024-01-08 10:03 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 248 bytes --]

This patch fixes build failures with the offload toolchain since my 
recent XNACK patch. The problem was simply that mkoffload made 
out-of-date assumptions about the -mxnack defaults. This patch fixes the 
mismatch.

Committed to mainline.

Andrew

[-- Attachment #2: 240108-fix-avgprs-mkoffload.patch --]
[-- Type: text/plain, Size: 2431 bytes --]

amdgcn: Don't double-count AVGPRs

CDNA2 devices have VGPRs and AVGPRs combined into a single hardware register
file (they're seperate in CDNA1).  I originally thought they were counted
separately in the vgpr_count and agpr_count metadata fields, and therefore
mkoffload had to account for this when passing the values to libgomp.  However,
that wasn't the case, and this code should have been removed when I corrected
the calculations in gcn.cc.  Fixing the error now.

gcc/ChangeLog:

	* config/gcn/mkoffload.cc (isa_has_combined_avgprs): Delete.
	(process_asm): Don't count avgprs.

diff --git a/gcc/config/gcn/mkoffload.cc b/gcc/config/gcn/mkoffload.cc
index 3341c0d34eb..03cd040dbd2 100644
--- a/gcc/config/gcn/mkoffload.cc
+++ b/gcc/config/gcn/mkoffload.cc
@@ -471,26 +471,6 @@ copy_early_debug_info (const char *infile, const char *outfile)
   return true;
 }
 
-/* CDNA2 devices have twice as many VGPRs compared to older devices,
-   but the AVGPRS are allocated from the same pool.  */
-
-static int
-isa_has_combined_avgprs (int isa)
-{
-  switch (isa)
-    {
-    case EF_AMDGPU_MACH_AMDGCN_GFX803:
-    case EF_AMDGPU_MACH_AMDGCN_GFX900:
-    case EF_AMDGPU_MACH_AMDGCN_GFX906:
-    case EF_AMDGPU_MACH_AMDGCN_GFX908:
-    case EF_AMDGPU_MACH_AMDGCN_GFX1030:
-      return false;
-    case EF_AMDGPU_MACH_AMDGCN_GFX90a:
-      return true;
-    }
-  fatal_error (input_location, "unhandled ISA in isa_has_combined_avgprs");
-}
-
 /* Parse an input assembler file, extract the offload tables etc.,
    and output (1) the assembler code, minus the tables (which can contain
    problematic relocations), and (2) a C file with the offload tables
@@ -516,7 +496,6 @@ process_asm (FILE *in, FILE *out, FILE *cfile)
   {
     int sgpr_count;
     int vgpr_count;
-    int avgpr_count;
     char *kernel_name;
   } regcount = { -1, -1, NULL };
 
@@ -564,12 +543,6 @@ process_asm (FILE *in, FILE *out, FILE *cfile)
 		gcc_assert (regcount.kernel_name);
 		break;
 	      }
-	    else if (sscanf (buf, " .agpr_count: %d\n",
-			     &regcount.avgpr_count) == 1)
-	      {
-		gcc_assert (regcount.kernel_name);
-		break;
-	      }
 
 	    break;
 	  }
@@ -712,8 +685,6 @@ process_asm (FILE *in, FILE *out, FILE *cfile)
 	  {
 	    sgpr_count = regcounts[j].sgpr_count;
 	    vgpr_count = regcounts[j].vgpr_count;
-	    if (isa_has_combined_avgprs (elf_arch))
-	      vgpr_count += regcounts[j].avgpr_count;
 	    break;
 	  }
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-08 10:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-08 10:03 [committed] amdgcn: Match new XNACK defaults in mkoffload Andrew Stubbs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).