public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/49851] New: IVOPTs makes a mess out of polyhedron air derivx and derivy
@ 2011-07-26 11:27 rguenth at gcc dot gnu.org
  2011-07-26 12:54 ` [Bug tree-optimization/49851] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-07-26 11:27 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: IVOPTs makes a mess out of polyhedron air derivx and
                    derivy
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: rguenth@gcc.gnu.org


SUBROUTINE DERIVX(D,U,Ux,Al,Np,Nd,M)
      IMPLICIT REAL*8(A-H,O-Z)
      PARAMETER (NX=150,NY=150)
      DIMENSION D(NX,33) , U(NX,NY) , Ux(NX,NY) , Al(30) , Np(30)
      DO jm = 1 , M
         jmax = 0
         jmin = 1
         DO i = 1 , Nd
            jmax = jmax + Np(i) + 1
            DO j = jmin , jmax
               uxt = 0.
               DO k = 0 , Np(i)
                  uxt = uxt + D(j,k+1)*U(jmin+k,jm)
               ENDDO
               Ux(j,jm) = uxt*Al(i)
            ENDDO
            jmin = jmin + Np(i) + 1
         ENDDO
      ENDDO
      CONTINUE
      END

it ends up inserting loads of code into the pre-header blocks of the loops,
seemingly for rewriting of the loop exit tests.

As a result of this air runs about 25% slower when compiled with GCC compared
to ICC.


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

* [Bug tree-optimization/49851] IVOPTs makes a mess out of polyhedron air derivx and derivy
  2011-07-26 11:27 [Bug tree-optimization/49851] New: IVOPTs makes a mess out of polyhedron air derivx and derivy rguenth at gcc dot gnu.org
@ 2011-07-26 12:54 ` rguenth at gcc dot gnu.org
  2011-07-26 13:59 ` rguenth at gcc dot gnu.org
  2011-07-26 14:32 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-07-26 12:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-07-26 12:53:47 UTC ---
Testcase with caller, use -fwhole-program to force inlining.

      IMPLICIT REAL*8(a-H,O-Z)
      PARAMETER (NX=150,NY=150)
      DIMENSION ux(NX,NY) , uy(NX,NY) , vx(NX,NY) , vy(NX,NY) ,         &
     &          tx(NX,NY)
      DIMENSION DX(NX,33) , DY(NY,33)
      DIMENSION U(NX,NY) , V(NX,NY) , P(NX,NY) , RHO(NX,NY) , E(NX,NY)
      DIMENSION NPX(30) , x(NX) , NPY(30) , y(NY) , ALX(30) , bex(30)
      COMMON /XD1   / FP1 , FM1 , FP2 , FM2 , FP3 , FM3 , FP4 , FM4 ,   &
     &                FP1x , FM1x , FP2x , FM2x , FP3x , FM3x , FP4x ,  &
     &                FM4x , FV2 , FV3 , FV4 , DXP2 , DXM2 , DXP3 ,     &
     &                DXM3 , DXP4 , DXM4 , DX , NPX , ALX , NDX , MXPy
      COMMON /BNDRY / U , V , P , RHO , T , E , AS1 , AS2 , AS3 , AS4 , &
     &                NX1 , NY1 , NX2 , NY2 , SIG , GMA , S0 , T0 , P0 ,&
     &                PE , HOO , RR , MINlet


      CALL DERIVX(DX,U,ux,ALX,NPX,NDX,MXPy)

      END

      SUBROUTINE DERIVX(D,U,Ux,Al,Np,Nd,M)
      IMPLICIT REAL*8(A-H,O-Z)
      PARAMETER (NX=150,NY=150)
      DIMENSION D(NX,33) , U(NX,NY) , Ux(NX,NY) , Al(30) , Np(30)
      DO jm = 1 , M
         jmax = 0
         jmin = 1
         DO i = 1 , Nd
            jmax = jmax + Np(i) + 1
            DO j = jmin , jmax
               uxt = 0.
               DO k = 0 , Np(i)
                  uxt = uxt + D(j,k+1)*U(jmin+k,jm)
               ENDDO
               Ux(j,jm) = uxt*Al(i)
            ENDDO
            jmin = jmin + Np(i) + 1
         ENDDO
      ENDDO
      CONTINUE
      END


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

* [Bug tree-optimization/49851] IVOPTs makes a mess out of polyhedron air derivx and derivy
  2011-07-26 11:27 [Bug tree-optimization/49851] New: IVOPTs makes a mess out of polyhedron air derivx and derivy rguenth at gcc dot gnu.org
  2011-07-26 12:54 ` [Bug tree-optimization/49851] " rguenth at gcc dot gnu.org
@ 2011-07-26 13:59 ` rguenth at gcc dot gnu.org
  2011-07-26 14:32 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-07-26 13:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-07-26 13:59:26 UTC ---
AIR spends 86% of its time in DERIV[XY] (for ICC), 78% of its time there for
GCC.
The performance difference also reproduces when not inlining DERIV[XY] at all
(though it's slightly less of a difference - GCC doesn't care).


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

* [Bug tree-optimization/49851] IVOPTs makes a mess out of polyhedron air derivx and derivy
  2011-07-26 11:27 [Bug tree-optimization/49851] New: IVOPTs makes a mess out of polyhedron air derivx and derivy rguenth at gcc dot gnu.org
  2011-07-26 12:54 ` [Bug tree-optimization/49851] " rguenth at gcc dot gnu.org
  2011-07-26 13:59 ` rguenth at gcc dot gnu.org
@ 2011-07-26 14:32 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-07-26 14:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-07-26 14:32:35 UTC ---
(In reply to comment #2)
> AIR spends 86% of its time in DERIV[XY] (for ICC), 78% of its time there for
> GCC.
> The performance difference also reproduces when not inlining DERIV[XY] at all
> (though it's slightly less of a difference - GCC doesn't care).

Actually it does not.  Without inlining:

GCC:   air      2.42     4728556      3.99      10  0.1798
      SUBROUTINE DERIVX(D,U,Ux,Al,Np,Nd,M) /* derivx_ total: 8194999 42.3750 */
      SUBROUTINE DERIVY(D,U,Uy,Al,Np,Nd,M) /* derivy_ total: 8176250 42.2781 */

ICC:   air      2.90     4072563      3.45      10  0.1809
      SUBROUTINE DERIVX(D,U,Ux,Al,Np,Nd,M) /* derivx_ total: 8060834 47.2620 */
      SUBROUTINE DERIVY(D,U,Uy,Al,Np,Nd,M) /* derivy_ total: 7070627 41.4563 */

so not much difference in the total hits.  Which means ICC performs some
context-dependent optimization.


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

end of thread, other threads:[~2011-07-26 14:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-26 11:27 [Bug tree-optimization/49851] New: IVOPTs makes a mess out of polyhedron air derivx and derivy rguenth at gcc dot gnu.org
2011-07-26 12:54 ` [Bug tree-optimization/49851] " rguenth at gcc dot gnu.org
2011-07-26 13:59 ` rguenth at gcc dot gnu.org
2011-07-26 14:32 ` 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).