public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/37131]  New: inline matmul for small matrix sizes
@ 2008-08-15 19:24 tkoenig at gcc dot gnu dot org
  2008-08-16 22:56 ` [Bug fortran/37131] " pinskia at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 30+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2008-08-15 19:24 UTC (permalink / raw)
  To: gcc-bugs

Ouch.

This is a factor of 20 for this simple test case on my computer.

$ cat foo.f90
program main
  real, dimension(3,3) :: a,b,c
  call random_number(a)
  call random_number(b)
  do i=1,10**8
    c = matmul(a,b)
    a(1,1) = a(1,1) + b(1,1) - c(1,1)
  end do
  print *,c
end program main

$ gfortran -O3 foo.f90
$ time ./a.out
  0.34224379      0.27477881      0.48155165      0.76788843      0.65491939   
   1.2103429      0.38770726      0.38460296      0.87301219

real    0m20.733s
user    0m19.585s
sys     0m0.000s
$ cat bar.f90
program main
  real, dimension(3,3) :: a,b,c
  call random_number(a)
  call random_number(b)
  do i=1,10**8
    forall (i=1:3)
      forall (j=1:3)
        c(i,j) = sum(a(i,:) * b(:,j))
      end forall
    end forall
    a(1,1) = a(1,1) + b(1,1) - c(1,1)
  end do
  print *,c
end program main

$ gfortran -O3 bar.f90
$ time ./a.out
  0.34224379      0.27477881      0.48155165      0.76788843      0.65491939   
   1.2103429      0.38770726      0.38460296      0.87301219

real    0m1.075s
user    0m1.060s
sys     0m0.000s
$


-- 
           Summary: inline matmul for small matrix sizes
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org


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


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

* [Bug fortran/37131] inline matmul for small matrix sizes
  2008-08-15 19:24 [Bug fortran/37131] New: inline matmul for small matrix sizes tkoenig at gcc dot gnu dot org
@ 2008-08-16 22:56 ` pinskia at gcc dot gnu dot org
  2008-08-23 13:20 ` tkoenig at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 30+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-08-16 22:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2008-08-16 22:55 -------
Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-08-16 22:55:22
               date|                            |


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


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

* [Bug fortran/37131] inline matmul for small matrix sizes
  2008-08-15 19:24 [Bug fortran/37131] New: inline matmul for small matrix sizes tkoenig at gcc dot gnu dot org
  2008-08-16 22:56 ` [Bug fortran/37131] " pinskia at gcc dot gnu dot org
@ 2008-08-23 13:20 ` tkoenig at gcc dot gnu dot org
  2008-11-29 16:20 ` burnus at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 30+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2008-08-23 13:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from tkoenig at gcc dot gnu dot org  2008-08-23 13:18 -------
Created an attachment (id=16134)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16134&action=view)
test case

Actually, the test cases were a bit unfair, because 
the middle-end decided not to calculate the
values of c that were never used.

Attached is a better test case.

Timings on x86_64-unknown-linux-gnu:

 matmul =    12.840802      s
 subroutine without explicit interface:   0.88805580      s
 subroutine with explicit interface:   0.87605572      s
 inline with sum   2.0721283      s

While inlining is still much better than matmul, a hand-rolled
3*3 subroutine is much faster overall, which I find a bit surprising.


-- 


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


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

* [Bug fortran/37131] inline matmul for small matrix sizes
  2008-08-15 19:24 [Bug fortran/37131] New: inline matmul for small matrix sizes tkoenig at gcc dot gnu dot org
  2008-08-16 22:56 ` [Bug fortran/37131] " pinskia at gcc dot gnu dot org
  2008-08-23 13:20 ` tkoenig at gcc dot gnu dot org
@ 2008-11-29 16:20 ` burnus at gcc dot gnu dot org
  2008-12-04 20:00 ` tkoenig at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 30+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-11-29 16:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from burnus at gcc dot gnu dot org  2008-11-29 16:18 -------
