From: Jiufu Guo <guojiufu@linux.ibm.com>
To: "Kewen.Lin" <linkw@linux.ibm.com>
Cc: Segher Boessenkool <segher@kernel.crashing.org>,
GCC Patches <gcc-patches@gcc.gnu.org>,
Bill Schmidt <wschmidt@linux.ibm.com>,
"bin.cheng" <bin.cheng@linux.alibaba.com>,
Richard Guenther <rguenther@suse.de>
Subject: Re: [PATCH 1/4 v2 GCC11] Add middle-end unroll factor estimation
Date: Tue, 11 Feb 2020 02:15:00 -0000 [thread overview]
Message-ID: <h48o8u5kgyn.fsf@genoa.aus.stglabs.ibm.com> (raw)
In-Reply-To: <2aefe945-ac95-a472-a6b2-3b2ae3e63f4d@linux.ibm.com> (Kewen Lin's message of "Mon, 10 Feb 2020 14:20:17 +0800")
"Kewen.Lin" <linkw@linux.ibm.com> writes:
> Hi Segher,
>
> Thanks for your comments! Updated to v2 as below:
>
> 1) Removed unnecessary hook loop_unroll_adjust_tree.
> 2) Updated estimated_uf to estimated_unroll and some comments.
>
> gcc/ChangeLog
>
> 2020-02-10 Kewen Lin <linkw@gcc.gnu.org>
>
> * cfgloop.h (struct loop): New field estimated_unroll.
> * tree-ssa-loop-manip.c (decide_uf_const_iter): New function.
> (decide_uf_runtime_iter): Likewise.
> (decide_uf_stupid): Likewise.
> (estimate_unroll_factor): Likewise.
In RTL unroller, target hooks are also involved when decide unroll
factor, so these decide_uf_xx functions may not same with final real
unroll factor in RTL. For example, at O2 by default, small loops will be
unrolled 2 times.
> * tree-ssa-loop-manip.h (estimate_unroll_factor): New declare.
> * tree-ssa-loop.c (tree_average_num_loop_insns): New function.
> * tree-ssa-loop.h (tree_average_num_loop_insns): New declare.
>
> BR,
> Kewen
>
> on 2020/1/20 下午9:02, Segher Boessenkool wrote:
>> Hi!
>>
>> On Thu, Jan 16, 2020 at 05:39:40PM +0800, Kewen.Lin wrote:
>>> --- a/gcc/cfgloop.h
>>> +++ b/gcc/cfgloop.h
>>> @@ -232,6 +232,9 @@ public:
>>> Other values means unroll with the given unrolling factor. */
>>> unsigned short unroll;
>>>
>>> + /* Like unroll field above, but it's estimated in middle-end. */
>>> + unsigned short estimated_uf;
>>
>> Please use full words? "estimated_unroll" perhaps? (Similar for other
>> new names).
>>
>
> Done.
>
>>> +/* Implement targetm.loop_unroll_adjust_tree, strictly refers to
>>> + targetm.loop_unroll_adjust. */
>>> +
>>> +static unsigned
>>> +rs6000_loop_unroll_adjust_tree (unsigned nunroll, struct loop *loop)
>>> +{
>>> + /* For now loop_unroll_adjust is simple, just invoke directly. */
>>> + return rs6000_loop_unroll_adjust (nunroll, loop);
>>> +}
>>
>> Since the two hooks have the same arguments as well, it should really
>> just be one hook, and an implementation can check whether
>> current_pass->type == RTL_PASS
>> if it needs to do something special for RTL, etc.? Or it can use some
>> more appropriate condition -- the point is you need no extra hook.
>>
>
> Good point, removed it.
>
>>> + /* Check number of iterations is constant. */
>>> + if ((niter_desc->may_be_zero && !integer_zerop (niter_desc->may_be_zero))
>>> + || !tree_fits_uhwi_p (niter_desc->niter))
>>> + return false;
>>
>> Check, and do what? It's easier to read if you say.
>>
>
> Done.
>
>>
>> "If loop->unroll is set, use that as loop->estimated_unroll"?
>>
>
> Done.
next prev parent reply other threads:[~2020-02-11 2:15 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-16 9:41 [PATCH 0/4 GCC11] IVOPTs consider step cost for different forms when unrolling Kewen.Lin
2020-01-16 9:43 ` [PATCH 1/4 GCC11] Add middle-end unroll factor estimation Kewen.Lin
2020-01-20 13:12 ` Segher Boessenkool
2020-02-10 6:20 ` [PATCH 1/4 v2 " Kewen.Lin
2020-02-10 23:34 ` Segher Boessenkool
2020-02-11 6:51 ` [PATCH 1/4 v3 " Kewen.Lin
2020-02-11 7:00 ` Segher Boessenkool
2020-02-11 2:15 ` Jiufu Guo [this message]
2020-02-11 3:04 ` [PATCH 1/4 v2 " Kewen.Lin
2020-01-16 10:02 ` [PATCH 2/4 GCC11] Add target hook stride_dform_valid_p Kewen.Lin
2020-01-20 10:53 ` Richard Sandiford
2020-01-20 11:47 ` Richard Biener
2020-01-20 13:20 ` Segher Boessenkool
2020-02-25 9:46 ` Kewen.Lin
2020-03-02 11:09 ` Richard Sandiford
2020-03-03 12:26 ` Kewen.Lin
2020-05-13 5:50 ` Kewen.Lin
2020-05-28 2:17 ` Ping^1 [PATCH 2/4 V3] " Kewen.Lin
2020-05-28 10:54 ` Richard Sandiford
2020-01-16 10:06 ` [PATCH 3/4 GCC11] IVOPTs Consider cost_step on different forms during unrolling Kewen.Lin
2020-02-25 9:48 ` [PATCH 3/4 V2 " Kewen.Lin
2020-05-13 5:42 ` [PATCH 3/4 V3 " Kewen.Lin
2020-01-16 10:12 ` [PATCH 4/4 GCC11] rs6000: P9 D-form test cases Kewen.Lin
2020-01-20 13:37 ` Segher Boessenkool
2020-02-10 6:25 ` [PATCH 4/4 v2 " Kewen.Lin
2020-02-10 23:51 ` Segher Boessenkool
2020-01-20 13:03 ` [PATCH 0/4 GCC11] IVOPTs consider step cost for different forms when unrolling Segher Boessenkool
2020-02-10 6:17 ` Kewen.Lin
2020-02-10 21:29 ` Segher Boessenkool
2020-02-11 2:56 ` Kewen.Lin
2020-02-11 7:34 ` Richard Biener
2020-02-11 7:49 ` Segher Boessenkool
2020-02-11 8:01 ` Richard Biener
2020-02-11 12:46 ` Roman Zhuykov
2020-02-11 13:58 ` Richard Biener
2020-02-11 18:00 ` Segher Boessenkool
2020-02-12 8:07 ` Richard Biener
2020-02-12 21:53 ` Segher Boessenkool
2020-02-11 18:12 ` Segher Boessenkool
2020-02-12 8:13 ` Richard Biener
2020-02-12 10:02 ` Segher Boessenkool
2020-02-12 10:53 ` Richard Biener
2020-02-12 22:05 ` Segher Boessenkool
2020-02-13 7:48 ` Richard Biener
2020-02-13 9:02 ` Segher Boessenkool
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=h48o8u5kgyn.fsf@genoa.aus.stglabs.ibm.com \
--to=guojiufu@linux.ibm.com \
--cc=bin.cheng@linux.alibaba.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=linkw@linux.ibm.com \
--cc=rguenther@suse.de \
--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).