This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [patch, fortran] Create temporary variables for matmul
- From: Jerry DeLisle <jvdelisle at charter dot net>
- To: fortran at gcc dot gnu dot org
- Date: Mon, 8 May 2017 10:40:36 -0700
- Subject: Re: [patch, fortran] Create temporary variables for matmul
- Authentication-results: sourceware.org; auth=none
- References: <82215091-bd8f-b450-9c45-765774bf3bef@netcologne.de>
On 05/07/2017 03:18 AM, Thomas Koenig wrote:
> Hello world,
>
> the attached patch goes one step further in matmul inlinding.
>
> It converts statements like
>
> r = dot_product(matmul(a2,v1),v2)
>
> into
>
> tmp = matmul(a2,v1)
> r = dot_product(tmp,v2)
>
> to enable inlining of matmul (but only if inlining
> is active, of course).
>
> In order to detect multiple uses of matmul, this is run
> several times. I did this because, with the current
> implementation, create_var can fail if -fno-realloc-lhs
> is specified. This is also not optimal, but that's a bug
> for another day, and I don't see any drawbacks in
> code generation for this (the extra basic blocks will
> be removed).
>
> The actual overhead in the case of non-constant bounds should
> be small to non-existent, this only replaces one type of
> temporary with another.
>
> I had to adjust some test cases which counted things to use
> the library version.
>
> Regression-tested. OK for trunk?
>
OK. Could you post some before and after performance results. Intuitively this
makes sense to do, but empirically does it pay off.
Cheers,
Jerry