Re: [eigen] AVX/LRB and SSE with SoA support

[ Thread Index | Date Index | More Archives ]

2010/9/3 Gael Guennebaud <gael.guennebaud@xxxxxxxxx>:
> On Fri, Sep 3, 2010 at 1:50 PM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
>>  1. Gael makes me understand something I was missing above.
> Let me try to be more specific. Consider the following high level construct:
> (A<B).select(C,D)
> (we could add others if needed).
> This returns a Select<ConditionType,ThenType,ElseType> here
> ThenType==C, ElseType==D, and ConditionType is a binary expression.
> At compile time, Select checks that ConditionType::Scalar==bool and
> ThenType::Scalar==ElseType::Scalar.
> Then, still at compile time, it asks ConditionType if it can returns
> pseudo boolean packets compatible with ThenType::Scalar. For instance
> A and B could be matrices of float while C and D contains doubles.
> These packets are obtained through packet<Alignment,PacketType>(i,j).
> Recall that in another thread we found that the packet functions had
> to be templated on the packet type to support engines supporting
> various packet size for the same scalar type.
> If everything is ok, then this Select expression is marked as
> Vectorizable. Problem solved.

OK! I hadn't understood that you agreed with the need to have
pseudo-bools-the-size-of-Scalar somewhere down the chain. And I didn't
have your clever idea of where to put that. So basically the
expression has officially Scalar==bool but can be queried to get
pseudo-bools-the-size-of-Scalar instead, using a separate coeff
accessor. Great, that works for me.

Thanks for the explanation.

> Then we could add special versions of this select mechanism to
> optimize cases where C or D is equal to zero. We could add a special
> Zero expression which as no specific sizes nor scalar type, but always
> return zero with overloads for common operators. Then we could
> specialize and fully optimize select(C,Zero) etc.
> Can you show me specific use cases that would not be covered by that ?
> gael

Mail converted by MHonArc 2.6.19+