Hello,

I am seeking your opinion on what is the best way to solve a problem that I 
observed.

Compiler assumes that formal parameters based on different symbols in Fortran 
programs are not aliased.  This leads to a runtime error for CPU2006 416.gamess 
when "-Ofast -LNO:fusion=2" is used.

In the following code snippet, formal parameter array "D" and "DO" in 
subroutine “SYMTRD” have the same storage as their corresponding actual 
parameter "X(I40)".  Therefore the read of "D" in the 1st loop must alias with 
the write of "DO" in the 2nd loop.  When the two outermost loops are fused 
together, we got incorrect results.

In summary, the Fortran parameter no-alias rule makes loop transformations 
illegal.

For legality concern, we could rely on interprocedual analysis to track whether 
formal parameters have the same base.  But compiler analysis tends to be 
conservative and therefore could hurt performance.  It might not always be 
feasible to implement "copy-in copy-out" which may hurt performance as well.

Will that be reasonable to treat this as an user error?

Code snippet:
callsite:
CALL SYMTRD(X(I30),X(I40),X(I10),X(I40),X(I60),IA,L1,L1)

callee:
SUBROUTINE SYMTRD(SH,D,DT,DO,DOD,IA,N,NDIM)
 DIMENSION SH(*),D(*),DT(NDIM,*),DO(*),DOD(*),IA(*)
  ......
  DO 140 I = 1,N
         DO 120 J = 1,N
            DTEMP = ZERO
            DO 100 K = 1,N
               IK = IA(I)+K
               IF (I .LT. K) IK = IA(K)+I
               JK = IA(J)+K
               IF (J .LT. K) JK = IA(K)+J
               DTEMP = DTEMP+SH(IK)*D(JK)   // read of D
  100       CONTINUE
            DT(I,J) = DTEMP
  120    CONTINUE
  140 CONTINUE

      IJ = 0
      DO 200 I = 1,N
         DO 180 J = 1,I
            IJ = IJ+1
            DTEMP = ZERO
            DO 160 K = 1,N
               JK = IA(J)+K
               IF (J .LT. K) JK = IA(K)+J
               DTEMP = DTEMP+DT(I,K)*SH(JK)
  160       CONTINUE
            DO(IJ) = DTEMP                 // write of DO
  180    CONTINUE
  200 CONTINUE

-Mei Ye
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to