Performance issue with @fastmath and vectorization
deXtoRious via digitalmars-d-ldc
digitalmars-d-ldc at puremagic.com
Sat Nov 12 02:25:26 PST 2016
On Saturday, 12 November 2016 at 07:38:16 UTC, Nicholas Wilson
wrote:
> On Saturday, 12 November 2016 at 00:03:16 UTC, dextorious wrote:
>> As part of slowly learning the basics of programming in D, I
>> ported some of my fluid dynamics code from C++ to D and
>> quickly noticed a rather severe performance degradation by a
>> factor of 2-3x. I've narrowed it down to a simple
>> representative benchmark of virtually identical C++ and D code.
>>
>> [...]
>
> you can apply attributes to whole files with
> @fastmath:
>
> void IamFastMath(){}
>
> void SoAmI(){}
>
> Don't know about whole program.
>
> i got some improvements with -vectorize-loops and making the
> stencil array static and passing by ref. I couldn't get it to
> unroll the inner loop though.
Isn't -vectorize-loops already enabled by the other flags? Simply
adding it doesn't seem to make a difference to the inner loop
assembly for me. I'll try passing a static array by ref, which
should slightly improve the function call performance, but I'd be
surprised if it actually lets the compiler properly vectorize the
inner loop or fully unroll it.
More information about the digitalmars-d-ldc
mailing list