From: Andrew Stubbs Date: Wed, 3 Jan 2024 16:18:43 +0000 (+0000) Subject: amdgcn: Don't double-count AVGPRs X-Git-Tag: basepoints/gcc-15~3143 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c5c3aab38132ea34dc1ee69d93fded787e6ac7a4;p=thirdparty%2Fgcc.git 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 3341c0d34eba..03cd040dbd2c 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", - ®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; }