Re: [eigen] alignment question |
[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]
Hi again,This was it, I created temp objects to hold the result of functions and the alignment issue is gone.I still have a long road to replace all the Vector3 by Vector4...Do you do the same way? do you have as convention to always use temp variables to hold your function return?Best regards,SylvainOn Tue, Jan 27, 2015 at 5:26 PM, Sylvain Pointeau <sylvain.pointeau@xxxxxxxxx> wrote:On Tue, Jan 27, 2015 at 2:25 PM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:This code is fine by itself..It does rely on a nontrivial assumption: that stack frames are 16-byte aligned. Indeed, the alignment for Vector4f is 16 bytes, and you are placing Vector4f's on the stack in two places: as the return value of ToPoint, and for the local variable v in the third snippet. However, that assumption --- that stack frames are 16-byte aligned --- should be true. What compiler and OS are we talking about?I use clang from xcode on mac os x yosemite.Can you share a compilable testcase?I will prepare it tonight. I am not sure it is because of this, but I don't see other options.Benoit2015-01-27 5:04 GMT-05:00 Sylvain Pointeau <sylvain.pointeau@xxxxxxxxx>:Dear all,I currently migrate my application to use Vector4f instead of Vector3f to benefit the vectorisation.However I face an alignment error at runtime. (I use the latest clang from xcode on mac os x)Vector4f toPoint(const Vector4f &v) {return Vector4f( v.x(), v.y(), v.z(), 1 );}void process( const Vector4f &v ) {// do process my vector}is there an issue with the alignment doing the following?Vector4f v (1,3,4,0);process( toPoint(v) );Please let me know, I have the suspicion that the error comes from there, I wonder if I am right.Best regards,Sylvain
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |