Registered Member
|
I'm getting an "unaligned array assert" on win32/mingw/gcc.exe (TDM-1 mingw32) 4.4.0 (from http://www.tdragon.net/recentgcc/ ), even though my class / use of eigen is very simple. MSVC works fine. Eigen version is 2.0.2
Stacktrace (Quaternion not created 16byte aligned!):
Which confirmed that it was being created unaligned:
We then added #warnings to Eigen/src/Core/util/Macros.h:
to see what path was taken (GNUC):
To make 100% sure, we then replace the EIGEN_ALIGN_128 with the attribute() thing:
which still just got us
We confirmed this also happens with Vector4f (excerpt from RotateView()):
My Macros.h edit:
Last edited by ggael on Sun Jun 21, 2009 12:49 pm, edited 1 time in total.
|
Registered Member
|
I can at least help regarding this:
I forgot to mention but you also had to #define EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT Actually the very simplest thing to do is to make this #if fail, by turning it into a "#if 0" !
For the rest, I confirm that I am very very puzzled by this situation and any help from a third person would be most welcome !!! As explained by the reportedr, we have traced the problem to a __attribute__ NOT being honored, but then we can't reproduce this in a simple test case.
Last edited by bjacob on Sun Jun 21, 2009 12:10 am, edited 1 time in total.
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Moderator
|
The problem is that on windows function calls are 4-bytes aligned. GCC assumes a 16-byte alignment and therefore, by default, it does not generate any extra code to get a 16 byte aligned stack when needed. One can enforce that on a per function basis with:
So I guess we could add a macro:
and users who want to support MINGW will have to add EIGEN_REALIGN_STACK in front of the declaration of all functions using aligned Eigen objects as local variables. edit: another solution is to use the option:
which tells GCC to expect a 8-byte aligned stack, and so it automatically realigns the stack when needed.
Last edited by ggael on Sun Jun 21, 2009 12:24 pm, edited 1 time in total.
|
Registered Member
|
Thanks a lot to Gael!! Maybe this is a bit better:
the idea is that this aligns to 8 bytes (8=2^3) so this should give better performance with double's.
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered users: Bing [Bot], Google [Bot], Sogou [Bot]