Re: [eigen] UnalignedArrayAssert and EIGEN_DONT_VECTORIZE

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


2009/9/8 Staffan Gimåker <staffan@xxxxxxxxxx>:
> Hi,
>
> I'm trying to use Eigen with the explicit vectorization features
> disabled, but I'm having some problems with
> "UnalignedArrayAssert" (curiously, it's only reproducible when running
> under Valgrinds memcheck tool).
>
> If I understand correctly, the 128-bit alignment requirement is only
> needed when using the explicit vectorization, and thus one would expect
> to find the assertion in question disabled when vectorization is -- but
> it is not.
>
> Are there any other reasons why this assertion is enabled even with
> vectorization disabled?

Even if vectorization is disabled, we still keep the 128 bit
alignment. This is so that vectorized and non-vectorized code are
ABI-compatible, i.e. can be linked with each other and successfully
run.

In the development branch, there is EIGEN_DONT_ALIGN which is what
you're really looking for (and breaks ABI compatibility). Of course,
EIGEN_DONT_ALIGN also disables vectorization.

In 2.0.5 you can either manually disable alignment by editing
EIGEN_ARCH_WANTS_ALIGNMENT, or you can use your idea:

> Is it safe to define
> EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT when EIGEN_DONT_VECTORIZE is
> defined?

Yes, it is safe. Since no SIMD instruction is then used, nothing bad
can happen in case of a non-128bit-aligned pointer.

We don't do it automatically because that leads to the curious
situation where code that runs fine without vectorization suddenly
crashes when enabling vectorization. But go ahead if that's what you
want :)

Benoit



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