(In reply to comment #4)
> Timings on x86_64-unknown-linux-gnu:
>  matmul =    12.840802      s
>  subroutine without explicit interface:   0.88805580      s
>  subroutine with explicit interface:   0.87605572      s
>  inline with sum   2.0721283      s

With -O2 I get:
 matmul =    10.724670      s
 subroutine without explicit interface:    7.7324829      s
 subroutine with explicit interface:    7.8684921      s
 inline with sum   7.7684860      s

Only with I get with -O3 -ffast-math -march=native on AMD64 the following:
 matmul =    10.656666      s
 subroutine without explicit interface:   0.91205692      s
 subroutine with explicit interface:   0.82805157      s
 inline with sum   2.4521542      s

For comparison with ifort ("loop was vectorized" in lines 40, 41, 43):
 matmul =    2.660166      s
 subroutine without explicit interface:   0.0000000E+00  s
 subroutine with explicit interface:   0.0000000E+00  s
 inline with sum  0.0000000E+00  s
and openf95 -O3:
 matmul =  1.26807904  s  (-O2: 28.2537651  s)
 subroutine without explicit interface:  1.07606697  s (4.07225418)
 subroutine with explicit interface:  1.05206609  s (4.08025742)
 inline with sum 0.748046875  s (3.7522316)


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu dot
                   |                            |org


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


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

* [Bug fortran/37131] inline matmul for small matrix sizes
  2008-08-15 19:24 [Bug fortran/37131] New: inline matmul for small matrix sizes tkoenig at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-11-29 16:20 ` burnus at gcc dot gnu dot org
@ 2008-12-04 20:00 ` tkoenig at gcc dot gnu dot org
  2008-12-09 22:13 ` tkoenig at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 30+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2008-12-04 20:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from tkoenig at gcc dot gnu dot org  2008-12-04 19:58 -------
(In reply to comment #5)

> For comparison with ifort ("loop was vectorized" in lines 40, 41, 43):
>  matmul =    2.660166      s
>  subroutine without explicit interface:   0.0000000E+00  s
>  subroutine with explicit interface:   0.0000000E+00  s
>  inline with sum  0.0000000E+00  s

ifort detects that the call to invalidate doesn't actually invalidate
anything and so just removes the whole matmul stuff.

Intelligent, but bad for benchmarks :-)


-- 


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


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

* [Bug fortran/37131] inline matmul for small matrix sizes
  2008-08-15 19:24 [Bug fortran/37131] New: inline matmul for small matrix sizes tkoenig at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2008-12-04 20:00 ` tkoenig at gcc dot gnu dot org
@ 2008-12-09 22:13 ` tkoenig at gcc dot gnu dot org
  2010-05-14  9:15 ` tkoenig at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 30+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2008-12-09 22:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from tkoenig at gcc dot gnu dot org  2008-12-09 22:12 -------
Created an attachment (id=16866)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16866&action=view)
better test case

Thou shalt use IMPLICIT none, especially if you think you don't need it...

Here's a better test case, which actually tests the right thing.

Timings with 4.4 on i686-pc-linux-gnu:

 matmul =    15.596974      s
 subroutine with explicit interface:    3.6842318      s
 unrolled subroutine with explicit interface:    3.3522091      s
 inline with sum   3.3602085      s


-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #16134|0                           |1
        is obsolete|                            |


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


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

* [Bug fortran/37131] inline matmul for small matrix sizes
  2008-08-15 19:24 [Bug fortran/37131] New: inline matmul for small matrix sizes tkoenig at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2008-12-09 22:13 ` tkoenig at gcc dot gnu dot org
@ 2010-05-14  9:15 ` tkoenig at gcc dot gnu dot org
  2010-06-04 22:32 ` tkoenig at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 30+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2010-05-14  9:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from tkoenig at gcc dot gnu dot org  2010-05-14 09:15 -------
New timings, on x86_64-unknown-linux-gnu.  I split off the "invalidate"
subroutine to make sure the optimizers don't optimize this out:

ig25@linux-fd1f:/tmp> gfortran -O3 matmul.f90 invalidate.f90
ig25@linux-fd1f:/tmp> time ./a.out
 matmul =    11.100311      s
 subroutine with explicit interface:    2.0216932      s
 unrolled subroutine with explicit interface:    1.9317064      s
 inline with sum   1.9087105      s

real    0m16.971s
user    0m16.959s
sys     0m0.005s


-- 


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


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

* [Bug fortran/37131] inline matmul for small matrix sizes
  2008-08-15 19:24 [Bug fortran/37131] New: inline matmul for small matrix sizes tkoenig at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2010-05-14  9:15 ` tkoenig at gcc dot gnu dot org
@ 2010-06-04 22:32 ` tkoenig at gcc dot gnu dot org
  2010-06-05  6:55 ` paul dot richard dot thomas at gmail dot com
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 30+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2010-06-04 22:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from tkoenig at gcc dot gnu dot org  2010-06-04 22:31 -------
I have thought a little bit about this, and the problem is
a bit daunting ;-)  Of course, this is at least partly because
my experience with the scalarizer is close to non-existant, but you
have to learn sometime.

It seems that the functions for scalarizing do not help a lot
here, because (for example) we need three nested loops for implementing
the case where a and b are of rank 2.

The preferred way would therefore be to state the rank 2 * rank 2 problem as

  do i=1,m
     do j=1,n
        c(i,j) = sum(a(i,:) * b(:,j))
     end do
  end do

with the inner dot product borrowed using the scalarizer (borrowing
from dot_product), and the outer loops using either hand-crafted
TREE code or calling the DO translation.

Comments?  Is this reasonable?


