Welcome to the KDE Community Forums, the official forum board for KDE.
You are currently viewing the forums as an unregistered user. Registration allows you to post and discuss topics, receive private messages, vote on ideas, subscribe to topics and many such great features. Registration is a simple process and completely free. So register now and be a part of the community!
You are currently viewing the forums as an unregistered user. Registration allows you to post and discuss topics, receive private messages, vote on ideas, subscribe to topics and many such great features. Registration is a simple process and completely free. So register now and be a part of the community!
[Help]The following code failed
8 posts • Page 1 of 1
[Help]The following code failed
I'm using Eigen 2.0.6 with sse2 . The compiler is icc 10.1 for windows.
There is an exception throwed:
Access violation reading location 0xcdcdcdd1
when D* dd = new D;
So what's wrong with the code below?
There is an exception throwed:
Access violation reading location 0xcdcdcdd1
when D* dd = new D;
So what's wrong with the code below?
- Code: Select all
typedef Eigen::Transform<float,3> transform_t;
using namespace Eigen;
struct C{
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
char a;
transform_t b;
};
struct D{
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
C x;
char c;
};
void test(){
C* cc = new C;
cc->b.setIdentity();
D* dd = new D;
dd->x.b.setIdentity();
cc->b = dd->x.b;
delete dd;
delete cc;
}
Last edited by lastsnow on Wed Oct 14, 2009 3:56 pm, edited 1 time in total.
Re: [Help]The following code failed
I can't reproduce your issue, i even checked that all objects are created at aligned locations. Please provide a readily compilable program and specify your compiler version. Please also paste a full back-trace.
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
Have a serious interest in Eigen? Then join the mailing list!
Re: [Help]The following code failed
your code looks ok, and since here I cannot reproduce your issue we'll need more information: Can you run your test under a debugger and post a complete backtrace ? and/or if you are running linux try to run it with valgrind. What happens if you disable SSE, or if you try with a different compiler ?
ggael, proud to be a member of KDE forums since 2008-Dec.
Re: [Help]The following code failed
Thanks for your reply.
I just tried gcc 4.4 under linux.It seems ok.
The code will have problem when using intel compiler(10.1.013 ) under windows.It's weired that I cannot always reproduce the problem(memory not aligned ?).
I will try it under different circumtance to find out what's going on.
I will capture more data if I encounter this problem again.
I just tried gcc 4.4 under linux.It seems ok.
The code will have problem when using intel compiler(10.1.013 ) under windows.It's weired that I cannot always reproduce the problem(memory not aligned ?).
I will try it under different circumtance to find out what's going on.
I will capture more data if I encounter this problem again.
Re: [Help]The following code failed
BTW, this is really inconvenient for struct D to use the macro EIGEN_MAKE_ALIGNED_OPERATOR_NEW, if other class or struct wrap a D member,the macro must write there.This intrusive way makes me uncomfortable.
What about do something like this in matrixstorage.h, I have tried it.
But the cost is obvious: extra 16 bytes storage.
What about do something like this in matrixstorage.h, I have tried it.
But the cost is obvious: extra 16 bytes storage.
- Code: Select all
template <typename T, int Size, int MatrixOptions,
bool Align = (MatrixOptions&AutoAlign) && (((Size*sizeof(T))&0xf)==0)
> struct ei_matrix_array
{
EIGEN_ALIGN_128 T data[Size]; //make extra room for it
char x[16];
template<typename U> inline U* align_up(U* p, size_t a) {return (U*)(((size_t)p + (a-1)) & -(int)a);}
ei_matrix_array()
{
x[15] = (char)align_up(data,0x10)- (char)data;
#ifndef EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT
ei_assert((reinterpret_cast<size_t>(array()) & 0xf) == 0
&& "this assertion is explained here: http://eigen.tuxfamily.org/dox/UnalignedArrayAssert.html **** READ THIS WEB PAGE !!! ****");
#endif
}
ei_matrix_array(ei_constructor_without_unaligned_array_assert) {
x[15] = (char)align_up(data,0x10)- (char)data;
}
T* array(){return (T*)((size_t)data+(size_t)x[15]);}
const T* array()const{return (T*)((size_t)data+(size_t)x[15]);}
};
Re: [Help]The following code failed
But the cost is obvious: extra 16 bytes storage.
And also a runtime computation. Two good reasons why we can't do that.
If you don't like that you can:
- disable vectorization/alignment (define EIGEN_DONT_ALIGN)
or
- wait for the next C++ standard which finally provides good alignment support.
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
Have a serious interest in Eigen? Then join the mailing list!
Re: [Help]The following code failed
Is the alignment enabled by default ?
vs2005 compile the following code without define EIGEN_DONT_ALIGN
std::vector<transform_t> v;
will generate this error:
error C2719: '_Val': formal parameter with __declspec(align('16')) won't be aligned
I think no alignment should be the default option.
vs2005 compile the following code without define EIGEN_DONT_ALIGN
std::vector<transform_t> v;
will generate this error:
error C2719: '_Val': formal parameter with __declspec(align('16')) won't be aligned
I think no alignment should be the default option.
Re: [Help]The following code failed
On VS 2005, we don't vectorize. So alignment is useless indeed. But, if we want to preserve ABI compatibility, we still need to align. If you are sure that VS 2005 doesn't have the same C++ ABI as VS 2008 anyway, then I'm OK to disable alignment on VS 2005.
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
Have a serious interest in Eigen? Then join the mailing list!
8 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 2 guests

Search
FAQ
Policy
KDE.org
KDE.news
Planet KDE
More 