Re: [eigen] vectorization and ABI |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] vectorization and ABI
- From: "Gael Guennebaud" <gael.guennebaud@xxxxxxxxx>
- Date: Thu, 3 Jul 2008 11:08:54 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=MPUg+2KerKX7VF0MEX+IGsLN3Aw3CLYKViwQ8qMwdAk=; b=OY9RrB481VTrI4CQtDSSN2e9hjaTVGr8NRoyUJ4SNGhxad/2mVbEGgAuqnXkwLL/WV 5mgZlx+Q1ZqEi06eCiVePLFnPUrxhrzaCHw4CXqsH1Ae8XwQUD+h4HX/7Kq824tvJNBQ IwES2HuGLkLtP+6xw0pO3Fc4D9w07fmACjK/s=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=peEODR0gxlQmM+HDqtyrARR0G/Yudc5ZV8bMBfl7Gt8yEVyPlZtlMEFMqpV0m174e7 z7aIoJS41HNZfR81FyhonKgTBAyYEZ8Gu7IKL6Rr4XgFjdNF+iuxWeKZx4zosPg2y+je 6ivA3v/nIUF99C0gEZbwlMc2HTto+yMtAohT0=
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
>
>
>