Vector operations optimization.

Comrad comrad.karlovich at gmail.com
Fri Mar 23 08:08:51 PDT 2012


On Friday, 23 March 2012 at 10:48:55 UTC, Dmitry Olshansky wrote:
> On 23.03.2012 9:57, Comrad wrote:
>> On Thursday, 22 March 2012 at 10:43:35 UTC, Trass3r wrote:
>>>> What is the status at the moment? What compiler and with 
>>>> which
>>>> compiler flags I should use to achieve maximum performance?
>>>
>>> In general gdc or ldc. Not sure how good vectorization is 
>>> though, esp.
>>> auto-vectorization.
>>> On the other hand the so called vector operations like a[] = 
>>> b[] +
>>> c[]; are lowered to hand-written SSE assembly even in dmd.
>>
>> I had such a snippet to test:
>>
>> 1 import std.stdio;
>> 2 void main()
>> 3 {
>> 4 double[2] a=[1.,0.];
>> 5 double[2] a1=[1.,0.];
>> 6 double[2] a2=[1.,0.];
>> 7 double[2] a3=[0.,0.];
>
> Here is a culprit, the array ops [] are tuned for arbitrary 
> long(!) arrays, they are not plain 1 simd SEE op. They are 
> handcrafted loops(!) on SSE ops, cool and fast for arrays in 
> general, not fixed pairs/trios/etc. I believe it might change 
> in future, if compiler is able to deduce that size is fixed, 
> and use more optimal code for small sizes.
>

So currently there is no such an optimization exists for any d
compiler?



More information about the Digitalmars-d-learn mailing list