This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, 5.x/6.x/7.x] Be more conservative in early inliner if FDO is enabled


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]