[patch, fortran] Create temporary variables for matmul
Jerry DeLisle
jvdelisle@charter.net
Mon May 8 17:40:00 GMT 2017
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
More information about the Fortran
mailing list