-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pault at gcc dot gnu dot org


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


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

* [Bug fortran/37131] inline matmul for small matrix sizes
  2008-08-15 19:24 [Bug fortran/37131] New: inline matmul for small matrix sizes tkoenig at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2010-06-04 22:32 ` tkoenig at gcc dot gnu dot org
@ 2010-06-05  6:55 ` paul dot richard dot thomas at gmail dot com
  2010-06-05  8:49 ` tkoenig at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 30+ messages in thread
From: paul dot richard dot thomas at gmail dot com @ 2010-06-05  6:55 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1406 bytes --]



------- Comment #10 from paul dot richard dot thomas at gmail dot com  2010-06-05 06:55 -------
Subject: Re:  inline matmul for small matrix sizes

Dear Thomas,


> The preferred way would therefore be to state the rank 2 * rank 2 problem as
>
>  do i=1,m
>     do j=1,n
>        c(i,j) = sum(a(i,:) * b(:,j))
>     end do
>  end do
>
> with the inner dot product borrowed using the scalarizer (borrowing
> from dot_product), and the outer loops using either hand-crafted
> TREE code or calling the DO translation.

Yes that is reasonable.  Otherwise, you could borrow a little trick
that I used in allocatable components: trans-array.c:6020

      gfc_add_expr_to_block (&loopbody, tmp);

      /* Build the loop and return.  */
      gfc_init_loopinfo (&loop);
      loop.dimen = 1;
      loop.from[0] = gfc_index_zero_node;
      loop.loopvar[0] = index;
      loop.to[0] = nelems;
      gfc_trans_scalarizing_loops (&loop, &loopbody);
      gfc_add_block_to_block (&fnblock, &loop.pre);

      tmp = gfc_finish_block (&fnblock);
      if (null_cond != NULL_TREE)
        tmp = build3_v (COND_EXPR, null_cond, tmp,
                        build_empty_stmt (input_location));

Here tmp in the first line is the expression or finished block within
the loop.  Earlier on, you will find an expression involving the
index.

Cheers

Paul


-- 


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


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

* [Bug fortran/37131] inline matmul for small matrix sizes
  2008-08-15 19:24 [Bug fortran/37131] New: inline matmul for small matrix sizes tkoenig at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2010-06-05  6:55 ` paul dot richard dot thomas at gmail dot com
@ 2010-06-05  8:49 ` tkoenig at gcc dot gnu dot org
  2010-06-05  9:31 ` mikael at gcc dot gnu dot org
  2010-06-05 18:27 ` tkoenig at netcologne dot de
  10 siblings, 0 replies; 30+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2010-06-05  8:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from tkoenig at gcc dot gnu dot org  2010-06-05 08:49 -------
Dear Paul,

thanks a lot for your helpful comments.

Just one thing:  I currently don't see how to refer to multiple
indices for an array element.

In the code you pointed out, this is done with a single variable,
recursing for multiple dimension (or that is how I read the code,
which might not be correct).

Any more hints?

Thomas


-- 


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


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

* [Bug fortran/37131] inline matmul for small matrix sizes
  2008-08-15 19:24 [Bug fortran/37131] New: inline matmul for small matrix sizes tkoenig at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2010-06-05  8:49 ` tkoenig at gcc dot gnu dot org
@ 2010-06-05  9:31 ` mikael at gcc dot gnu dot org
  2010-06-05 18:27 ` tkoenig at netcologne dot de
  10 siblings, 0 replies; 30+ messages in thread
From: mikael at gcc dot gnu dot org @ 2010-06-05  9:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from mikael at gcc dot gnu dot org  2010-06-05 09:31 -------
(In reply to comment #9)
> I have thought a little bit about this, and the problem is
> a bit daunting ;-)  Of course, this is at least partly because
> my experience with the scalarizer is close to non-existant, but you
> have to learn sometime.
> 
> It seems that the functions for scalarizing do not help a lot
> here, because (for example) we need three nested loops for implementing
> the case where a and b are of rank 2.
> 
> The preferred way would therefore be to state the rank 2 * rank 2 problem as
> 
>   do i=1,m
>      do j=1,n
>         c(i,j) = sum(a(i,:) * b(:,j))
>      end do
>   end do
> 
> with the inner dot product borrowed using the scalarizer (borrowing
> from dot_product), and the outer loops using either hand-crafted
> TREE code or calling the DO translation.
> 
> Comments?  Is this reasonable?
> 

The downside is that you can't use directly the matmul result in an expression. 
You will need a temporary. 

I'm working on nested scalarization loops for the sum intrinsic (pr43829) ;
inlining matmul should be straightforward after that. 


-- 


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


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

