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

[ Thread Index | Date Index | More Archives ]

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. So basically we could add an AlignedPointer option to Map setting the AlignedBit flag. That's it I think.

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'm also ok to rename it to ForceAlignedAccess.



If you tell me all that I can try to get that done ;)


Mail converted by MHonArc 2.6.19+