Re: [eigen] Eigen::Complex -- does it have a reason to exist? |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Eigen::Complex -- does it have a reason to exist?
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Thu, 7 Jan 2010 09:28:42 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=LlwH7u/towxEdthyC3Ssf5wAeXczb6pM3gVHvf0aQWQ=; b=KM3UC33t9ES1ZnbzTopLOvJldun9gxXweoP2szSTzk242WOw366a9aRgKfBkN05EQg H+KS8kLh1VrdEwLuB5oFMoChWSZAPmfxwDeIkk2IssBmtcIf5rvOCGNAdKJDkQm1p6F/ NIxyNurBibweSB+KxBh/RkQTvncR3nfQJ0fHg=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=x9vT/SutejIjd6Qb139pEXhVYptdK+siy5LLa89SRb/6Jb3sdG0VS5tvZawEssnevX YFbRJ1cXNMcjiEg5CWROkolpKc8B7TkpZnb+IrC9wVdamV2TS0J5GR1s2Jx1j1b6f9ZN HKvHWodrCH7S9H2YT/APo4CMaWiC4gSGFUTU4=
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