[eigen] std::complex vectorization braindump |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: [eigen] std::complex vectorization braindump
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Wed, 13 Jan 2010 21:15:23 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=7zoj+c4u7BrtXqvmMB/CUGHLozY7Ti+S2LV+vq7N15s=; b=gAztZMql4RksU/pIebtublz2E0RfMqI2hzxj5Oct/u7Eb2bpRkZC9AU7D/zLFq1S2K cM7dSecLq0Ie0HDpDSg1xcBpJm+7c/r0xClequmFwh8QTodGvDcNbwXnfEF10T0//lpX H6KuplrTVmxLuyXCiIrOUiM7bfrqFDzg/L5X4=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=ql+NgRD6hqQ9VLazf7VIA0BSuyLzqDBygKmodarNXtr6bORyR4la3//vV8rbqid79V dFFwWmmg3vh0jaiibNdOwDUTHUQ5kVzC1HWl2X2f6MqwgzEG3j2RWJaG8gm1xVhqlmIL swCWxXcx2uGcJHlfgKLe5sBHvQ8EIPYzJrEeg=
Hi,
What i'm doing at the moment (HouseholderSequence stuff) is so boring
that I couldn't help thinking about std::complex vectorization. Here's
a braindump:
- so i don't forget it
- so someone else can get a chance to do it first (otherwise, i'll do
it after the SVD).
*** General problems ***
vectorizing std::complex breaks at least 2 assumptions that Eigen is
currently making:
1) that vectorized paths can assume real numbers
---> For example in Dot.h the vectorized paths don't bother conjugating
2) that PacketSize==1 means no vectorization
---> This breaks for complex<double>
Also need to check if the low-level matrix-matrix product code makes
particular assumptions (?)
*** Steps ***
1) Everywhere in Eigen when we have PacketSize==1 conditions, examine
if we really mean that or if that is a way of asking if the scalar
type has vectorization. Hint: in 95% of cases it is the latter. An
exception might be in ei_first_aligned, need to check.
2) In ei_packet_traits introduce a new member enum Vectorizable and
use it everywhere that in 1) this is what was meant.
3) Introduce new SIMD functions ei_pconj (conjugate a packet) and
ei_pmulconj (compute x*conj(y), useful in dot products etc.).
For real numbers, ei_pconj(x) returns x and ei_pmulconj is just like
ei_pmul. Implement them for complex<float> and complex<double>. At
first, do it only for SSE using instructions like SHUFPS, then we'll
see if stuff can factor out with AltiVec...
4) Everywhere that we need to conjugate stuff, update the vectorized
paths to use ei_pconj and ei_pmulconj appropriately (at least in
Dot.h).
5) The puzzle: What to do about ei_pabs() ? In the same vein it would
be nice to introduce a ei_pabs2()... but we need to solve the
question: what should they return, a half of a packet of reals???
Benoit