[committed] amdgcn: Don't double-count AVGPRs
Checks
Commit Message
This patch fixes a runtime error with offload kernels that use a lot of
registers, such as libgomp.fortran/target1.f90.
Committed to mainline.
Andrew
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.
@@ -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",
- ®count.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;
}