|Re: [eigen] Issues regarding Quaternion-alignment and const Maps|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Issues regarding Quaternion-alignment and const Maps
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Fri, 23 Jul 2010 07:57:35 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=cOI3xH8f0RaFcmqsfOpFYnUQS+Jj4+dEABoL+GYEYGM=; b=tvU1u+XPJGEIzfBp+fASfBoRjfrxu0cGqeGGbtdlMvkp8jRqUv6IB6Bzmgxs9gY7v8 xsEbYT8a65OsypOU2Kq/vT/Oh1O1MI6odunNByQxMrZu8xJir2BDTuCHBL4Lk+8RVK/m 6EwgmpN02FlersqtLg745XsQIioBUfgftH9fQ=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=JYXmQdM45WDl5asLHzNuRHXWXXNFz4Fq6TRQ8KUno6fkbMnH0546OujflX9PaV1ozQ VtdW8aOZFbrZ3XGFjYV2CDxXZ0SyDcd9RLBcd1BllnwTpkZ/By3rdNi+58xss50AHqcZ NPGRH6f3pJLYJlXBhynU6F+KXPJgSn4a7+FuI=
On Fri, Jul 23, 2010 at 1:57 AM, Christoph Hertzberg
> Christoph Hertzberg wrote:
>> Gael Guennebaud wrote:
>>> On Wed, Jul 7, 2010 at 9:56 AM, Christoph Hertzberg
>>> <chtz@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>>>> first of all great work, everyone!
>>>> I have two issues with Eigen2, which I'm not sure Eigen3 has solved/will
>>>> solve (I did look at the new source, but might have overlooked
>>>> First, I guess there is no (easy) possibility to have an not-aligned
>>>> quaternion (without disabling alignment globally).
>>>> For ordanary matrices there is a Eigen::DontAlign option, which I
>>>> found for Quaternions. And currently I don't see a very lot of gain in
>>>> vectorization of Quaternions, especially (quaternion * vector3) is not
>>>> vectorized, and (quaternion * quaternion) only for float (at least in
>>> With Eigen3 you can map unaligned data as a Quaternion, but that's
>>> less convenient. So you would like a DontAlign option, e.g.:
>>> Then we should also add such an option to Translation and Transform.
>>> Why not.
>> I implemented it for Quaternions. Once I dug through all the code it
>> wasn't even that hard ...
>> I'm not entirely sure if
>> typedef Quaternion<_Scalar, PacketAccess> PlainObject;
>> in struct ei_traits<Quaternion<_Scalar, _PacketAccess> >
>> actually needs to have the same PacketAccess (as far as I looked, it was
>> not used anywhere ...)
>> Patch is attached.
first of all thank you for the patch.
> Hm, everything I tried was running, but I didn't actually look at the
> generated assembler. Using this patch it never generates SSE optimized
> multiplication ...
Yes, if such a small object is not aligned then we don't vectorize at
all because the required unaligned loads would kill the performance.
> Seems like I misunderstood PacketAccess vs Options.
> If I see it correct now, I have to name the template parameter Options,
> and make the enum PacketAccess within the traits be Unaligned or Aligned
> depending on DontAlign being set in Options of Quaternion.
> Before I make the next patch, could someone confirm this?
Yes you are right, the idea is to have a more general Options template
parameter just like for Matrix, pass it to the Matrix<> type defining
the Coefficients type, and then appropriately set PacketAccess to
Unaligned or Aligned.
> And another question: Do I have to make sure, that no Options besides
> DontAlign can be set?
would be nice. For instance you could add a protected
check_template_param() containing a static assertion in Quaternion
that would be called by each constructor.
> Dipl.-Inf. Christoph Hertzberg
> Cartesium 0.051
> Universität Bremen
> Enrique-Schmidt-Straße 5
> 28359 Bremen
> Tel: (+49) 421-218-64252