This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/37131] inline matmul for small matrix sizes
- From: "mikael at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Jun 2010 09:31:38 -0000
- Subject: [Bug fortran/37131] inline matmul for small matrix sizes
- References: <bug-37131-10391@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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