* [Bug fortran/37131] inline matmul for small matrix sizes
  2008-08-15 19:24 [Bug fortran/37131] New: inline matmul for small matrix sizes tkoenig at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2010-06-05  9:31 ` mikael at gcc dot gnu dot org
@ 2010-06-05 18:27 ` tkoenig at netcologne dot de
  10 siblings, 0 replies; 30+ messages in thread
From: tkoenig at netcologne dot de @ 2010-06-05 18:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from tkoenig at netcologne dot de  2010-06-05 18:27 -------
Subject: Re:  inline matmul for small matrix sizes

mikael at gcc dot gnu dot org wrote:

> I'm working on nested scalarization loops for the sum intrinsic
> (pr43829) ;
> inlining matmul should be straightforward after that. 

I agree that this is the best approach - teach the scalarizer about
multidimensional arrays.

I'll hold further work on this PR until your work in this is finished.


-- 


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


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

* [Bug fortran/37131] inline matmul for small matrix sizes
       [not found] <bug-37131-4@http.gcc.gnu.org/bugzilla/>
                   ` (16 preceding siblings ...)
  2015-05-21 19:05 ` tkoenig at gcc dot gnu.org
@ 2021-10-23 22:11 ` sandra at gcc dot gnu.org
  17 siblings, 0 replies; 30+ messages in thread
From: sandra at gcc dot gnu.org @ 2021-10-23 22:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37131
Bug 37131 depends on bug 65819, which changed state.

Bug 65819 Summary: overzealous checking in gfc_check_dependency for identical=true
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65819

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

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

* [Bug fortran/37131] inline matmul for small matrix sizes
       [not found] <bug-37131-4@http.gcc.gnu.org/bugzilla/>
                   ` (15 preceding siblings ...)
  2015-05-12  6:38 ` tkoenig at gcc dot gnu.org
@ 2015-05-21 19:05 ` tkoenig at gcc dot gnu.org
  2021-10-23 22:11 ` sandra at gcc dot gnu.org
  17 siblings, 0 replies; 30+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2015-05-21 19:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37131
Bug 37131 depends on bug 66176, which changed state.

Bug 66176 Summary: Handle conjg() in inline matmul
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66176

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED


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

* [Bug fortran/37131] inline matmul for small matrix sizes
       [not found] <bug-37131-4@http.gcc.gnu.org/bugzilla/>
                   ` (14 preceding siblings ...)
  2015-05-06 21:33 ` tkoenig at gcc dot gnu.org
@ 2015-05-12  6:38 ` tkoenig at gcc dot gnu.org
  2015-05-21 19:05 ` tkoenig at gcc dot gnu.org
  2021-10-23 22:11 ` sandra at gcc dot gnu.org
  17 siblings, 0 replies; 30+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2015-05-12  6:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37131

--- Comment #30 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Author: tkoenig
Date: Tue May 12 06:37:43 2015
New Revision: 223031

URL: https://gcc.gnu.org/viewcvs?rev=223031&root=gcc&view=rev
Log:
2015-05-12  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR fortran/66041
        PR fortran/37131
        * gfortran.h (gfc_array_spec):  Add field resolved.
        * array.c (gfc_resolve_array_spec):  Resolve array spec
        only once.


Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/array.c
    trunk/gcc/fortran/gfortran.h


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

* [Bug fortran/37131] inline matmul for small matrix sizes
       [not found] <bug-37131-4@http.gcc.gnu.org/bugzilla/>
                   ` (13 preceding siblings ...)
  2015-05-06 20:24 ` tkoenig at gcc dot gnu.org
@ 2015-05-06 21:33 ` tkoenig at gcc dot gnu.org
  2015-05-12  6:38 ` tkoenig at gcc dot gnu.org
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 30+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2015-05-06 21:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37131

--- Comment #29 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Further ideas:

- Handling of TRANSPOSEd arguments

- Temporaries for arguments which are not plain arrays

- Remove size<0 checks (the DO loops will do that on their own)

- Remove double run-time checks, both at the beginning and in the DO loops
themselves


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

* [Bug fortran/37131] inline matmul for small matrix sizes
       [not found] <bug-37131-4@http.gcc.gnu.org/bugzilla/>
                   ` (12 preceding siblings ...)
  2015-05-03 18:10 ` tkoenig at gcc dot gnu.org
@ 2015-05-06 20:24 ` tkoenig at gcc dot gnu.org
  2015-05-06 21:33 ` tkoenig at gcc dot gnu.org
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 30+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2015-05-06 20:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37131

--- Comment #28 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Author: tkoenig
Date: Wed May  6 20:23:48 2015
New Revision: 222864

URL: https://gcc.gnu.org/viewcvs?rev=222864&root=gcc&view=rev
Log:
2015-05-06  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR fortran/37131
        * gfortran.h (gfc_isym_id):  Add GFC_ISYM_FE_RUNTIME_ERROR.
        (gfc_intrinsic_sym):  Add vararg.
        * intrinsic.h (gfc_check_fe_runtime_error):  Add prototype.
        (gfc_resolve_re_runtime_error):  Likewise.
        Add prototype for gfc_is_reallocatable_lhs.
        * trans-array.h (gfc_is_reallocatable_lhs):  Remove prototype.
        * check.c (gfc_check_fe_runtime_error):  New function.
        * intrinsic.c (add_sym_1p):  New function.
        (make_vararg):  New function.
        (add_subroutines):  Add fe_runtime_error.
        (gfc_intrinsic_sub_interface): Skip sorting for variable number
        of arguments.
        * iresolve.c (gfc_resolve_fe_runtime_error):  New function.
        * lang.opt (inline-matmul-limit):  New option.
        (gfc_post_options): If no inline matmul limit has been set and
        BLAS is called externally, use the BLAS limit.
        * frontend-passes.c:  Include intrinsic.h.
        (var_num):  New global counter for naming temporary variablbles.
        (matrix_case):  Enum for differentiating the different matmul
        cases.
        (realloc_string_callback):  Add "trim" to the variable name.
        (create_var): Add optional argument vname as part of the name.
        Use var_num. Set dimension of result correctly. Split off block
        creation into
        (insert_block): New function.
        (cfe_expr_0): Use "fcn" as part of temporary variable name.
        (optimize_namesapce): Also set gfc_current_ns. Call
        inline_matmul_assign.
        (combine_array_constructor):  Use "constr" as part of
        temporary name.
        (get_array_inq_function):  New function.
        (build_logical_expr):  New function.
        (get_operand):  new function.
        (inline_limit_check):  New function.
        (runtime_error_ne):  New function.
        (matmul_lhs_realloc):  New function.
        (is_functino_or_op):  New function.
        (has_function_or_op):  New function.
        (freeze_expr):  New function.
        (freeze_references):  New function.
        (convert_to_index_kind):  New function.
        (create_do_loop):  New function.
        (get_size_m1):  New function.
        (scalarized_expr):  New function.
        (inline_matmul_assign):  New function.
        * simplify.c (simplify_bound):  Simplify the case of the
        lower bound of an assumed-shape argument.

2015-05-06  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR fortran/37131
        * gfortran.dg/dependency_26.f90: Add option to suppress inlining
        matmul.
        * gfortran.dg/function_optimize_1.f90:  Likewise.
        * gfortran.dg/function_optimize_2.f90:  Likewise.
        * gfortran.dg/function_optimize_5.f90:  Likewise.
        * gfortran.dg/function_optimize_7.f90:  Likewise.
        * gfortran.dg/inline_matmul_1.f90:  New test.
        * gfortran.dg/inline_matmul_2.f90:  New test.
        * gfortran.dg/inline_matmul_3.f90:  New test.
        * gfortran.dg/inline_matmul_4.f90:  New test.
        * gfortran.dg/inline_matmul_5.f90:  New test.
        * gfortran.dg/inline_matmul_6.f90:  New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/inline_matmul_1.f90
    trunk/gcc/testsuite/gfortran.dg/inline_matmul_2.f90
    trunk/gcc/testsuite/gfortran.dg/inline_matmul_3.f90
    trunk/gcc/testsuite/gfortran.dg/inline_matmul_4.f90
    trunk/gcc/testsuite/gfortran.dg/inline_matmul_5.f90
    trunk/gcc/testsuite/gfortran.dg/inline_matmul_6.f90
Modified:
    trunk/gcc/fortran/check.c
    trunk/gcc/fortran/frontend-passes.c
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/intrinsic.c
    trunk/gcc/fortran/intrinsic.h
    trunk/gcc/fortran/invoke.texi
    trunk/gcc/fortran/iresolve.c
    trunk/gcc/fortran/lang.opt
    trunk/gcc/fortran/options.c
    trunk/gcc/fortran/trans-array.h
    trunk/gcc/testsuite/gfortran.dg/dependency_26.f90
    trunk/gcc/testsuite/gfortran.dg/function_optimize_1.f90
    trunk/gcc/testsuite/gfortran.dg/function_optimize_2.f90
    trunk/gcc/testsuite/gfortran.dg/function_optimize_5.f90
    trunk/gcc/testsuite/gfortran.dg/function_optimize_7.f90


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

* [Bug fortran/37131] inline matmul for small matrix sizes
       [not found] <bug-37131-4@http.gcc.gnu.org/bugzilla/>
                   ` (11 preceding siblings ...)
  2015-05-02 11:31 ` schwab@linux-m68k.org
@ 2015-05-03 18:10 ` tkoenig at gcc dot gnu.org
  2015-05-06 20:24 ` tkoenig at gcc dot gnu.org
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 30+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2015-05-03 18:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37131

--- Comment #27 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Author: tkoenig
Date: Sun May  3 18:09:57 2015
New Revision: 222751

URL: https://gcc.gnu.org/viewcvs?rev=222751&root=gcc&view=rev
Log:
2015-05-03  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR fortran/37131
        * gfortran.dg/bound_9.f90:  Add pointer assignment.


Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/bound_9.f90


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

* [Bug fortran/37131] inline matmul for small matrix sizes
       [not found] <bug-37131-4@http.gcc.gnu.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2015-05-01 13:16 ` mikael at gcc dot gnu.org
@ 2015-05-02 11:31 ` schwab@linux-m68k.org
  2015-05-03 18:10 ` tkoenig at gcc dot gnu.org
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 30+ messages in thread
From: schwab@linux-m68k.org @ 2015-05-02 11:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37131

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl.tools at gmail dot com

--- Comment #26 from Andreas Schwab <schwab@linux-m68k.org> ---
*** Bug 65981 has been marked as a duplicate of this bug. ***


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

* [Bug fortran/37131] inline matmul for small matrix sizes
       [not found] <bug-37131-4@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2015-05-01 11:25 ` dominiq at lps dot ens.fr
@ 2015-05-01 13:16 ` mikael at gcc dot gnu.org
  2015-05-02 11:31 ` schwab@linux-m68k.org
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 30+ messages in thread
From: mikael at gcc dot gnu.org @ 2015-05-01 13:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37131

--- Comment #25 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Dominique d'Humieres from comment #24)
> I wonder if the above code is valid Fortran.

y is not associated, so not suitable for passing as ARRAY argument to LBOUND:

ARRAY
shall be an array of any type. It shall not be an unallocated allocatable
variable or a pointer that is not associated.


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

* [Bug fortran/37131] inline matmul for small matrix sizes
       [not found] <bug-37131-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2015-05-01  8:32 ` ubizjak at gmail dot com
@ 2015-05-01 11:25 ` dominiq at lps dot ens.fr
  2015-05-01 13:16 ` mikael at gcc dot gnu.org
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 30+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-05-01 11:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37131

--- Comment #24 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Reduced test

module tst
  implicit none
contains

  subroutine bar (a, b, n, m)
    integer, dimension(:), allocatable, intent(inout) :: a
    integer, dimension(:), pointer, intent(inout) :: b
    integer, intent(out) :: n, m
    n = lbound(a,1)
    m = lbound(b,1)
  end subroutine bar

end module tst

program main
  use tst
  implicit none
  integer, dimension(:), allocatable :: x
!  integer, dimension(:), allocatable, target :: x
  integer, dimension(:), pointer :: y
  integer :: n,m


  allocate (x(0))
!  y => x
  call bar (x, y, n, m)
!  print *, m, n
  if (n .ne. 1 .or. m .ne. 1) call abort

end program main

gives

Program aborted. Backtrace:
#0  0x1020a0472
#1  0x1020a1612
#2  0x102176428
#3  0x102098ecb
Abort

The program runs without abort if

(1) I uncomment the line

!  print *, m, n

(2) I uncomment the lines

!  integer, dimension(:), allocatable, target :: x

and

!  y => x

and I comment the line

  integer, dimension(:), allocatable :: x

I wonder if the above code is valid Fortran.


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

* [Bug fortran/37131] inline matmul for small matrix sizes
       [not found] <bug-37131-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2015-05-01  7:15 ` schwab@linux-m68k.org
@ 2015-05-01  8:32 ` ubizjak at gmail dot com
  2015-05-01 11:25 ` dominiq at lps dot ens.fr
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 30+ messages in thread
From: ubizjak at gmail dot com @ 2015-05-01  8:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37131

--- Comment #23 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Andreas Schwab from comment #22)
> Program aborted. Backtrace:
> #0  0x3FF95D8B973
> FAIL: gfortran.dg/bound_9.f90   -O  execution test

Thanks for the report! Before we can proceed, please send us all the
information that we need to solve the bug. Please read [1] for further
instructions.

[1] https://gcc.gnu.org/bugs/#report
>From gcc-bugs-return-485166-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri May 01 08:33:12 2015
Return-Path: <gcc-bugs-return-485166-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 1227 invoked by alias); 1 May 2015 08:33:12 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 1196 invoked by uid 48); 1 May 2015 08:33:08 -0000
From: "roland.illig at gmx dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug translation/65959] New: plain text incorrectly marked as format-c
Date: Fri, 01 May 2015 08:33:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: translation
X-Bugzilla-Version: 5.1.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: roland.illig at gmx dot de
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone
Message-ID: <bug-65959-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-05/txt/msg00006.txt.bz2
Content-length: 759

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65959

            Bug ID: 65959
           Summary: plain text incorrectly marked as format-c
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: translation
          Assignee: unassigned at gcc dot gnu.org
          Reporter: roland.illig at gmx dot de
  Target Milestone: ---

From gcc/po/gcc.pot:

#: params.def:417
#, c-format
msgid "Set the estimated probability in percentage for builtin expect. The
default value is 90% probability."
msgstr "Wahrscheinlichkeit in Prozent für das eingebaute »expect«. Vorgabewert
ist 90 % Wahrscheinlichkeit."

This is not a %p format specifier.
>From gcc-bugs-return-485167-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri May 01 08:36:37 2015
Return-Path: <gcc-bugs-return-485167-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 2719 invoked by alias); 1 May 2015 08:36:36 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 2674 invoked by uid 48); 1 May 2015 08:36:33 -0000
From: "roland.illig at gmx dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug translation/65959] plain text incorrectly marked as format-c
Date: Fri, 01 May 2015 08:36:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: translation
X-Bugzilla-Version: 5.1.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: roland.illig at gmx dot de
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-65959-4-UBGrFobVaQ@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65959-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65959-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-05/txt/msg00007.txt.bz2
Content-length: 360

https://gcc.gnu.org/bugzilla/show_bug.cgi?ide959

--- Comment #1 from Roland Illig <roland.illig at gmx dot de> ---
I only noticed this because GNU gettext complains that I must not translate %p
to %W.

Error: 'msgstr' is not a valid C format string, unlike 'msgid'. Reason: In the
directive number 1, the character 'W' is not a valid conversion specifier.


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

* [Bug fortran/37131] inline matmul for small matrix sizes
       [not found] <bug-37131-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2015-04-30 22:13 ` tkoenig at gcc dot gnu.org
@ 2015-05-01  7:15 ` schwab@linux-m68k.org
  2015-05-01  8:32 ` ubizjak at gmail dot com
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 30+ messages in thread
From: schwab@linux-m68k.org @ 2015-05-01  7:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37131

--- Comment #22 from Andreas Schwab <schwab@linux-m68k.org> ---
Program aborted. Backtrace:
#0  0x3FF95D8B973
FAIL: gfortran.dg/bound_9.f90   -O  execution test


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

* [Bug fortran/37131] inline matmul for small matrix sizes
       [not found] <bug-37131-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2015-04-20 11:45 ` tkoenig at gcc dot gnu.org
@ 2015-04-30 22:13 ` tkoenig at gcc dot gnu.org
  2015-05-01  7:15 ` schwab@linux-m68k.org
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 30+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2015-04-30 22:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37131

--- Comment #21 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Author: tkoenig
Date: Thu Apr 30 22:12:31 2015
New Revision: 222661

URL: https://gcc.gnu.org/viewcvs?rev=222661&root=gcc&view=rev
Log:
2015-04-30  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR fortran/37131
        * simplify.c (simplify_bound): Get constant lower bounds of one
        from array spec for assumed and explicit shape shape arrays if
        the lower bounds are indeed one.

2015-04-30  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR fortran/37131
        * gfortran.dg/coarray_lib_this_image_2.f90:  Adjust
        scan pattern.
        * gfortran.dg/bound_9.f90:  New test case.

Added:
    trunk/gcc/testsuite/gfortran.dg/bound_9.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/simplify.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/coarray_lib_this_image_2.f90


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

* [Bug fortran/37131] inline matmul for small matrix sizes
       [not found] <bug-37131-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2015-04-18 23:17 ` tkoenig at gcc dot gnu.org
@ 2015-04-20 11:45 ` tkoenig at gcc dot gnu.org
  2015-04-30 22:13 ` tkoenig at gcc dot gnu.org
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 30+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2015-04-20 11:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37131

--- Comment #20 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
First submitted patch:

https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00969.html


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

* [Bug fortran/37131] inline matmul for small matrix sizes
       [not found] <bug-37131-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2015-04-18 23:09 ` tkoenig at gcc dot gnu.org
@ 2015-04-18 23:17 ` tkoenig at gcc dot gnu.org
  2015-04-20 11:45 ` tkoenig at gcc dot gnu.org
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 30+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2015-04-18 23:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37131

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #19 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
This is about what I had in mind for a first commit.  More to do afterwards:

- Get more test cases
- Handle TRANSPOSE
- Better handling of temporaries
- Remove the unnecessary run-time bounds checks
- I forgot to make fe_runtime_error inaccessible to the user (trivial)
- %ld may be doning the wrong thing in error reporting for bounds check with 32
bit


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

