This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [fortran,patch] BLAS-enabled matmul


On Tue, Apr 04, 2006 at 10:00:35AM -0700, Steve Kargl wrote:
> As an alternative, would be possible to translate the matmul() call
> into a *gemm call in trans-intrinsics.c(gfc_conv_intrinsic_function)?
> At the moment, gfc_conv_intrinsic_function has
> 
>     case GFC_ISYM_MATMUL:
>     ....
>       gfc_conv_intrinsic_funcall (se, expr);
>       break;
> 
> where *_funcall sets up the appropriate call to one of the 
> libgfortran routines.  Could gfortran do
> 
>     case GFC_ISYM_MATMUL:
>       conv_matmul (se, expr);
>       break;
> 
> where
> 
> void conv_matmul (se, expr)
> {
> 
>    if (Check for possible use of *gemm )
>      {
>         Set up calls to *gemm.
>      }
>    else
>      gfc_conv_intrinsic_funcall (se, expr);
>  
> }
> 
> This would then give 
> 
> gfortran -fblas file.f90 -lblas
> 
> where, for example, the symbol dgemm_ would appear in file.o, and
> so gfortran will automatically put the blas library in the right order.

This is about what I had in mind for PR 26025. Unfortunately Real Life
(TM) has me pretty swamped, so I haven't had time to produce a working
patch.

> BTW, two of the Polyhedron tests use matmul().  It will
> be interesting to see if your patch improves the results.

Yes.

The same approach could also be used for replacing dot_product with
*dot from BLAS. Although according to my measurements, with the new
inlined dot_product and cranking up the optimization level
appropriately we're within 30 % of GOTO BLAS. So there's much less of
a reward here.

-- 
Janne Blomqvist

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]