Re: [eigen] Array of complex numbers |

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

*To*: eigen <eigen@xxxxxxxxxxxxxxxxxxx>*Subject*: Re: [eigen] Array of complex numbers*From*: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>*Date*: Thu, 10 Jan 2019 23:33:03 +0100*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=Kw+FGHsK5BhjPTRbPHG0BJ13pF5b7NlckZx20TrKZgQ=; b=qsjwbr6qsLPvf6bqdp5decE2QOFdmjaOK+JTDadtRAJ1/BNI5qOfHE5lzK3YnDzJ9G e/c+XTxgStUo2X7E4Cwi/Q8NwsPX6aIfSIIguasuzfFHViHGJNfHMepwrbKmOmruDlBg PgIO/IU+l/3twQZJ61c/1vLuXsoWoelBdaJtQb0uuHX0WlFYJZl9gF1JOGzjRlBXFTA4 qJhlFsyfPjy553NmGz12ohC0ISGaYdqkC8K3KFlZKYRTowSqDnx4HOn5h4ihIEs8OiMc qMIzzksNftUMr3j0xd7wHrg+nstgfQ343GzN01YxDyWlolkVfhJVD4UaCbwtP1Kobcre L30Q==

On Thu, Jan 10, 2019 at 11:09 PM Gael Guennebaud <gael.guennebaud@xxxxxxxxx> wrote:

For linear combination with complex coeffs I don't think it's possible to get close SoA for such small (i.e. in-cache) arrays.

hm... actually that's not that bad as clang is able to move two of the three permutations out of the loop, we only have to pay for a single extra permutation per product. With gcc, the overhead is quite significant.

gael

gaelOn Thu, Jan 10, 2019 at 11:00 PM Francois Fayard <fayard@xxxxxxxxxxxxx> wrote:Thanks,

You are right about the operations. Obviously, for the “linear combination”, I am interested in the case where rk are complex numbers.

I have tried to compile your code that implements the scalar product, but I don’t have any definition for pzero? Where is it?

François

> On 10 Jan 2019, at 22:25, Gael Guennebaud <gael.guennebaud@xxxxxxxxx> wrote:

>

> Hi,

>

> just to be sure I fully understood the operations you're considering, let's assume you have:

>

> VectorXcf A1(300), A2(300), ...;

> complex<float> c1, c2, ...;

> float r1, r2, ...;

>

> then "Scalar product" means:

>

> A1.dot(A2)

>

> and "Linear combination" means:

>

> r1*A1 + r2*A2 + ...

>

> If this is right, then linear combination with real coefficients should already be 100% optimal and the only problematic operation could be dot products because of the complex*complex product overhead. I think those can be optimized while keeping an AoS layout by accumulating within multiple packets that we combine only at the end of the reduction instead of doing and expensive combination for every product. This is similar to what we do in GEMM.

>

> I gave it a shot, and I get similar speed than with a SoA layout. See attached file. This is a proof of concept : AVX only, no conjugation, n%16==0, etc.

>

> I think this can be integrated within Eigen by generalizing a bit the current reduction code to allow for custom accumulation packets.

>

> cheers,

> gael

> <bench_cplx_dotprod.cpp>

**Follow-Ups**:**Re: [eigen] Array of complex numbers***From:*Francois Fayard

**References**:**[eigen] Array of complex numbers***From:*Francois Fayard

**Re: [eigen] Array of complex numbers***From:*Gael Guennebaud

**Re: [eigen] Array of complex numbers***From:*Francois Fayard

**Re: [eigen] Array of complex numbers***From:*Gael Guennebaud

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] Array of complex numbers** - Next by Date:
**Re: [eigen] Array of complex numbers** - Previous by thread:
**Re: [eigen] Array of complex numbers** - Next by thread:
**Re: [eigen] Array of complex numbers**

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