[Bug tree-optimization/41879] New: [4.5 Regression] 172.mgrid regression, vectorizer prevents predictive commoning

View: New views
8 Messages — Rating Filter:   Alert me  

[Bug tree-optimization/41879] New: [4.5 Regression] 172.mgrid regression, vectorizer prevents predictive commoning

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The fix for PR41783 causes us to vectorize RESID and PSINV where we only
predictive common the epilogue loop now.  This causes mgrid score to drop
by almost 40% on x86_64 and the vectorized code is pretty bad because it
uses unaligned accesses.


--
           Summary: [4.5 Regression] 172.mgrid regression, vectorizer
                    prevents predictive commoning
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org
OtherBugsDependingO 41783
             nThis:


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


[Bug tree-optimization/41879] [4.5 Regression] 172.mgrid regression, vectorizer prevents predictive commoning

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #1 from rguenth at gcc dot gnu dot org  2009-10-30 16:57 -------
Testcase:

      SUBROUTINE PSINV(R,U,C)
      PARAMETER (N=64)
      REAL*8 U(N,N,N),R(N,N,N),C(0:3)
      INTEGER I3, I2, I1
C
      DO 600 I3=2,N-1
      DO 600 I2=2,N-1
      DO 600 I1=2,N-1
 600  U(I1,I2,I3)=U(I1,I2,I3)
     >      +C(0)*( R(I1,  I2,  I3  ) )
     >      +C(1)*( R(I1-1,I2,  I3  ) + R(I1+1,I2,  I3  )
     >           +  R(I1,  I2-1,I3  ) + R(I1,  I2+1,I3  )
     >           +  R(I1,  I2,  I3-1) + R(I1,  I2,  I3+1) )
     >      +C(2)*( R(I1-1,I2-1,I3  ) + R(I1+1,I2-1,I3  )
     >           +  R(I1-1,I2+1,I3  ) + R(I1+1,I2+1,I3  )
     >           +  R(I1,  I2-1,I3-1) + R(I1,  I2+1,I3-1)
     >           +  R(I1,  I2-1,I3+1) + R(I1,  I2+1,I3+1)
     >           +  R(I1-1,I2,  I3-1) + R(I1-1,I2,  I3+1)
     >           +  R(I1+1,I2,  I3-1) + R(I1+1,I2,  I3+1) )
     >      +C(3)*( R(I1-1,I2-1,I3-1) + R(I1+1,I2-1,I3-1)
     >           +  R(I1-1,I2+1,I3-1) + R(I1+1,I2+1,I3-1)
     >           +  R(I1-1,I2-1,I3+1) + R(I1+1,I2-1,I3+1)
     >           +  R(I1-1,I2+1,I3+1) + R(I1+1,I2+1,I3+1) )
C
      RETURN
      END


--

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.5.0


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


[Bug tree-optimization/41879] [4.5 Regression] 172.mgrid regression, vectorizer prevents predictive commoning

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #2 from rguenth at gcc dot gnu dot org  2009-10-30 17:00 -------
With vectorization enabled I get

Running /home/richard/src/trunk/gcc/testsuite/gcc.dg/tree-ssa/tree-ssa.exp ...
FAIL: gcc.dg/tree-ssa/predcom-1.c scan-tree-dump-times pcom "looparound ref" 1
FAIL: gcc.dg/tree-ssa/predcom-4.c scan-tree-dump-times pcom "Combination" 1
FAIL: gcc.dg/tree-ssa/predcom-4.c scan-tree-dump-times pcom "Unrolling 3
times." 1

that is, all predictive commoning tests run with -O2 only...


--


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


[Bug tree-optimization/41879] [4.5 Regression] 172.mgrid regression, vectorizer prevents predictive commoning

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



--

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Priority|P3                          |P2
   Last reconfirmed|0000-00-00 00:00:00         |2009-11-09 13:03:36
               date|                            |


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


[Bug tree-optimization/41879] [4.5 Regression] 172.mgrid regression, vectorizer prevents predictive commoning

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #3 from irar at il dot ibm dot com  2009-11-10 10:02 -------
(In reply to comment #0)
> This causes mgrid score to drop
> by almost 40% on x86_64 and the vectorized code is pretty bad because it
> uses unaligned accesses.

Is the vectorized code worse than the scalar one even without predcom?


--


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


[Bug tree-optimization/41879] [4.5 Regression] 172.mgrid regression, vectorizer prevents predictive commoning

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #4 from rguenth at gcc dot gnu dot org  2009-11-11 20:38 -------
I didn't check yet.  We'll work on a simple cost-model integration of
predcom.


--


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


[Bug tree-optimization/41879] [4.5 Regression] 172.mgrid regression, vectorizer prevents predictive commoning

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #5 from irar at il dot ibm dot com  2009-11-12 07:51 -------
(In reply to comment #4)
> I didn't check yet.  We'll work on a simple cost-model integration of
> predcom.

You mean, vectorizer cost model will take predcom into account?

If the vectorization is not profitable (vs. scalar without predcom), it can be
a matter of vectorizer cost model tuning (looks easier).


--


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


[Bug tree-optimization/41879] [4.5 Regression] 172.mgrid regression, vectorizer prevents predictive commoning

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #6 from rguenth at gcc dot gnu dot org  2009-11-12 15:17 -------
The idea is to call predcom analysis and hook it into the vectorizer as another
vectorization form for the cost model.


--


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