Re: [eigen] Map: introduce "AlignedPointer" flag?

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



ok, I committed  that change, but I simply reused the Unaligned / Aligned constants, e.g:

EIGEN_ALIGN16 float f[4];
Map<Vector4f,Aligned> mv(v);

gael.

On Thu, Oct 22, 2009 at 5:50 PM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
2009/10/22 Gael Guennebaud <gael.guennebaud@xxxxxxxxx>:
>
>
> On Wed, Oct 21, 2009 at 4:10 PM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
> wrote:
>>
>> This is for Gael. Currently in Map, what's the precise meaning of
>> "ForceAligned" ? Is it:
>>
>>  " If you use packet access, then use aligned packet access " ?
>>
>> If yes, is it correct to say that at the moment we don't offer any way
>> to tell that the pointer passed to Map is aligned, and that therefore
>> we may enable packet access also e.g. for good fixed sizes? I remember
>> you saying something like "we need a FirstAligned flag", were you
>> talking about that? What do you think about calling that
>> AlignedPointer and renaming ForceAligned to ForceAlignedAccess ?
>> Finally, can you remind me what the use case for ForceAligned is, if
>> we have AlignedPointer?
>
> yes this issue was on my todo list as well.

oh, if it is, i'll gladly let you do it! You are more informed than me
on this class since you basically rewrote it.

> So basically we could add an
> AlignedPointer option to Map setting the AlignedBit flag. That's it I think.

I think you also need to carefully set PacketAccessBit to something
like "If AlignedBit AND (either dyn-size OR fixed size multiple of
16)".

>
> About ForceAligned, it is only used internally, and its purpose is to avoid
> unligned loads in such cases:
>
> a += b;
>
> where a is a Map or a Block object.
>
> Indeed, since a += b; is transformed to "a = a + b;" and that in assign we
> make sure that stores to "a" will be aligned, we know that loads from "a"
> will be aligned too but we need a way to enforce that. The solution is to
> reimplement operator += in MapBase (inherited by Block and Map) like this:
>
> *this = *this_cast_to_the_same_type_but_with_the_ForceAligned_option +
> other;
>
> I agree that's probably more useful for Block than for Map, but since they
> share the same code...

I see! thanks for the explanation.

Benoit


>
> I'm also ok to rename it to ForceAlignedAccess.
>
> gael
>
>
>>
>> If you tell me all that I can try to get that done ;)
>>
>> Benoit
>>
>







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