This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 4/5] [amdgcn] Update lower limits requested by non-leaf kernels
- From: Kwok Cheung Yeung <kcy at codesourcery dot com>
- To: <gcc-patches at gcc dot gnu dot org>, Andrew Stubbs <ams at codesourcery dot com>, Julian Brown <julian at codesourcery dot com>
- Date: Thu, 14 Nov 2019 15:33:06 +0000
- Subject: [PATCH 4/5] [amdgcn] Update lower limits requested by non-leaf kernels
- Ironport-sdr: sDJ3LVWW7cqyP4MZ2eWnHTimTu15TcEoqgK3MJgHDVF041nuT8m0kAtdMRSOZYxyZU/CX8/9Ko OIxqMKrCy1HvcGa32uqCmxbWKRdpVFZPY0LjJ/7qBLtAzH06oT++oa82tjA9BmGlh7BGOIWSSn VXDZTXtEx+KAJ/nuEbf8llKNiaH85YXmQ8UPzyrNBYboyvrE1UUXWYvBzi85Lph4z0p9lLV3o7 BpynGhHjc5deTJkuyhEih3SqTb9XyERN4twSfi253wyEWVhQz7JOUDjXT6oxXPigktbTMJ0LjN Usk=
- Ironport-sdr: UTqE6V8on0m+ki1LQJhzF01dt45PcrMX3iCAKa9x69jqaarYXQ5zdTd/vZQC/IUoxYdUdgQ4VF g6bHW8XYPROKYC/ZOiozAAajOVrPunogIxha/ZR6JOxG0uwarpiuGFY89NJ29qeJPmR8DHP9nk 8YWD8esBD7jtdhszcJNNHEquZrrs/mE13p4HSqVpXCbbkwtzTukI9PanoTAN7VBBIc2Llyy9sP emVymakQC47s7aOAwK4F2icOaxmlhmBZa1ztAA1ljej7ZmMh4vzI9dUTYOt5W+p6ja9cmvpj7h FpM=
- References: <0b37b07a-be6c-2ac6-c579-c7a522024419@codesourcery.com>
The kernel attributes are changed to request at least 64 SGPRs and 24
VGPRs (i.e. the non-kernel maximum, otherwise the callees may not have
enough registers to run in) for non-leaf kernels to take advantage of
the reduced number of registers used in non-kernel functions.
Okay for trunk?
Kwok
2019-11-14 Kwok Cheung Yeung <kcy@codesourcery.com>
gcc/
* config/gcn/gcn.c (MAX_NORMAL_SGPR_COUNT, MAX_NORMAL_VGPR_COUNT): New.
(gcn_conditional_register_usage): Use constants in place of hard-coded
values.
(gcn_hsa_declare_function_name): Set lower bound for number of
SGPRs/VGPRs in
non-leaf kernels to MAX_NORMAL_SGPR_COUNT and MAX_NORMAL_VGPR_COUNT.
---
gcc/config/gcn/gcn.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/gcc/config/gcn/gcn.c b/gcc/config/gcn/gcn.c
index 8a2f7d7..976843b 100644
--- a/gcc/config/gcn/gcn.c
+++ b/gcc/config/gcn/gcn.c
@@ -75,6 +75,12 @@ int gcn_isa = 3; /* Default to GCN3. */
#define LDS_SIZE 65536
+/* The number of registers usable by normal non-kernel functions.
+ The SGPR count includes any special extra registers such as VCC. */
+
+#define MAX_NORMAL_SGPR_COUNT 64
+#define MAX_NORMAL_VGPR_COUNT 24
+
/* }}} */
/* {{{ Initialization and options. */
@@ -2049,10 +2055,12 @@ gcn_conditional_register_usage (void)
if (cfun->machine->normal_function)
{
/* Restrict the set of SGPRs and VGPRs used by non-kernel
functions. */
- for (int i = SGPR_REGNO (62); i <= LAST_SGPR_REG; i++)
+ for (int i = SGPR_REGNO (MAX_NORMAL_SGPR_COUNT - 2);
+ i <= LAST_SGPR_REG; i++)
fixed_regs[i] = 1, call_used_regs[i] = 1;
- for (int i = VGPR_REGNO (24); i <= LAST_VGPR_REG; i++)
+ for (int i = VGPR_REGNO (MAX_NORMAL_VGPR_COUNT);
+ i <= LAST_VGPR_REG; i++)
fixed_regs[i] = 1, call_used_regs[i] = 1;
return;
@@ -4905,10 +4913,10 @@ gcn_hsa_declare_function_name (FILE *file, const
char *name, tree)
if (!leaf_function_p ())
{
/* We can't know how many registers function calls might use. */
- if (vgpr < 64)
- vgpr = 64;
- if (sgpr + extra_regs < 102)
- sgpr = 102 - extra_regs;
+ if (vgpr < MAX_NORMAL_VGPR_COUNT)
+ vgpr = MAX_NORMAL_VGPR_COUNT;
+ if (sgpr + extra_regs < MAX_NORMAL_SGPR_COUNT)
+ sgpr = MAX_NORMAL_SGPR_COUNT - extra_regs;
}
fputs ("\t.align\t256\n", file);
--
2.8.1