From: Richard Biener <richard.guenther@gmail.com>
To: Tom de Vries <Tom_deVries@mentor.com>
Cc: "gcc-patches@gnu.org" <gcc-patches@gnu.org>
Subject: Re: [RFC, PR66873] Use graphite for parloops
Date: Thu, 16 Jul 2015 08:48:00 -0000 [thread overview]
Message-ID: <CAFiYyc02OP9go0M1ePWEgEFVTH+B_1sxSaX7m6K6GH5CsQ=CpA@mail.gmail.com> (raw)
In-Reply-To: <55A6C1DF.1050108@mentor.com>
On Wed, Jul 15, 2015 at 10:26 PM, Tom de Vries <Tom_deVries@mentor.com> wrote:
> Hi,
>
> I tried to parallelize this fortran test-case (based on autopar/outer-1.c),
> specifically the outer loop of the first loop nest using
> -ftree-parallelize-loops=2:
> ...
> program main
> implicit none
> integer, parameter :: n = 500
> integer, dimension (0:n-1, 0:n-1) :: x
> integer :: i, j, ii, jj
>
>
> do ii = 0, n - 1
> do jj = 0, n - 1
> x(jj, ii) = ii + jj + 3
> end do
> end do
>
> do i = 0, n - 1
> do j = 0, n - 1
> if (x(j, i) .ne. i + j + 3) call abort
> end do
> end do
>
> end program main
> ...
>
> But autopar fails to parallelize due to failing dependency analysis.
>
> I then tried to add -floop-parallelize-all, and found that the graphite
> dependency analysis did manage to decide that the iterations are
> independent.
>
> At https://gcc.gnu.org/wiki/Graphite/Parallelization I read:
> ...
> In GCC there already exists an auto-parallelization pass (tree-parloops.c),
> which is base on the lambda framework originally developed by Sebastian.
> Since Lambda framework is limited to some cases (e.g. triangle loops, loops
> with 'if' conditions), Graphite was developed to handle the loops that
> lambda was not able to handle .
> ...
>
> So I wondered, why not always use the graphite dependency analysis in
> parloops. (Of course you could use -floop-parallelize-all, but that also
> changes the heuristic). So I wrote a patch for parloops to use graphite
> dependency analysis by default (so without -floop-parallelize-all), but
> while testing found out that all the reduction test-cases started failing
> because the modifications graphite makes to the code messes up the parloops
> reduction analysis.
>
> Then I came up with this patch, which:
> - first runs a parloops pass, restricted to reduction loops only,
> - then runs graphite dependency analysis
> - followed by a normal parloops pass run.
>
> This way, we get to both:
> - compile the reduction testcases as before, and
> - profit from the better graphite dependency analysis otherwise.
>
> A point worth noting is that I stopped running pass_iv_canon before parloops
> (only in case of -ftree-parallelize-loops > 1) because running it before
> graphite makes the graphite scop detection fail.
>
> Bootstrapped and reg-tested on x86_64.
>
> Any comments?
graphite dependence analysis is too slow to be enabled unconditionally.
(read: hours in some simple cases - see bugzilla)
Richard.
> Thanks,
> - Tom
next prev parent reply other threads:[~2015-07-16 8:46 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-15 22:18 Tom de Vries
2015-07-16 8:48 ` Richard Biener [this message]
2015-07-16 10:25 ` Thomas Schwinge
2015-07-16 10:28 ` Richard Biener
2015-07-16 10:41 ` Richard Biener
2015-07-26 22:54 ` Tom de Vries
2015-07-27 5:41 ` Sebastian Pop
2015-07-16 11:41 ` Tom de Vries
2015-07-20 18:53 ` Sebastian Pop
2015-07-21 0:22 ` Tom de Vries
2015-07-20 18:54 ` Sebastian Pop
2015-07-21 5:59 ` Tom de Vries
2015-07-21 14:35 ` Tom de Vries
2015-07-21 19:08 ` Sebastian Pop
2015-07-22 11:02 ` Richard Biener
2015-07-22 11:18 ` Richard Biener
2015-07-22 16:04 ` [PATCH] Don't allow unsafe reductions in graphite Tom de Vries
2015-07-23 10:51 ` Richard Biener
2015-07-24 20:37 ` Sebastian Pop
2015-07-25 11:41 ` Tom de Vries
2015-07-22 16:38 ` [PATCH] Check TYPE_OVERFLOW_WRAPS for parloops reductions Tom de Vries
2015-07-23 10:54 ` Richard Biener
2015-07-24 10:43 ` [committed] Remove xfail in autopar/uns-outer-4.c Tom de Vries
2015-07-24 11:54 ` [PATCH] Add FIXED_POINT_TYPE_OVERFLOW_WRAPS_P Tom de Vries
2015-07-22 15:33 ` [PATCH] Document ftrapv/fwrapv interaction Tom de Vries
2015-07-23 10:39 ` Richard Biener
2015-07-23 10: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='CAFiYyc02OP9go0M1ePWEgEFVTH+B_1sxSaX7m6K6GH5CsQ=CpA@mail.gmail.com' \
--to=richard.guenther@gmail.com \
--cc=Tom_deVries@mentor.com \
--cc=gcc-patches@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).