public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: "Bin.Cheng" <amker.cheng@gmail.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH GCC][12/13]Workaround reduction statements for distribution
Date: Fri, 23 Jun 2017 10:49:00 -0000	[thread overview]
Message-ID: <CAFiYyc2h8XCixP8bkX85Rz-BGG5FmBFwr5d4b4DSOoRk-3LKsQ@mail.gmail.com> (raw)
In-Reply-To: <CAHFci2-FG4REo3_O5ObA4HzGTo=xTG5w695=KMj0vkA99UesZg@mail.gmail.com>

On Fri, Jun 23, 2017 at 12:26 PM, Bin.Cheng <amker.cheng@gmail.com> wrote:
> On Tue, Jun 20, 2017 at 12:36 PM, Richard Biener
> <richard.guenther@gmail.com> wrote:
>> On Tue, Jun 20, 2017 at 11:20 AM, Bin.Cheng <amker.cheng@gmail.com> wrote:
>>> On Fri, Jun 16, 2017 at 6:15 PM, Bin.Cheng <amker.cheng@gmail.com> wrote:
>>>> On Fri, Jun 16, 2017 at 11:21 AM, Richard Biener
>>>> <richard.guenther@gmail.com> wrote:
>>>>> On Mon, Jun 12, 2017 at 7:03 PM, Bin Cheng <Bin.Cheng@arm.com> wrote:
>>>>>> Hi,
>>>>>> For now, loop distribution handles variables used outside of loop as reduction.
>>>>>> This is inaccurate because all partitions contain statement defining induction
>>>>>> vars.
>>>>>
>>>>> But final induction values are usually not used outside of the loop...
>>>> This is in actuality for induction variable which is used outside of the loop.
>>>>>
>>>>> What is missing is loop distribution trying to change partition order.  In fact
>>>>> we somehow assume we can move a reduction across a detected builtin
>>>>> (I don't remember if we ever check for validity of that...).
>>>> Hmm, I am not sure when we can't.  If there is any dependence between
>>>> builtin/reduction partitions, it should be captured by RDG or PG,
>>>> otherwise the partitions are independent and can be freely ordered as
>>>> long as reduction partition is scheduled last?
>>>>>
>>>>>> Ideally we should factor out scev-propagation as a standalone interface
>>>>>> which can be called when necessary.  Before that, this patch simply workarounds
>>>>>> reduction issue by checking if the statement belongs to all partitions.  If yes,
>>>>>> the reduction must be computed in the last partition no matter how the loop is
>>>>>> distributed.
>>>>>> Bootstrap and test on x86_64 and AArch64.  Is it OK?
>>>>>
>>>>> stmt_in_all_partitions is not kept up-to-date during partition merging and if
>>>>> merging makes the reduction partition(s) pass the stmt_in_all_partitions
>>>>> test your simple workaround doesn't work ...
>>>> I think it doesn't matter because:
>>>>   A) it's really workaround for induction variables.  In general,
>>>> induction variables are included by all partition.
>>>>   B) After classify partition, we immediately fuses all reduction
>>>> partitions.  More stmt_in_all_partitions means we are fusing
>>>> non-reduction partition with reduction partition, so the newly
>>>> generated (stmt_in_all_partitions) are actually not reduction
>>>> statements.  The workaround won't work anyway even the bitmap is
>>>> maintained.
>>>>>
>>>>> As written it's a valid optimization but can you please note it's limitation in
>>>>> some comment please?
>>>> Yeah, I will add comment explaining it.
>>> Comment added in new version patch.  It also computes bitmap outside
>>> now, is it OK?
>>
>> Ok.  Can you add a testcase for this as well please?  I think the
>> series up to this
>> is now fully reviewed, I defered 1/n (the new IFN) to the last one
>> containing the
>> runtime versioning.  Can you re-post that (you can merge with the IFN patch)
>> to apply after the series has been applied up to this?
> Test case added.

Ok.

> Thanks,
> bin
> 2017-06-20  Bin Cheng  <bin.cheng@arm.com>
>
>     * tree-loop-distribution.c (classify_partition): New parameter and
>     better handle reduction statement.
>     (rdg_build_partitions): Revise comment.
>     (distribute_loop): Compute statements in all partitions and pass it
>     to classify_partition.
>
> gcc/testsuite/ChangeLog
> 2017-06-20  Bin Cheng  <bin.cheng@arm.com>
>
>     * gcc.dg/tree-ssa/ldist-26.c: New test.

      reply	other threads:[~2017-06-23 10:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-12 17:03 Bin Cheng
2017-06-16 10:21 ` Richard Biener
2017-06-16 17:15   ` Bin.Cheng
2017-06-20  9:20     ` Bin.Cheng
2017-06-20 11:36       ` Richard Biener
2017-06-23 10:26         ` Bin.Cheng
2017-06-23 10:49           ` Richard Biener [this message]

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=CAFiYyc2h8XCixP8bkX85Rz-BGG5FmBFwr5d4b4DSOoRk-3LKsQ@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=amker.cheng@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).