diff options
author | Kwok Cheung Yeung <kcy@codesourcery.com> | 2019-11-15 16:32:29 +0000 |
---|---|---|
committer | Kwok Cheung Yeung <kcy@gcc.gnu.org> | 2019-11-15 16:32:29 +0000 |
commit | 87fdbe697bb02faf054a21c5a593e51d538fe1a7 (patch) | |
tree | 3c09462b26a4762ed36b6e0bfabeeb4c69718958 | |
parent | 1ca59cbe15c56dce1efb1ed26863ee01109d513f (diff) | |
download | gcc-87fdbe697bb02faf054a21c5a593e51d538fe1a7.zip gcc-87fdbe697bb02faf054a21c5a593e51d538fe1a7.tar.gz gcc-87fdbe697bb02faf054a21c5a593e51d538fe1a7.tar.bz2 |
[amdgcn] Update lower bounds for the number of registers in non-leaf kernels
Reduce the lower limits on the number of registers requested by non-leaf
kernels to help improve CU occupancy.
2019-11-15 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.
From-SVN: r278305
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/config/gcn/gcn.c | 20 |
2 files changed, 23 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ef4f77e..8c06b82 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-11-15 Kwok Cheung Yeung <kcy@codesourcery.com> + + * 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. + 2019-11-15 Martin Jambor <mjambor@suse.cz> * ipa-utils.h (ipa_remove_useless_jump_functions): Remove stray diff --git a/gcc/config/gcn/gcn.c b/gcc/config/gcn/gcn.c index 383e0aa..4401896 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. */ @@ -2053,10 +2059,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; @@ -4908,10 +4916,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); |