-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[custom] EIGEN_ALIGN16 bad idea #5805
Comments
by the way anybody knows how to compile a branch with #include <experimental/simd> from the C++ lib SIMD extension?? |
How so? Because it may "waste" memory? Correct me if I am wrong, but to my knowledge, the cache lines are also aligned to some 2^n bytes.
What do you mean? Why is requiring alignment "hard coding and anti-OOP"?
The alignment is useful so that the fast SIMD load and store operations can be used (see also https://gitlab.com/libeigen/eigen/-/blob/master/Eigen/src/Core/util/ConfigureVectorization.h#L27 ) |
I am studying this subject, it's a work in progress. gives That would be a matter of study
Requiring alignment in general might go, but does not seem so in the way it is done here. How it's done here not only seems anti OOP but also against structured programming. PCL relies on alignment used together with union{} making it based on float data[4] access, looks very much hard coded to me. Why accessing the structure fields with a overlayed union float[4] array?? For Eigen? OK I understand but isn't there a smarter and structured general purpouse way to access Eigen SIMD without having to hard code like this? This also makes it much harder to extend to optional use of double for xyz coords. And please do not tell me again we don't need doubles and that doubles slow down because I won't even listen!!!! ;)) |
I think it's a XY problem! What we are concerned about here is whether alignment has an impact on cache efficiency, so do not introduce other problems!!! If not then we can go to other topic about its impact |
the two problems are strictly correlated. extension to double is obstacled by hard coding with fixed (not configurable) alignment AND use of union{} with float[4] I really have no idea why you say XY instead of XYZ |
Do we have a different understanding of what OOP and structured programming means? I still don't see how requiring alignment goes against these paradigms.
This is done to enable the use of the fast SIMD instructions, which need aligned memory (load and store) and packs of four floats. I don't know why you call it hard coded, you can define a custom point type and use that with
SIMD needs packs of 4 floats to work efficiently. But if you see an alternative, feel free to suggest it.
I assume you are joking with the last part, but that is still an odd thing to say. |
the use of EIGEN_ALIGN16
seems to be a very bad idea. In particular for cache efficiency and multithreading.
I would either eliminate that and all similar ones or substitute them with something configurable at compile time
giving also the option to use, compile-time-configurable directives like
alignas(std::hardware_destructive_interference_size) (and here the topic of moving to C++17 goes on)
why are the definitions of the points so relying on alignment and they make use of union??
isn't this too hard coding and anti-OOP?
#define PCL_ADD_UNION_POINT4D
union EIGEN_ALIGN16 {
float data[4];
struct {
float x;
float y;
float z;
};
};
i see it is probably "required" by Eigen
The text was updated successfully, but these errors were encountered: