[Bug fortran/66094] Handle transpose(A) in inline matmul

2017-05-24 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66094

Thomas Koenig  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #11 from Thomas Koenig  ---
All significant use cases are handled now.

Closing.

[Bug fortran/66094] Handle transpose(A) in inline matmul

2017-05-24 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66094

--- Comment #10 from Thomas Koenig  ---
Author: tkoenig
Date: Wed May 24 18:44:35 2017
New Revision: 248425

URL: https://gcc.gnu.org/viewcvs?rev=248425=gcc=rev
Log:
2017-05-24  Thomas Koenig  

PR fortran/66094
* frontend-passes.c (matrix_case):  Add A2TB2.
(inline_limit_check):  Handle MATMUL(TRANSPOSE(A),B)
(inline_matmul_assign):  Likewise.

2017-05-24  Thomas Koenig  

PR fortran/66094
* gfortran.dg/inline_matmul_16.f90:  New test.


Added:
trunk/gcc/testsuite/gfortran.dg/inline_matmul_16.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/frontend-passes.c
trunk/gcc/testsuite/ChangeLog

[Bug fortran/66094] Handle transpose(A) in inline matmul

2016-01-27 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66094

Thomas Koenig  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |tkoenig at gcc dot 
gnu.org

--- Comment #9 from Thomas Koenig  ---
Created attachment 37492
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37492=edit
Patch to handle matmul(transpose(a),b)

This patch implements matmul(transpose(a),b).  However, it does not enable
vectorization even with -Ofast.

I do not intend to submit this patch in this form.

It still needs some work to create the rank-one temporary and use it,
to enable vectorization.  This is only suitable for stage 1 in gcc 7.

[Bug fortran/66094] Handle transpose(A) in inline matmul

2016-01-24 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66094

--- Comment #6 from Thomas Koenig  ---
Author: tkoenig
Date: Sun Jan 24 09:11:50 2016
New Revision: 232774

URL: https://gcc.gnu.org/viewcvs?rev=232774=gcc=rev
Log:
2016-01-24  Thomas Koenig  

PR fortran/66094
* frontend-passes.c (enum matrix_case):  Add case A2B2T for
MATMUL(A,TRANSPoSE(B)) where A and B are rank 2.
(inline_limit_check):  Also add A2B2T.
(matmul_lhs_realloc):  Handle A2B2T.
(check_conjg_variable):  Rename to
(check_conjg_transpose_variable):  and also count TRANSPOSE.
(inline_matmul_assign):  Handle A2B2T.

2016-01-24  Thomas Koenig  

PR fortran/66094
* gfortran.dg/inline_matmul_13.f90:  New test.
* gfortran.dg/matmul_bounds_8.f90:  New test.
* gfortran.dg/matmul_bounds_9.f90:  New test.
* gfortran.dg/matmul_bounds_10.f90:  New test.


Added:
trunk/gcc/testsuite/gfortran.dg/inline_matmul_13.f90
trunk/gcc/testsuite/gfortran.dg/matmul_bounds_10.f90
trunk/gcc/testsuite/gfortran.dg/matmul_bounds_8.f90
trunk/gcc/testsuite/gfortran.dg/matmul_bounds_9.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/frontend-passes.c
trunk/gcc/testsuite/ChangeLog

[Bug fortran/66094] Handle transpose(A) in inline matmul

2016-01-24 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66094

--- Comment #7 from Thomas Koenig  ---
Still to do: MATMUL(TRANSPOSE(A),B).

MATMUL(TRANSPOSE(A),TRANSPOSE(B)) would be silly.

[Bug fortran/66094] Handle transpose(A) in inline matmul

2016-01-24 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66094

--- Comment #8 from Thomas Koenig  ---
Author: tkoenig
Date: Sun Jan 24 18:15:08 2016
New Revision: 232779

URL: https://gcc.gnu.org/viewcvs?rev=232779=gcc=rev
Log:
2016-01-24  Thomas Koenig  

PR fortran/66094
* frontend-passes.c (matmul_lhs_realloc):  Add
forgotten break statement.


Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/frontend-passes.c

[Bug fortran/66094] Handle transpose(A) in inline matmul

2016-01-16 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66094

--- Comment #3 from Thomas Koenig  ---
Created attachment 37371
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37371=edit
Patch to handle matmul(a, transpose(b))

This very straightforward patch handles matmul(a, transpose(b)).

I wonder if it would still be suitable for the current status on trunk...

[Bug fortran/66094] Handle transpose(A) in inline matmul

2016-01-16 Thread jvdelisle at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66094

Jerry DeLisle  changed:

   What|Removed |Added

 CC||jvdelisle at gcc dot gnu.org

--- Comment #4 from Jerry DeLisle  ---
(In reply to Thomas Koenig from comment #3)
> Created attachment 37371 [details]
> Patch to handle matmul(a, transpose(b))
> 
> This very straightforward patch handles matmul(a, transpose(b)).
> 
> I wonder if it would still be suitable for the current status on trunk...

I think it is important enough and the patch is narrow in scope and relatively
safe, so I vote it in as soon as possible.

[Bug fortran/66094] Handle transpose(A) in inline matmul

2016-01-16 Thread jvdelisle at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66094

--- Comment #5 from Jerry DeLisle  ---
Additional comment. I hope Toon could test this on real world code and confirm.

[Bug fortran/66094] Handle transpose(A) in inline matmul

2015-09-08 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66094

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2015-09-08
 Ever confirmed|0   |1

--- Comment #2 from Dominique d'Humieres  ---
Marked as NEW (Note that 'at' should be replaced with 'a'!-).


[Bug fortran/66094] Handle transpose(A) in inline matmul

2015-05-10 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66094

Thomas Koenig tkoenig at gcc dot gnu.org changed:

   What|Removed |Added

   Keywords||missed-optimization
 Blocks||37131

--- Comment #1 from Thomas Koenig tkoenig at gcc dot gnu.org ---
It would be nice to handle

  c = matmul(transpose(a),b)

This can be changed to

  do i=1,m
 c_t = 0
 do k=1, count
do j=1,n
   c_t(j) = c_t(j) + at(k,i) * b(j,k)
end do
 end do
 c(i,:) = c_t
  end do

with a vector temporary c_t

and

 c = matmul(a,transpose(b))

changed to

  c = 0
  do k=1, count
 do j=1,n
do i=1,m
   c4(i,j) = c4(i,j) + a(i,k)*b(j,k)
end do
 end do
  end do

(without a vector temporary).


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37131
[Bug 37131] inline matmul for small matrix sizes