Re: [eigen] State of eigen support for small integers(16 bit, signed/unsigned) |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] State of eigen support for small integers(16 bit, signed/unsigned)
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Thu, 20 Aug 2009 09:59:36 -0400
- 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; bh=7C/6EDd1u5Hr+RQZe1kkJudVRE8CwNJhCkbM0PKFebQ=; b=YoNEYgn1vJMnfYVjo4dlj+N8Ts9mAPo0aPx5lY2n/K0xZ9jZ7rdDkO6+/vjhZFN4Af bjjjdi3zD52P5+4ItBggVOkfbMqecvEjvjay+aBw0+QLGmb54cX2XKcMmCriRRQ6o4uw gSfbaFP800gpdchUq6li/bQr99TH5YdLfHKeY=
- 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; b=N2+PexYa83PmGRaISqz0R/Tq8I69BGps5tgWsdFKRvRNuoJxlVM5eNAz5UiZqN+pI9 Z9XmZIl34pA7E1swAlnJfzfmMX7aTyQzKwyELmnBuzEx6LGo7QopNTo2+rckrYp1er0I 9APNf4rywf/C18NvbuFVPXKDVXGBvWTi33F3w=
2009/8/20 Rohit Garg <rpg.314@xxxxxxxxx>:
>> First, read this,
>> http://eigen.tuxfamily.org/dox/CustomizingEigen.html#CustomScalarType
>> The two most important things are to edit the files NumTraits.h and
>> MathFunctions.h in Core/.
>
> So one adds all types to eigen by following that method on that page then.
yes!
>
>>
>> For vectorization, you'll have to edit the files in Core/arch/... at
>> least Core/arch/SSE/PacketMath.h. Not sure about how it works for
>> small ints (are there specific SSE instructions for e.g. adding two
>> packets of 8 int16's ? you know better than me)
>
>
>> For the bitwise ops, in the non-vector case i don't think you need to
>> do anything special since operators & |... work natively; you can
>> always check the Functors.h either in Core/ or in Array/ ; for
>> vectorization I'm very optimistic too -- we already have ei_pand(),
>> ei_por() etc in PacketMath.h and since for bitwise ops the integer
>> size is irrelevant, you should be able to use that.
>
> What about shifts?
I can't see that in PacketMath.h, so you'll have to add it. Here's the
relevant part of this file:
template<> EIGEN_STRONG_INLINE Packet4f ei_pand<Packet4f>(const
Packet4f& a, const Packet4f& b) { return _mm_and_ps(a,b); }
template<> EIGEN_STRONG_INLINE Packet2d ei_pand<Packet2d>(const
Packet2d& a, const Packet2d& b) { return _mm_and_pd(a,b); }
template<> EIGEN_STRONG_INLINE Packet4i ei_pand<Packet4i>(const
Packet4i& a, const Packet4i& b) { return _mm_and_si128(a,b); }
template<> EIGEN_STRONG_INLINE Packet4f ei_por<Packet4f>(const
Packet4f& a, const Packet4f& b) { return _mm_or_ps(a,b); }
template<> EIGEN_STRONG_INLINE Packet2d ei_por<Packet2d>(const
Packet2d& a, const Packet2d& b) { return _mm_or_pd(a,b); }
template<> EIGEN_STRONG_INLINE Packet4i ei_por<Packet4i>(const
Packet4i& a, const Packet4i& b) { return _mm_or_si128(a,b); }
template<> EIGEN_STRONG_INLINE Packet4f ei_pxor<Packet4f>(const
Packet4f& a, const Packet4f& b) { return _mm_xor_ps(a,b); }
template<> EIGEN_STRONG_INLINE Packet2d ei_pxor<Packet2d>(const
Packet2d& a, const Packet2d& b) { return _mm_xor_pd(a,b); }
template<> EIGEN_STRONG_INLINE Packet4i ei_pxor<Packet4i>(const
Packet4i& a, const Packet4i& b) { return _mm_xor_si128(a,b); }
template<> EIGEN_STRONG_INLINE Packet4f ei_pandnot<Packet4f>(const
Packet4f& a, const Packet4f& b) { return _mm_andnot_ps(a,b); }
template<> EIGEN_STRONG_INLINE Packet2d ei_pandnot<Packet2d>(const
Packet2d& a, const Packet2d& b) { return _mm_andnot_pd(a,b); }
template<> EIGEN_STRONG_INLINE Packet4i ei_pandnot<Packet4i>(const
Packet4i& a, const Packet4i& b) { return _mm_andnot_si128(a,b); }
Benoit