public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 0/6] IPA cleanups and IPA-CP improvements for 548.exchange2_r
@ 2020-09-29 18:12 Martin Jambor
  2020-09-21 14:25 ` [PATCH 5/6] ipa-cp: Add dumping of overall_size after cloning Martin Jambor
                   ` (5 more replies)
  0 siblings, 6 replies; 18+ messages in thread
From: Martin Jambor @ 2020-09-29 18:12 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jan Hubicka

Hi,

this patch set is a result of rebasing the one I sent here three weeks
ago on current trunk.  Last week I also checked the WPA memory
requirements when building Firefox and it did not change from the
unpatched numbers.

Bootstrapped and tested and LTO bootstrapped on x86-64.  OK for trunk?

Thanks,


Martin




Martin Jambor (6):
  ipa: Bundle vectors describing argument values
  ipa: Introduce ipa_cached_call_context
  ipa: Bundle estimates of ipa_call_context::estimate_size_and_time
  ipa: Multiple predicates for loop properties, with frequencies
  ipa-cp: Add dumping of overall_size after cloning
  ipa-cp: Separate and increase the large-unit parameter

 gcc/doc/invoke.texi                        |   4 +
 gcc/ipa-cp.c                               | 303 ++++----
 gcc/ipa-fnsummary.c                        | 829 +++++++++++----------
 gcc/ipa-fnsummary.h                        | 113 ++-
 gcc/ipa-inline-analysis.c                  |  92 +--
 gcc/ipa-prop.c                             |  10 +
 gcc/ipa-prop.h                             | 112 ++-
 gcc/params.opt                             |   8 +
 gcc/testsuite/gcc.dg/ipa/ipcp-loophint-1.c |  29 +
 9 files changed, 867 insertions(+), 633 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/ipa/ipcp-loophint-1.c

-- 
2.28.0

^ permalink raw reply	[flat|nested] 18+ messages in thread
* [PATCH 6/6] ipa-cp: Separate and increase the large-unit parameter
@ 2020-09-07 19:41 Martin Jambor
  0 siblings, 0 replies; 18+ messages in thread
From: Martin Jambor @ 2020-09-07 19:41 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jan Hubicka

Hi,

a previous patch in the series has taught IPA-CP to identify the
important cloning opportunities in 548.exchange2_r as worthwhile on
their own, but the optimization is still prevented from taking place
because of the overall unit-growh limit.  This patches raises that
limit so that it takes place and the benchmark runs 30% faster (on AMD
Zen2 CPU at least).

Before this patch, IPA-CP uses the following formulae to arrive at the
overall_size limit:

base = MAX(orig_size, param_large_unit_insns)
overall_size_limit = base + base * param_ipa_cp_unit_growth / 100

since param_ipa_cp_unit_growth has default 10, param_large_unit_insns
has default value 10000.

The problem with exchange2 (at least on zen2 but I have had a quick
look on aarch64 too) is that the original estimated unit size is 10513
and so param_large_unit_insns does not apply and the default limit is
therefore 11564 which is good enough only for one of the ideal 8
clonings, we need the limit to be at least 16291.

I would like to raise param_ipa_cp_unit_growth a little bit more soon
too, but most certainly not to 55.  Therefore, the large_unit must be
increased.  In this patch, I decided to decouple the inlining and
ipa-cp large-unit parameters.  It also makes sense because IPA-CP uses
it only at -O3 while inlining also at -O2 (IIUC).  But if we agree we
can try raising param_large_unit_insns to 13-14 thousand
"instructions," perhaps it is not necessary.  But then again, it may
make sense to actually increase the IPA-CP limit further.

I plan to experiment with IPA-CP tuning on a larger set of programs.
Meanwhile, mainly to address the 548.exchange2_r regression, I'm
suggesting this simple change.

Bootstrapped and tested and LTO bootstrapped on x86_64 as a part of
the whole series.

OK for trunk?

Thanks,

Martin


gcc/ChangeLog:

2020-09-07  Martin Jambor  <mjambor@suse.cz>

	* params.opt (ipa-cp-large-unit-insns): New parameter.
	* ipa-cp.c (get_max_overall_size): Use the new parameter.
---
 gcc/ipa-cp.c   | 2 +-
 gcc/params.opt | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 12acf24c553..2152f9e5876 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -3448,7 +3448,7 @@ static long
 get_max_overall_size (cgraph_node *node)
 {
   long max_new_size = orig_overall_size;
-  long large_unit = opt_for_fn (node->decl, param_large_unit_insns);
+  long large_unit = opt_for_fn (node->decl, param_ipa_cp_large_unit_insns);
   if (max_new_size < large_unit)
     max_new_size = large_unit;
   int unit_growth = opt_for_fn (node->decl, param_ipa_cp_unit_growth);
diff --git a/gcc/params.opt b/gcc/params.opt
index 97509963d71..ef2c1f81dd7 100644
--- a/gcc/params.opt
+++ b/gcc/params.opt
@@ -214,6 +214,10 @@ Percentage penalty functions containing a single call to another function will r
 Common Joined UInteger Var(param_ipa_cp_unit_growth) Init(10) Param Optimization
 How much can given compilation unit grow because of the interprocedural constant propagation (in percent).
 
+-param=ipa-cp-large-unit-insns=
+Common Joined UInteger Var(param_ipa_cp_large_unit_insns) Optimization Init(16000) Param
+The size of translation unit that IPA-CP pass considers large.
+
 -param=ipa-cp-value-list-size=
 Common Joined UInteger Var(param_ipa_cp_value_list_size) Init(8) Param Optimization
 Maximum size of a list of values associated with each parameter for interprocedural constant propagation.
-- 
2.28.0


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2020-10-26 11:00 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-29 18:12 [PATCH 0/6] IPA cleanups and IPA-CP improvements for 548.exchange2_r Martin Jambor
2020-09-21 14:25 ` [PATCH 5/6] ipa-cp: Add dumping of overall_size after cloning Martin Jambor
2020-09-29 18:39   ` Jan Hubicka
2020-09-21 14:25 ` [PATCH 6/6] ipa-cp: Separate and increase the large-unit parameter Martin Jambor
2020-09-29 19:30   ` Jan Hubicka
2020-09-30  6:35     ` Richard Biener
2020-09-30 16:39       ` Martin Jambor
2020-10-26 11:00   ` Tamar Christina
2020-09-21 14:25 ` [PATCH 4/6] ipa: Multiple predicates for loop properties, with frequencies Martin Jambor
2020-09-29 22:18   ` Jan Hubicka
2020-10-02 12:31     ` Martin Jambor
2020-09-28 18:47 ` [PATCH 1/6] ipa: Bundle vectors describing argument values Martin Jambor
2020-10-02 11:54   ` Jan Hubicka
2020-09-28 18:47 ` [PATCH 2/6] ipa: Introduce ipa_cached_call_context Martin Jambor
2020-09-29 18:27   ` Jan Hubicka
2020-09-28 18:47 ` [PATCH 3/6] ipa: Bundle estimates of ipa_call_context::estimate_size_and_time Martin Jambor
2020-09-29 18:39   ` Jan Hubicka
  -- strict thread matches above, loose matches on Subject: below --
2020-09-07 19:41 [PATCH 6/6] ipa-cp: Separate and increase the large-unit parameter Martin Jambor

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).