Re: [patch, fortran] Inline MATMUL(A,TRANSPOSE(B)), PR 66094

2016-01-24 Thread Toon Moene

On 01/23/2016 01:26 PM, Thomas Koenig wrote:


Hi Toon,


However, today I *did* run the test harness with your modification:


...

Thanks for the testing!

So, what do people think?  Is the patch OK for trunk?


As far as I am able to determine, this is working. We still have 3 
months (until mid-April) to fix it, if necessary.


Thanks !

--
Toon Moene - e-mail: t...@moene.org - phone: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
At home: http://moene.org/~toon/; weather: http://moene.org/~hirlam/
Progress of GNU Fortran: http://gcc.gnu.org/wiki/GFortran#news


Re: [patch, fortran] Inline MATMUL(A,TRANSPOSE(B)), PR 66094

2016-01-23 Thread Thomas Koenig

Hi Toon,


However, today I *did* run the test harness with your modification:


...

Thanks for the testing!

So, what do people think?  Is the patch OK for trunk?

Regards

Thomas


Re: [patch, fortran] Inline MATMUL(A,TRANSPOSE(B)), PR 66094

2016-01-23 Thread Jerry DeLisle
On 01/23/2016 04:26 AM, Thomas Koenig wrote:
> Hi Toon,
> 
>> However, today I *did* run the test harness with your modification:
> 
> ...
> 
> Thanks for the testing!
> 
> So, what do people think?  Is the patch OK for trunk?
> 
> Regards
> 
> Thomas
> 

Yes, OK.

Jerry


Re: [patch, fortran] Inline MATMUL(A,TRANSPOSE(B)), PR 66094

2016-01-19 Thread Toon Moene

On 01/18/2016 08:55 PM, Toon Moene wrote:


On 01/17/2016 01:44 PM, Thomas Koenig wrote:


So... comments?  Toon, would this help you?  Could yo maybe give this
a spin?


Thanks, the nightly test at my home computer will build with your patch.


That was the plan; unfortunately, the system crashed while doing this 
(due to an unrelated problem).


However, today I *did* run the test harness with your modification:

https://gcc.gnu.org/ml/gcc-testresults/2016-01/msg01795.html

Looks good.  These are the messages related to your new test cases:

/home/toon/compilers/trunk/gcc/testsuite/gfortran.dg/inline_matmul_13.f90:34:2: 
Warning: Code for reallocating the allocatable array at (1) will be 
added [-Wrealloc-lhs]
/home/toon/compilers/trunk/gcc/testsuite/gfortran.dg/inline_matmul_13.f90:41:2: 
Warning: Code for reallocating the allocatable array at (1) will be 
added [-Wrealloc-lhs]


PASS: gfortran.dg/inline_matmul_13.f90   -O0   (test for warnings, line 34)
PASS: gfortran.dg/inline_matmul_13.f90   -O0   (test for warnings, line 41)
PASS: gfortran.dg/inline_matmul_13.f90   -O0  (test for excess errors)
...
PASS: gfortran.dg/inline_matmul_13.f90   -O0  execution test
PASS: gfortran.dg/inline_matmul_13.f90   -O0   scan-tree-dump-times 
original "_gfortran_matmul" 0


and ditto for higher optimization levels.

The bounds tests added also completed correctly.

Thanks !

--
Toon Moene - e-mail: t...@moene.org - phone: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
At home: http://moene.org/~toon/; weather: http://moene.org/~hirlam/
Progress of GNU Fortran: http://gcc.gnu.org/wiki/GFortran#news


Re: [patch, fortran] Inline MATMUL(A,TRANSPOSE(B)), PR 66094

2016-01-18 Thread Toon Moene

On 01/17/2016 01:44 PM, Thomas Koenig wrote:


So... comments?  Toon, would this help you?  Could yo maybe give this
a spin?


Thanks, the nightly test at my home computer will build with your patch.


2016-01-17  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.


It will also perform the following tests (minus the 
"inline_matmul_13.f90" one, which wasn't included in the attachements :-)



2016-01-17  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.


Unfortunately, running the whole of our weather forecasting system with 
gcc-6 will be *a lot of work*, because I have to build all kinds of 
support libraries (for which I now depend on Debian Testing) by hand.


But I hope just testing your examples will at least give you an idea (on 
-march=haswell).


Thanks, and kind regards,

--
Toon Moene - e-mail: t...@moene.org - phone: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
At home: http://moene.org/~toon/; weather: http://moene.org/~hirlam/
Progress of GNU Fortran: http://gcc.gnu.org/wiki/GFortran#news


Re: [patch, fortran] Inline MATMUL(A,TRANSPOSE(B)), PR 66094

2016-01-18 Thread Toon Moene

On 01/18/2016 11:14 PM, Thomas Koenig wrote:


Hi Toon,


It will also perform the following tests (minus the
"inline_matmul_13.f90" one, which wasn't included in the attachements :-)


Well, here it is.


Included, thanks,

--
Toon Moene - e-mail: t...@moene.org - phone: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
At home: http://moene.org/~toon/; weather: http://moene.org/~hirlam/
Progress of GNU Fortran: http://gcc.gnu.org/wiki/GFortran#news


Re: [patch, fortran] Inline MATMUL(A,TRANSPOSE(B)), PR 66094

2016-01-18 Thread Thomas Koenig

Hi Toon,


It will also perform the following tests (minus the
"inline_matmul_13.f90" one, which wasn't included in the attachements :-)


Well, here it is.

Regards

Thomas

! { dg-do run }
! { dg-options "-ffrontend-optimize -fdump-tree-original -Wrealloc-lhs" }
! PR 66094: Check functionality for MATMUL(A, TRANSPSE(B))
module x
contains
  subroutine mm1(a,b,c)
real, dimension(:,:), intent(in) :: a, b
real, dimension(:,:), intent(out) :: c
c = -42.
c = matmul(a, transpose(b))
  end subroutine mm1
end module x

program main
  use x
  implicit none
  integer, parameter :: n = 3, m=4, cnt=2
  real, dimension(n,cnt) :: a
  real, dimension(m,cnt) :: b
  real, dimension(n,m) :: c, cres
  real, dimension(:,:), allocatable :: calloc

  data a / 2., -3., 5., -7., 11., -13./
  data b /17., -23., 29., -31., 37., -39., 41., -47./
  data cres / -225., 356., -396., 227., -360., 392., &
   -229., 364., -388., 267., -424., 456./ 

  c = matmul(a,transpose(b))
  if (sum(c-cres)>1e-4) call abort
  call mm1 (a, b, c)
  if (sum(c-cres)>1e-4) call abort

  ! Unallocated
  calloc = matmul(a,transpose(b)) ! { dg-warning "Code for reallocating the allocatable array" }
  if (any(shape(c) /= shape(calloc))) call abort
  if (sum(calloc-cres)>1e-4) call abort
  deallocate(calloc)

  ! Allocated to wrong shape
  allocate (calloc(10,10))
  calloc = matmul(a,transpose(b)) ! { dg-warning "Code for reallocating the allocatable array" }
  if (any(shape(c) /= shape(calloc))) call abort
  if (sum(calloc-cres)>1e-4) call abort
  deallocate(calloc)

end program main
! { dg-final { scan-tree-dump-times "_gfortran_matmul" 0 "original" } }