[patch, fortran] Index interchange for FORALL and DO CONCURRENT

Thomas Koenig tkoenig@netcologne.de
Tue Oct 31 20:34:00 GMT 2017


Hi Bernhard,

>> Regression-tested. OK for trunk?
> 
> s/shoud/should/; s/acessed/accessed/; s/indces/indices/;

Fixed.

> why are struct ind_type "n" and "num" int and not unsigned int?

I tend not to use signed variables unless the special overflow
semantics are required.  I like Fortran, which doesn't have
unsigned ints.

> Can't you scan the original dump for something characteristic?

I'd need a dejagnu multiline regexp, to reject


        i.7 = 1;
         count.10 = 512;
         while (1)
           {
             if (ANNOTATE_EXPR <count.10 <= 0, ivdep>) goto L.4;
             j.6 = 1;
             count.9 = 512;
             while (1)
               {
                 if (ANNOTATE_EXPR <count.9 <= 0, ivdep>) goto L.3;

while accepting

        k.7 = 1;
         count.10 = 512;
         while (1)
           {
             if (ANNOTATE_EXPR <count.10 <= 0, ivdep>) goto L.4;
             j.6 = 1;
             count.9 = 512;
             while (1)
               {
                 if (ANNOTATE_EXPR <count.9 <= 0, ivdep>) goto L.3;
                 i.5 = 1;
                 count.8 = 512;

and not being confused by

                     if (ANNOTATE_EXPR <count.8 <= 0, ivdep>) goto L.2;
                     (*(real(kind=4)[0:] * restrict) c.data)[((c.offset 
+ (integer(kind=8)) k.5 * c.dim[2].stride) + (integer(kind=8)) j.6 * 
c.dim[1].stride) + (integer(kind=8)) i.7] = (*(real(kind=4)[0:] * 
restrict) a.data)[((a.offset + (integer(kind=8)) k.5 * a.dim[2].stride) 
+ (integer(kind=8)) j.6 * a.dim[1].stride) + (integer(kind=8)) i.7] + 
(*(real(kind=4)[0:] * restrict) b.data)[((b.offset + (integer(kind=8)) 
k.5 * b.dim[2].stride) + (integer(kind=8)) j.6 * b.dim[1].stride) + 
(integer(kind=8)) i.7];
                     L.1:;
                     k.5 = k.5 + 1;
                     count.8 = count.8 + -1;
                   }
                 L.2:;
                 j.6 = j.6 + 1;
                 count.9 = count.9 + -1;
               }
             L.3:;
             i.7 = i.7 + 1;
             count.10 = count.10 + -1;
           }
         L.4:;
       }

... but keep that easy enough to understand so people can
change it later if somebody changes something in trans-*.
I gave up.

> Or maybe emit diagnostics into the frontend optimize dump file and scan
> that?

If we could check the Fortran tree dumps with dejagnu, that would be
doable. Unfortunately, we don't have that in place.

This would be the difference between

DO CONCURRENT test_do_speed:k 1:512:1,test_do_speed:j 
1:512:1,test_do_speed:i 1:512:1()

and

DO CONCURRENT test_do_speed:i 1:512:1,test_do_speed:j 
1:512:1,test_do_speed:k 1:512:1()

Just about the only way I can think of is to add a warning
option if something is actually interchanged. Might be worth
doing anyway, but I would like not to add too many -W options.

-fopt-info would be nice to have here (PR 66576). I had a
preliminary look at what it does for gcc, but after a look
at the source, I decided that this was not really self-explanatory
and that I'd rather do other things :-)

Regards

	Thomas



More information about the Gcc-patches mailing list