|Re: [eigen] eigen short support: discussion thread|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] eigen short support: discussion thread
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Sat, 29 Aug 2009 13:12:04 -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=LWmizq5H3JcmMBdLG9kmZgeB7FZv3ue1FTQtfY6KEO8=; b=OIty/mG0HS2FdWCFRSmGgZWOzxstT+cLaKjx4Ty0I7EvcSgmthaUBSeNrMEsGDdlDv j3fzOPL9pOQy3rc0YwlY8shmtR/3els42sBZT/IyEEY29EaoWWrKfvpFHN8txV27yQta Ju5M1anUVdNsM7IglKBUSRvXviKGK3PYsIqN4=
- 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=J+uvoAr5ciGp83CIfd+tB08we1W/PtiIsa75DD3FcgxPu1wykZdFFERjVHvQgWaPe6 hJGafXHzUdcm49Ah+OYbfHFxPb1EkgupIHH29HhgfalrhY9aUjcuYcIM4iszrB7FORNK XSCpymXG9QElIw6Hb7HNjFFq/shYRJuAx80mQ=
2009/8/29 Rohit Garg <rpg.314@xxxxxxxxx>:
> 1) With regard to the __m128i being the common sse type for short
> vectors and int vectors, how about we let just the Packet8s be a
> typedef for a struct/class containing a __m128i. This way, they'll be
> different types.
> I want to ask if people here think this would work and if it will be
> cheaper to implement than other ways?
Actually, you raise a very good point. The solution that I proposed
looks like this except that I only proposed to make such a struct wrap
the packet type, not a packet object. I proposed an empty struct. Now
it's tru that when we want to implement e.g. ei_padd, it looks like
packet_type ei_padd(const packet_type&, const packet_type&)
and so if we want " z = ei_padd(x,y) " to work, we need packet_type to
actually contain an object, not just a typedef. My solution would have
forced one to pass a "Scalar" template parameter to all the ei_p...
methods taking packets -- since these packet _objects_ still didn't
remember about the scalar type.
So, +1 to your idea. Gael?
Your struct could be called ei_packet. It remains to be seen if
ei_packet_traits can be merged into it, or not.
> 2) What extra needs to be done for the basic short support to be
> merged into eigen mainline? There's a unit test (a simple one) in my
> Is it enough for the code to be commited? If not, what else is
> missing? (vectorization will obviously take a bit more time)
First, are you sure that this should go into Core? Why not make this a
separate module? It could go directly into Eigen/ skipping
unsupported/ as it's obvious that there are many users interested in
I'd rather have this as a separate module (not a very strong opinion
though) and I don't remember a decision on this being made, perhaps
this is something you already discussed with Gael?
Second, your unit test is not enough. It should at least cover basic
matrix arithmetic. So a good starting point for a unit test is to copy
and adapt large parts of basicstuff.cpp and/or linearstructure.cpp.
When you do vectorization, add also packetmath.cpp. Keep all that
templated, so it can easily be extended to cover more new small
integer types. Just wipe what is not wanted / not applicable for small
Do you want write access to eigen2 so you can eventually push
yourself? (nontrivial additions into Core, especially, still need to
be discussed on this list)