Re: [eigen] vectorization and ABI

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


ah ok, sounds good. let's go for it

gael.

On Thu, Jul 3, 2008 at 11:05 AM, Benoît Jacob <jacob@xxxxxxxxxxxxxxx> wrote:
> Hi,
>
> sorry, I didn't explain my idea well enough. I think that it is quick to
> implement, does not lengthen compilation, does not require macros, and adds
> only 1 line of code all in all.
>
> *** what we currently do ****
>
> in util/Constants.h :
>
> #ifdef EIGEN_VECTORIZE
> const unsigned int PacketAccessBit = 0x8;
> #else
> const unsigned int PacketAccessBit = 0x0;
> #endif
>
> in other files:
>
> Flags = PacketAccessBit | SomeMoreBits;
>
> ...
>
> if(Flags & PacketAccessBit)
>
> ...
>
>
> *** what I propose instead ***
>
> in util/Constants.h :
>
> const unsigned int PacketAccessBit = 0x8;
>
> #ifdef EIGEN_VECTORIZE
> const unsigned int ActualPacketAccess = PacketAccessBit ;
> #else
> const unsigned int PacketAccessBit = 0x0;
> #endif
>
> in other files:
>
> // just replace PacketAccessBit by ActualPacketAccess and you're done
>
> Flags = ActualPacketAccess | SomeMoreBits;
>
> ...
>
> if(Flags & ActualPacketAccess)
>
> ...
>
>
>
> ***
>
> That's it. Do you like it? As you can see it's just search and replace plus
> one line to add in util/Constants.h.
>
> Benoit
>
> On Thursday 03 July 2008 10:22:11 Gael Guennebaud wrote:
>> Hi,
>>
>> I'm not sure to understand what you wanna do with ActualPacketAccess,
>> but I see at least two other workarounds:
>>
>> - using preprocessor #if/#endif directives in Assign.h (and everywhere
>> we enable vectorization)
>>
>> - using a macro or a meta structure to get the actual value of
>> Flags&PacketAccessBit...for instance:
>> instead for writing : Derived::Flags&PacketAccessBit you would write:
>>   EI_HAS_PACKET_ACCESS(Derived)
>>
>> and currently  I'm in favor of such a macro: easy to use, no
>> compilation time penalty.
>>
>> cheers,
>> gael.
>>
>> On Thu, Jul 3, 2008 at 8:57 AM, Benoît Jacob <jacob@xxxxxxxxxxxxxxx> wrote:
>> > Hi,
>> >
>> > I think again that we need to make sure that enabling/disabling
>> > vectorization does not affect the ABI. The use case is for apps who want
>> > to make a runtime switch for vectorization. They would compile the same
>> > file a.cpp with and without -msse2. If a.cpp contains functions that take
>> > (refs to) Eigen matrices as argument, this requires the type of Eigen
>> > matrices to be independent of whether -msse2 is used. This is currently
>> > not the case since PacketAccessBit is set to 0 unless vectorization is
>> > enabled. So I think we must change that. I understand that setting
>> > PacketAccessBit to 0 was a nice convenience to quickly ensure that
>> > vectorized paths are never used without vectorization support, but we can
>> > do without... so I'm for setting PacketAccessBit regardless of the
>> > vectorization switch; and we could have another constant
>> > ActualPacketAccess that is the same thing that is currently called
>> > PacketAccessBit. What do you think? I know we discussed that before but I
>> > don't remember clearly the outcome.
>> >
>> > Cheers,
>> >
>> > Benoit
>
>
>


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