From: "Yuan, Pengfei" <ypf@pku.edu.cn>
To: "Jan Hubicka" <hubicka@ucw.cz>
Cc: "Richard Biener" <richard.guenther@gmail.com>,
"GCC Patches" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH, 5.x/6.x/7.x] Be more conservative in early inliner if FDO is enabled
Date: Mon, 26 Sep 2016 04:03:00 -0000 [thread overview]
Message-ID: <59ca4f6e.1a84.15763c25058.Coremail.ypf@pku.edu.cn> (raw)
In-Reply-To: <6ad18072.d732.15732c834ea.Coremail.ypf@pku.edu.cn>
Hi,
May I ask if there is any decision?
Regards,
Yuan, Pengfei
> > > I also like a new param better as it avoids a new magic constant and
> > > makes playing with
> > > it easier (your patch removes the ability to do statistics like you did via the
> > > early-inlining-insns parameter by forcing it to two).
> >
> > Hmm, you are right that you do not know if this particular function will get
> > profile (forgot about that). Still, please use two params - it is more
> > consistent with what we have now and we may make it profile specific in
> > future..
> >
> > Honza
> > >
> > > Thanks,
> > > Richard.
>
> A new patch for trunk is attached.
>
> Regards,
> Yuan, Pengfei
>
>
> 2016-09-16 Yuan Pengfei <ypf@pku.edu.cn>
>
> * doc/invoke.texi (--param early-inlining-insns-feedback): New.
> * ipa-inline.c (want_early_inline_function_p): Use
> PARAM_EARLY_INLINING_INSNS_FEEDBACK when FDO is enabled.
> * params.def (PARAM_EARLY_INLINING_INSNS_FEEDBACK): Define.
> (PARAM_EARLY_INLINING_INSNS): Change help string accordingly.
>
>
> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> index 8eb5eff..6e7659a 100644
> --- a/gcc/doc/invoke.texi
> +++ b/gcc/doc/invoke.texi
> @@ -9124,12 +9124,18 @@ given call expression. This parameter limits inlining only to call expressions
> whose probability exceeds the given threshold (in percents).
> The default value is 10.
>
> @item early-inlining-insns
> +@itemx early-inlining-insns-feedback
> Specify growth that the early inliner can make. In effect it increases
> the amount of inlining for code having a large abstraction penalty.
> The default value is 14.
>
> +The @option{early-inlining-insns-feedback} parameter is used only when
> +profile feedback-directed optimizations are enabled (by
> +@option{-fprofile-generate} or @option{-fprofile-use}).
> +The default value is 2.
> +
> @item max-early-inliner-iterations
> Limit of iterations of the early inliner. This basically bounds
> the number of nested indirect calls the early inliner can resolve.
> Deeper chains are still handled by late inlining.
> diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
> index 5c9366a..e028c08 100644
> --- a/gcc/ipa-inline.c
> +++ b/gcc/ipa-inline.c
> @@ -594,10 +594,17 @@ want_early_inline_function_p (struct cgraph_edge *e)
> }
> else
> {
> int growth = estimate_edge_growth (e);
> + int growth_limit;
> int n;
>
> + if ((profile_arc_flag && !flag_test_coverage)
> + || (flag_branch_probabilities && !flag_auto_profile))
> + growth_limit = PARAM_VALUE (PARAM_EARLY_INLINING_INSNS_FEEDBACK);
> + else
> + growth_limit = PARAM_VALUE (PARAM_EARLY_INLINING_INSNS);
> +
> if (growth <= 0)
> ;
> else if (!e->maybe_hot_p ()
> && growth > 0)
> @@ -610,9 +617,9 @@ want_early_inline_function_p (struct cgraph_edge *e)
> xstrdup_for_dump (callee->name ()), callee->order,
> growth);
> want_inline = false;
> }
> - else if (growth > PARAM_VALUE (PARAM_EARLY_INLINING_INSNS))
> + else if (growth > growth_limit)
> {
> if (dump_file)
> fprintf (dump_file, " will not early inline: %s/%i->%s/%i, "
> "growth %i exceeds --param early-inlining-insns\n",
> @@ -622,9 +629,9 @@ want_early_inline_function_p (struct cgraph_edge *e)
> growth);
> want_inline = false;
> }
> else if ((n = num_calls (callee)) != 0
> - && growth * (n + 1) > PARAM_VALUE (PARAM_EARLY_INLINING_INSNS))
> + && growth * (n + 1) > growth_limit)
> {
> if (dump_file)
> fprintf (dump_file, " will not early inline: %s/%i->%s/%i, "
> "growth %i exceeds --param early-inlining-insns "
> diff --git a/gcc/params.def b/gcc/params.def
> index 79b7dd4..91ea513 100644
> --- a/gcc/params.def
> +++ b/gcc/params.def
> @@ -199,12 +199,20 @@ DEFPARAM(PARAM_INLINE_UNIT_GROWTH,
> DEFPARAM(PARAM_IPCP_UNIT_GROWTH,
> "ipcp-unit-growth",
> "How much can given compilation unit grow because of the interprocedural constant propagation (in percent).",
> 10, 0, 0)
> -DEFPARAM(PARAM_EARLY_INLINING_INSNS,
> - "early-inlining-insns",
> - "Maximal estimated growth of function body caused by early inlining of single call.",
> - 14, 0, 0)
> +DEFPARAM (PARAM_EARLY_INLINING_INSNS_FEEDBACK,
> + "early-inlining-insns-feedback",
> + "Maximal estimated growth of function body caused by early "
> + "inlining of single call. Used when profile feedback-directed "
> + "optimizations are enabled.",
> + 2, 0, 0)
> +DEFPARAM (PARAM_EARLY_INLINING_INSNS,
> + "early-inlining-insns",
> + "Maximal estimated growth of function body caused by early "
> + "inlining of single call. Used when profile feedback-directed "
> + "optimizations are not enabled.",
> + 14, 0, 0)
> DEFPARAM(PARAM_LARGE_STACK_FRAME,
> "large-stack-frame",
> "The size of stack frame to be considered large.",
> 256, 0, 0)
next prev parent reply other threads:[~2016-09-25 23:51 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-10 6:41 Yuan, Pengfei
2016-09-14 10:35 ` Richard Biener
2016-09-15 3:17 ` Yuan, Pengfei
2016-09-15 8:44 ` Richard Biener
2016-09-15 10:08 ` Yuan, Pengfei
2016-09-16 5:52 ` Yuan, Pengfei
2016-09-16 8:09 ` Jan Hubicka
2016-09-16 9:01 ` Yuan, Pengfei
2016-09-16 9:21 ` Richard Biener
2016-09-16 9:37 ` Jan Hubicka
2016-09-16 12:00 ` Yuan, Pengfei
2016-09-16 12:56 ` Jan Hubicka
2016-09-20 8:53 ` Yuan, Pengfei
2016-09-20 11:44 ` Richard Biener
2016-09-20 11:58 ` Richard Biener
2016-09-20 12:09 ` Yuan, Pengfei
2016-09-20 12:19 ` Richard Biener
2016-09-20 13:10 ` Yuan, Pengfei
2016-09-21 12:44 ` Yuan, Pengfei
2016-09-26 4:03 ` Yuan, Pengfei [this message]
2016-10-10 2:23 ` PING: [PATCH] " Yuan, Pengfei
2016-10-10 9:55 ` Richard Biener
2016-10-10 10:52 ` Yuan, Pengfei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=59ca4f6e.1a84.15763c25058.Coremail.ypf@pku.edu.cn \
--to=ypf@pku.edu.cn \
--cc=gcc-patches@gcc.gnu.org \
--cc=hubicka@ucw.cz \
--cc=richard.guenther@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).