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
Eigen Alignment issue #1029
Eigen Alignment issue #1029
Conversation
The problem is probably the member |
That's what I thought. Do you know if this is enough or if we also need that stl-vector allocator for data_list? |
Honestly I would rather disable alignment for this specific case |
I'm worried later on somebody will add another Vector4f field and forget
this...
|
Fair enough, but I'm not versed enough in Eigen's arcane to know if we need to mess also with the |
We can be really conservative and do everything.
We should get an official answer from Eigen whether an stl container of
classes containing fixed-size vectorizable Eigen types needs this special
allocator... I'll post something
|
Actually from the first sentence of https://eigen.tuxfamily.org/dox/group__TopicStlContainers.html it seems pretty clear that we do need the special allocator for |
Yeah then I vote for really disabling alignment. I may use |
OK. But let's put a big warning at the top and bottom of the class that any
new members should not be aligned(-able).
…On Fri, Nov 23, 2018 at 4:02 PM Jérémie Dumas ***@***.***> wrote:
Yeah then I vote for really disabling alignment. I may use
std::vector<igl::ViewerData> in my code (of stuff unrelated to the
data_list of the viewer), and it would be extremely annoying to have to
pay attention to alignment.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1029 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACI0me59tb0Zm5wsbQjODK6D_50tJ8hWks5uyGJ5gaJpZM4YxFf2>
.
|
It's a warning that should apply on all classes, not only this one right? And in any case, I don't see that new members will be added very often to this class, but a warning wouldn't hurt. |
The eigen issue applies to all classes, but we're choosing a particular
solution (to not use alignment, rather than to do the macros/std
allocators). For other classes, it might make more sense to use those
options. So the warning here is specific to this class and the decision
we're making.
… |
Fair enough. I find the solution of disabling alignment less intrusive in this case, since it doesn't propagate to the user code, so I suggest we do that with a warning in the comments. |
Speaking of memory alingment issues: We at Prusa Research started to use libigl for bits and pieces on the Slic3r Prusa Edition project (slicer for FDM / SLA fabrication), thank you! We stumbled over memory alignment issues reported by the Visual Studio 2013, 32bit builds, for example: This is what Microsoft has to say to it: I interpret the error as violating the Eigen recommendation to never pass memory aligned structures by value to a function. I understand that the libigl authors do not guarantee 32bit compatibility, but here (likely by a lucky accident) the Visual Studio 2013 32bit compiler gives us a hint where we may have alignment issues. For our code to work, I had to fix the copy constructor of AABB to accept a refernce
and ClosestBaryPtPointTriangle lambda in igl::point_simplex_squared_distance() to accept references as well: |
Hmm, I don't think the current implementation of AABB trees in libigl is very efficient, since it seems to be using pointers. You might want to check out geogram which has a very efficient implementation of AABB trees. That being said if you have fixes you want to contribute to the current class, we'd be happy to evaluate PRs. I don't remember exactly what kind of issue there was with 32bit compilation on Windows, but it was probably alignment-related as well. If 64bits work for you (and passed valgrind/addressSanitizer checks), then you might as well do nothing. |
https://eigen.tuxfamily.org/dox/group__TopicStructHavingEigenMembers.html
A memory alignment assertion fired once for the .data_list in the viewer. I'm not sure if we also need the special stl vector allocator for the data list of if this is enough to fix it. It's hard to get this assertion to fire in a reproducible way.
Check all that apply (change to
[x]
)