Re: [eigen] Eigen::Complex -- does it have a reason to exist?

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


2010/1/7 Mark Borgerding <mark@xxxxxxxxxxxxxx>:
> Benoit Jacob wrote:
>>
>> There is still a problem: so far, we use the criterion "a packet
>> consists of a single scalar", formulated
>> ei_packet_traits<Scalar>::Size==1, to determine if a scalar type
>> doesn't have vectorization. This test breaks on complex<double> as its
>> sizeof is 16, so we need a more future-proof test.
>>
>
> I think the benefits of explicitly optimizing std::complex<double> with SIMD
> intrinsics/asm would be fairly small for exactly the reason you specify:
> there is exactly one complex<double> in a 128 bit simd register.  This
> should be child's play for a compiler.  The only problem I can think of is
> that the compiler might not assume 16 byte alignment of complex<double>.  We
> may be able to work around that with __attribute__((__vector_size__(16)))

OK, so indeed, I didn't try too hard with attributes. But scalar
operations aren't very important, what is most important is the
vectorization of Eigen expressions and there, complex<double> is
wonderful because since it has sizeof==16, all Eigen matrices of
complex<double> are aligned, even all fixed-size ones, and inside of
the array, every location is aligned. This means that Eigen will be
able to vectorize 100% of loops (we might have to refine a bit parts
of the logic in Assign.h). This means that just providing PacketMath
specializations will take us very far.

>
>> Thanks a lot for this observation. I am sorry for having suggested you
>> to work on something we may end up not using after all, and I
>> appreciate a lot that you brought this issue up!
>>
>
> I don't think you really suggested it, at least not very strongly.

Well, I (or we, i don't remember) put that on the TODO, at least.

Cheers,
Benoit



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/