public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: Jiufu Guo <guojiufu@linux.ibm.com>,
	gcc-patches@gcc.gnu.org, wschmidt@linux.ibm.com,
	dje.gcc@gmail.com, hubicka@ucw.cz
Subject: Re: [PATCH] Check calls before loop unrolling
Date: Thu, 19 Nov 2020 12:53:27 -0700	[thread overview]
Message-ID: <83caaae1-4348-97ee-be9c-5e3c2083729c@redhat.com> (raw)
In-Reply-To: <20201119194206.GX2672@gate.crashing.org>



On 11/19/20 12:42 PM, Segher Boessenkool wrote:
> On Thu, Nov 19, 2020 at 12:13:34PM -0700, Jeff Law wrote:
>> On 8/31/20 9:33 PM, Jiufu Guo via Gcc-patches wrote:
>>> guojiufu <guojiufu@linux.ibm.com> writes:
>>>> When unroll loops, if there are calls inside the loop, those calls
>>>> may raise negative impacts for unrolling.  This patch adds a param
>>>> param_max_unrolled_calls, and checks if the number of calls inside
>>>> the loop bigger than this param, loop is prevent from unrolling.
>>>>
>>>> This patch is checking the _average_ number of calls which is the
>>>> summary of call numbers multiply the possibility of the call maybe
>>>> executed.  The _average_ number could be a fraction, to keep the
>>>> precision, the param is the threshold number multiply 10000.
>>>>
>>>> Bootstrap and regtest pass on powerpc64le.  Is this ok for trunk?
>>>>
>>>> gcc/ChangeLog
>>>> 2020-08-19  Jiufu Guo   <guojiufu@cn.ibm.com>
>>>>
>>>> 	* params.opt (param_max_unrolled_average_calls_x10000): New param.
>>>> 	* cfgloop.h (average_num_loop_calls): New declare.
>>>> 	* cfgloopanal.c (average_num_loop_calls): New function.
>>>> 	* loop-unroll.c (decide_unroll_constant_iteration,
>>>> 	decide_unroll_runtime_iterations,
>>>> 	decide_unroll_stupid): Check average_num_loop_calls and
>>>> 	param_max_unrolled_average_calls_x10000.
>> So what's the motivation behind adding a PARAM to control this
>> behavior?  I'm not a big fan of exposing a lot of PARAMs for users to
>> tune behavior (though I've made the same lapse in judgment myself).  In
>> my mind a PARAM is really more about controlling pathological behavior.
> But we (Power) need very different tuning than what others apparently
> need.  It is similar to inlining, in that that also differs a lot
> between archs how aggressively to do that optimally.
But what I think that argues is that we've got a gap in the costing
model and/or how its being used.  Throwing PARAMS at the problem isn't
really useful for the end user.  The vast majority aren't going to use
them and of the ones that do, most are probably going to get it wrong.

In  my mind fixing things so they work with no magic arguments is best. 
PARAMS are the worst solution.  A -f flag with no arguments is somewhere
in between.  Others may clearly have different opinions here.


jeff


  reply	other threads:[~2020-11-19 19:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-20  4:34 guojiufu
2020-08-24  9:16 ` Richard Biener
2020-08-24 11:16   ` Jan Hubicka
2020-08-25  2:26     ` Jiufu Guo
2020-09-16  3:27     ` Jiufu Guo
2020-09-01  3:33 ` Jiufu Guo
2020-11-19 19:13   ` Jeff Law
2020-11-19 19:42     ` Segher Boessenkool
2020-11-19 19:53       ` Jeff Law [this message]
2020-11-19 20:01         ` Segher Boessenkool
2020-11-19 22:30           ` Jeff Law
2020-11-19 23:56             ` Segher Boessenkool
2020-11-20  7:48               ` Richard Biener
2020-11-20 14:58                 ` David Edelsohn
2020-11-20 15:22               ` Jan Hubicka
2020-11-20 18:09                 ` Segher Boessenkool
2020-11-23  8:42                   ` Richard Biener

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=83caaae1-4348-97ee-be9c-5e3c2083729c@redhat.com \
    --to=law@redhat.com \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=guojiufu@linux.ibm.com \
    --cc=hubicka@ucw.cz \
    --cc=segher@kernel.crashing.org \
    --cc=wschmidt@linux.ibm.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).