public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Guenther <richard.guenther@gmail.com>
To: Albert Cohen <Albert.Cohen@inria.fr>
Cc: gcc@gcc.gnu.org
Subject: Re: complete_unrolli / complete_unroll
Date: Thu, 20 Aug 2009 09:57:00 -0000	[thread overview]
Message-ID: <84fc9c000908200148p57979f3cp5e440f778b8fc484@mail.gmail.com> (raw)
In-Reply-To: <4A8CA4BC.4020807@inria.fr>

On Thu, Aug 20, 2009 at 3:19 AM, Albert Cohen<Albert.Cohen@inria.fr> wrote:
> Richard Guenther wrote:
>>
>> gfortran.dg/reassoc_4.f, the hottest loop from calculix.
>
> Thanks.
>
> This example is slightly different. Graphite should be able to handle it
> with loop fusion rather than pre-unrolling + cse. But I agree that the
> unrolling + cse approach also makes sense (and does not depend on the same
> legality constraints as loop fusion).
>
> This makes me think of a simple, general criterion to detect cases where
> pre-unrolling of inner loop helps further cse and loop optimizations.
> The idea is to unroll only when we can see some evidence of array references
> that are not presently loop-invariant that would be made (outer)-loop
> invariant via full unrolling of some inner loop.
> This can be implemented by complementing the current heuristic (or its
> complementary enhancements by Honza) with an additional condition, only
> enabled when running it with the "i" (inner) flag (which should probably be
> renamed if we do implement this...).
>
> The simplest, weakest condition I can think of would be to traverse all
> array references in the region enclosed by the loop-to-be-unrolled, compute
> the SCEV for each one, instanciate it in the loop's context, and checking if
> it only depends on the loop counter, as well as outer loop counters or
> parameters.
>
> This condition would a priori pass on the tramp3d and reassoc_4 cases. Yet
> it is probably too weak and will still pass on many codes where unrolling
> would probably not help at all... and probably harm.
> If this is the case, we should consider multiple loops to be unrolled, and
> the combined effect of unrolling ALL of these, resulting in complete
> instanciation of the array subscripts with constants. This is a very special
> case, again satisfied by our two motivating examples. Maybe it will be too
> specific and we'll have performance regressions... It remained to be
> investigated if we have to go through a stricter condition than the first,
> weak one I proposed.
>
> If this is not clear, I can write some pseudo-code to clarify :-).

Can't we use graphite to re-roll loops?  That is, compress the
polyhedron by introducing a new parameter?  But maybe I am
not good at guessing what your initial bloat issue looks like.

The reason I'm asking is that there is enough code out in the
wild that has loops with manually unrolled bodies - I have seen
up to 16 times here.

Richard.
> Albert
>

  reply	other threads:[~2009-08-20  8:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-19 11:53 mips64 gcc 3.3.6 problem Sergey Anosov
2009-08-19 11:55 ` Paolo Carlini
2009-08-19 12:13 ` complete_unrolli / complete_unroll Albert Cohen
2009-08-19 12:33   ` Richard Guenther
2009-08-19 12:35     ` Richard Guenther
2009-08-19 13:56     ` Albert Cohen
2009-08-19 14:44       ` Albert Cohen
2009-08-19 15:09         ` Richard Guenther
2009-08-19 20:30           ` Richard Guenther
2009-08-20  8:45             ` Albert Cohen
2009-08-20  9:57               ` Richard Guenther [this message]
2009-08-20 13:34                 ` Albert Cohen
2009-09-29 18:54                 ` David Edelsohn
2009-09-30 12:36                   ` Richard Guenther
2009-08-20 11:20 Dominique Dhumieres
2009-08-20 12:25 ` Richard Guenther

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=84fc9c000908200148p57979f3cp5e440f778b8fc484@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=Albert.Cohen@inria.fr \
    --cc=gcc@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).