public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/56595] New: Tree-ssa-pre can create loop carried dependencies which prevent loop vectorization.
@ 2013-03-11 13:35 ysrumyan at gmail dot com
  2013-03-11 13:38 ` [Bug tree-optimization/56595] " ysrumyan at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ysrumyan at gmail dot com @ 2013-03-11 13:35 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56595

             Bug #: 56595
           Summary: Tree-ssa-pre can create loop carried dependencies
                    which prevent loop vectorization.
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ysrumyan@gmail.com


In some cases pre can create loop carried dependencies spanning multiple
iterations aka scalar replacement. This deficiency can be illustrated with
attached test-case. After pre for stmt

            DO I = 0,I2
               T1 = 0.5D0 * (U1(I,J,K)    + U1(I+1,J,K))

pre creates loop carried dependence:

  <bb 172>:
...
  pretmp_690 = MEM[(real(kind=8)[0:] *)pretmp_675][pretmp_689];
...
  <bb 107>:
  # i_1 = PHI <0(172), i_437(175)>
  # prephitmp_691 = PHI <pretmp_690(172), _440(175)>


Note that in this particular test-case we have arrays with unknown stride1. If
we have arrays with stride1 == 1 such transformation does not happen as for the
following simple test-case which is successfully vectorized:

    subroutine bar(a,b,c,d,n, m)
    integer n, m
    real*8 a(n,*), b(n,*), c(n,*), d(n,*)
    do j=1,m
    do i=1,m
    x1 = 0.5 * (a(i,j) + a(i+1,j))
    x2 = 0.5 * (b(i,j) + b(i+1,j))
    x3 = 0.5 * (c(i,j) + c(i+1,j))
    d(i,j) = (x1 + x2 + x3) / 3.0
    enddo
    enddo
    end


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/56595] Tree-ssa-pre can create loop carried dependencies which prevent loop vectorization.
  2013-03-11 13:35 [Bug tree-optimization/56595] New: Tree-ssa-pre can create loop carried dependencies which prevent loop vectorization ysrumyan at gmail dot com
@ 2013-03-11 13:38 ` ysrumyan at gmail dot com
  2013-03-11 14:25 ` rguenth at gcc dot gnu.org
  2013-09-26 14:57 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: ysrumyan at gmail dot com @ 2013-03-11 13:38 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56595

--- Comment #1 from Yuri Rumyantsev <ysrumyan at gmail dot com> 2013-03-11 13:38:25 UTC ---
Created attachment 29636
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29636
testcase

This test must be compiled with the following options for x86:

-ffree-line-length-none -m64 -Ofast -march=core-avx-i -mavx


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/56595] Tree-ssa-pre can create loop carried dependencies which prevent loop vectorization.
  2013-03-11 13:35 [Bug tree-optimization/56595] New: Tree-ssa-pre can create loop carried dependencies which prevent loop vectorization ysrumyan at gmail dot com
  2013-03-11 13:38 ` [Bug tree-optimization/56595] " ysrumyan at gmail dot com
@ 2013-03-11 14:25 ` rguenth at gcc dot gnu.org
  2013-09-26 14:57 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-03-11 14:25 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56595

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-03-11
             Blocks|                            |53947
     Ever Confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> 2013-03-11 14:25:02 UTC ---
Confirmed (and known).  See inhibit_phi_insertion in PRE.

I bet you find some duplicate in the list of missed-vectorization bugs.

Loop store-motion can result in similar issues.

Note that an issue with limiting things even further is that PRE is limited
even when the resulting loop is _not_ vectorized.  Which is of course bad.

So the best solution is to teach the vectorizer to handle this kind of
dependency (after all user code can be written in that way from the start).


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/56595] Tree-ssa-pre can create loop carried dependencies which prevent loop vectorization.
  2013-03-11 13:35 [Bug tree-optimization/56595] New: Tree-ssa-pre can create loop carried dependencies which prevent loop vectorization ysrumyan at gmail dot com
  2013-03-11 13:38 ` [Bug tree-optimization/56595] " ysrumyan at gmail dot com
  2013-03-11 14:25 ` rguenth at gcc dot gnu.org
@ 2013-09-26 14:57 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-09-26 14:57 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56595

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Dup.

*** This bug has been marked as a duplicate of bug 35229 ***


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-26 14:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-11 13:35 [Bug tree-optimization/56595] New: Tree-ssa-pre can create loop carried dependencies which prevent loop vectorization ysrumyan at gmail dot com
2013-03-11 13:38 ` [Bug tree-optimization/56595] " ysrumyan at gmail dot com
2013-03-11 14:25 ` rguenth at gcc dot gnu.org
2013-09-26 14:57 ` rguenth at gcc dot gnu.org

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).