Inline DOT_PRODUCT revisited - to libgfortran/m4 gurus
Paul Thomas
paulthomas2@wanadoo.fr
Sun Feb 26 15:19:00 GMT 2006
Steven,
How are you? It's good to hear from you.
> See the original message from November 2005 here:
> http://gcc.gnu.org/ml/gcc-patches/2005-11/msg00686.html
>
> On Thursday 10 November 2005 09:13, Paul Thomas wrote:
>
>> an inline version of DOT_PRODUCT, which is never slower that the
>> original library version and is very much faster for small vectors.
>
>
> Amazingly your patch still applied almost cleanly, and it seems to do
> what it is supposed to do. The test case you had for dot_product was
> useless because it got optimized to an empty loop (which for whatever
> reason was not removed itself). The new test case is attached below.
> As is the updated patch, which is just a re-diff.
The empty loop was forced and the timing subtracted from the time to do
the loop with dot_product in it. I agree that the difference is small
but it was all part of a cunning plan.....
.... the correct outcome of which is attached and some results
below(obtained on the system that the regtesting is being carried out
on). It may be seen that gfortran-4.1(with library dot_product) begins
to win out for larger arrays but that gfortran-4.2(with inline) is a
clear winner for small arrays; ie. the inline has a smaller overhead but
seems to be slightly less well optimised for each product and sum. I
will submit with figures obtained on a quiet system.
I agree that the patch should be applied - I was a bit surprised that
folk lost interest at the time and that my call for a bit of help in
expunging all memory of dot_product from the library went unheeded. I
have done all the necessary on the library, seem to have regenerated
correctly and am in the midst of regtesting. I am not entirely sure
that I'll have time to write the changelog entries this evening but will
commit a definitive patch tomorrow morning.
Paul
[prt@localhost dot_product]# /svn-4.2/bin/gfortran -O3
-fdump-tree-original dottest.f90;./a.out
DOT_PRODUCT test
array length time(ns)
4 32.80
8 16.40
16 115.60
32 219.00
64 427.80
128 818.00
256 1715.70
512 2783.90
1024 6160.70
[prt@localhost dot_product]# ifort -O3 -fdump-tree-original
dottest.f90;./a.out
ifort: Command line warning: ignoring unknown option '-fdump-tree-original'
DOT_PRODUCT test
array length time(ns)
4 21.90
8 31.40
16 95.80
32 188.70
64 342.40
128 713.00
256 1285.90
512 2768.60
1024 5358.10
[prt@localhost dot_product]# export
LD_LIBRARY_PATH=/svn-4.1/lib:/opt/intel/fc/9.0/lib
[prt@localhost dot_product]# /svn-4.1/bin/gfortran -O3
-fdump-tree-original dottest.f90;./a.out
DOT_PRODUCT test
array length time(ns)
4 71.00
8 77.40
16 153.20
32 189.50
64 388.10
128 704.40
256 1414.40
512 2904.90
1024 5477.70
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dottest.f90
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20060226/191d7499/attachment.f90>
More information about the Gcc-patches
mailing list