2009/11/25 Rohit Garg <
rpg.314@xxxxxxxxx>:
> On Wed, Nov 25, 2009 at 7:12 PM, Benoit Jacob <
jacob.benoit.1@xxxxxxxxx> wrote:
>> 2009/11/25 Rohit Garg <
rpg..314@xxxxxxxxx>:
>>> Array Of Structures - AoS
>>> ===================
>>> struct float2{
>>> float x,y};
>>>
>>> float2 arr[N];
>>>
>>> Structure Of Arrays - SoA
>>> ===================
>>> struct float2
>>> {
>>> float x[N],y[N];}
>>>
>>> SOA form has *big* advantages for simd ops over aos.
>>
>> Yes indeed; so: AoS is what we had so far in Eigen; SoA is what we'll
>> get thanks to the new Array class, when using e.g. Matrix<Array,3,1>.
>
> Just so that I understand it., if I define Array type at compile time,
> will eigen change data layouts into soa form and then vectorize this
> thing? Changing the data layouts is the key thing here. That's what
> leads to soa's simd efficiency? I may have not understood what has
> been presented so far, but I don't think changing the data layouts has
> been proposed so far.
AFAICS, Eigen is not going to do anything clever here.
>>
>> Benoit
>>
>>>>
>>>> This is about creating an Array class that can be used as a scalar
>>>> type, and on which the arithmetic ops are vectorized. So when you have
>>>> Matrix<Array,3,1> u,v,w;
>>>> and you do:
>>>> u = v+w;
>>>> this expands (thanks to Eigen xpr templates and unrollers) to:
>>>> u[0] = v[0]+w[0];
>>>> u[1] = v[1]+w[1];
>>>> u[2] = v[2]+w[2];
>>>> Each of these 3 lines is now an operation on Array objects and expands
>>>> to a vectorized loop doing the addition.
>>>>
>>>> Benoit
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Rohit Garg
>>>
>>>
http://rpg-314.blogspot.com/
>>>
>>> Senior Undergraduate
>>> Department of Physics
>>> Indian Institute of Technology
>>> Bombay
>>>
>>>
>>>
>>
>>
>>
>
>
>
> --
> Rohit Garg
>
>
http://rpg-314.blogspot.com/
>
> Senior Undergraduate
> Department of Physics
> Indian Institute of Technology
> Bombay
>
>
>