* [Bug fortran/37131] inline matmul for small matrix sizes
       [not found] <bug-37131-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2015-01-11 16:12 ` tkoenig at gcc dot gnu.org
@ 2015-04-18 23:09 ` tkoenig at gcc dot gnu.org
  2015-04-18 23:17 ` tkoenig at gcc dot gnu.org
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 30+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2015-04-18 23:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37131

--- Comment #18 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Created attachment 35356
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35356&action=edit
First attempt that appears to work

Well, this seems to work so far, no regressions.


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

* [Bug fortran/37131] inline matmul for small matrix sizes
       [not found] <bug-37131-4@http.gcc.gnu.org/bugzilla/>
  2011-01-02 23:20 ` tkoenig at gcc dot gnu.org
  2014-10-03 19:56 ` mikael at gcc dot gnu.org
@ 2015-01-11 16:12 ` tkoenig at gcc dot gnu.org
  2015-04-18 23:09 ` tkoenig at gcc dot gnu.org
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 30+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2015-01-11 16:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37131

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |tkoenig at gcc dot gnu.org

--- Comment #17 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
I'm currently working on that.  Basically, it means adding a flexible
scalarizer in the front end passes.

I think I have some idea on how to go about this.


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

* [Bug fortran/37131] inline matmul for small matrix sizes
       [not found] <bug-37131-4@http.gcc.gnu.org/bugzilla/>
  2011-01-02 23:20 ` tkoenig at gcc dot gnu.org
@ 2014-10-03 19:56 ` mikael at gcc dot gnu.org
  2015-01-11 16:12 ` tkoenig at gcc dot gnu.org
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 30+ messages in thread
From: mikael at gcc dot gnu.org @ 2014-10-03 19:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37131

--- Comment #16 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Thomas Koenig from comment #15)
> Hi Mikael,
> 
> do you think you can do this using the scalarizer?
> 
Not in its current state.
And as I don't see the scalarizer being changed soon to allow it, you're better
off trying with the frontend optimization framework.

I thought inlining sum with the scalarizer would make inlining matmul easy
because it would allow the scalarizer to support arrays as result of nested
reductions.
But matmul is different from sum, so it's actually not that easy.


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

* [Bug fortran/37131] inline matmul for small matrix sizes
       [not found] <bug-37131-4@http.gcc.gnu.org/bugzilla/>
@ 2011-01-02 23:20 ` tkoenig at gcc dot gnu.org
  2014-10-03 19:56 ` mikael at gcc dot gnu.org
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 30+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2011-01-02 23:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-01-02 23:20:07 UTC ---
Created attachment 22883
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22883
matmul loops that vectorize

Here's how we could make the different matmul loops look like
for different transpose cases.  The inner loops vectorize, at least
with --fast-math.

The last one needs a different temp strategy for vectorization.


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

end of thread, other threads:[~2021-10-23 22:11 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-15 19:24 [Bug fortran/37131] New: inline matmul for small matrix sizes tkoenig at gcc dot gnu dot org
2008-08-16 22:56 ` [Bug fortran/37131] " pinskia at gcc dot gnu dot org
2008-08-23 13:20 ` tkoenig at gcc dot gnu dot org
2008-11-29 16:20 ` burnus at gcc dot gnu dot org
2008-12-04 20:00 ` tkoenig at gcc dot gnu dot org
2008-12-09 22:13 ` tkoenig at gcc dot gnu dot org
2010-05-14  9:15 ` tkoenig at gcc dot gnu dot org
2010-06-04 22:32 ` tkoenig at gcc dot gnu dot org
2010-06-05  6:55 ` paul dot richard dot thomas at gmail dot com
2010-06-05  8:49 ` tkoenig at gcc dot gnu dot org
2010-06-05  9:31 ` mikael at gcc dot gnu dot org
2010-06-05 18:27 ` tkoenig at netcologne dot de
     [not found] <bug-37131-4@http.gcc.gnu.org/bugzilla/>
2011-01-02 23:20 ` tkoenig at gcc dot gnu.org
2014-10-03 19:56 ` mikael at gcc dot gnu.org
2015-01-11 16:12 ` tkoenig at gcc dot gnu.org
2015-04-18 23:09 ` tkoenig at gcc dot gnu.org
2015-04-18 23:17 ` tkoenig at gcc dot gnu.org
2015-04-20 11:45 ` tkoenig at gcc dot gnu.org
2015-04-30 22:13 ` tkoenig at gcc dot gnu.org
2015-05-01  7:15 ` schwab@linux-m68k.org
2015-05-01  8:32 ` ubizjak at gmail dot com
2015-05-01 11:25 ` dominiq at lps dot ens.fr
2015-05-01 13:16 ` mikael at gcc dot gnu.org
2015-05-02 11:31 ` schwab@linux-m68k.org
2015-05-03 18:10 ` tkoenig at gcc dot gnu.org
2015-05-06 20:24 ` tkoenig at gcc dot gnu.org
2015-05-06 21:33 ` tkoenig at gcc dot gnu.org
2015-05-12  6:38 ` tkoenig at gcc dot gnu.org
2015-05-21 19:05 ` tkoenig at gcc dot gnu.org
2021-10-23 22:11 ` sandra 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).