Comments (8)
Dear @mjschuster, thanks a lot! This might actually be an issue and I can look into this at a later point. If you have a suggestion on how to implement this fix, feel free to create a PR.
from grid_map.
Dear @pfankhauser, thanks!
It'd be great if you could have a look at this. I myself probably won't have the time for a pull request on this issue anytime soon. My suggestion would be to go through the code and see if its possible to
- use Eigen aligned allocators for all structs / classes having fixed-size vectorizable Eigen datatypes as members (see https://eigen.tuxfamily.org/dox-devel/group__TopicStructHavingEigenMembers.html) (that should be easy)
- make sure not to pass Eigen objects by value (see https://eigen.tuxfamily.org/dox-devel/group__TopicPassingByValue.html)
- use Eigen aligned allocators for all stl containers with fixed-size alignable Eigen datatypes or classes containing them (see https://eigen.tuxfamily.org/dox-devel/group__TopicStlContainers.html) (this might be the most difficult / annoying part)
As a workaround so far, I just deactivated vectorization by defining EIGEN_DONT_VECTORIZE
and EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT
as suggested in https://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html to keep ABI compatibility.
I however suspect that typical operations performed on grid maps could greatly benefit from vectorization - it would be interesting to have a speed comparison.
(As far as I understand it, this is only about explicit vectorization in the Eigen library. So a good compiler with appropriate optimization settings might still be able to add some vectorization through SSE etc. instructions on its own -- though probably less optimal?)
from grid_map.
Hi all,
as we had some alignment related crashes with grid_map, so I added a small fix concerning the alignment issues with Eigen. Although I did not have time to thoroughly look through all the code, I added a missing EIGEN_MAKE_ALIGNED_OPERATOR_NEW in the GridMap class, which has fixed-size Eigen members.
I created a pull request with this fix. But I have to add, that as I did not check the entire code, there could be lurking other alignment issues.
Best regards
from grid_map.
Thanks, @thomasemter! I merged your PR and extended it with other places where this code had fixed-size Eigen members. Let me know if we need to work more on this issue or you have any other problems.
from grid_map.
from grid_map.
Thanks @thomasemter @pfankhauser !
While these fixes should address some of the alignment issues, I think there still are some more (and more complicated) ones left, in particular with respect to my second and third bullet point in the comment above.
For example in https://github.com/ethz-asl/grid_map/blob/master/grid_map_core/include/grid_map_core/Polygon.hpp#L206 you create a std::vector
of Position
, which is a typedef to Eigen::Vector2d
(see https://github.com/ethz-asl/grid_map/blob/master/grid_map_core/include/grid_map_core/TypeDefs.hpp#L18).
According to https://eigen.tuxfamily.org/dox-devel/group__TopicStlContainers.html you should use the Eigen allocators then: "In practice you must use the Eigen::aligned_allocator
(not another aligned allocator), and #include <Eigen/StdVector>
.", e.g. something like:
std::vector<Position, Eigen::aligned_allocator<Position> > vertices_;
In addition, according to https://eigen.tuxfamily.org/dox-devel/group__TopicPassingByValue.html these Eigen types should not be passed by value, as is done for example in https://github.com/ethz-asl/grid_map/blob/master/grid_map_core/include/grid_map_core/Polygon.hpp#L157 and many other places.
Thus, while it might work for now without crashes, there are several places left that can cause trouble in the future...
from grid_map.
Hi all,
Thanks @mjschuster for pointing out other Eigen aligment issues.
I fixed all std::vector Eigen aligment issues I could find. I hope I have found all and I also did not find any other std container type in the code that would need fixing.
from grid_map.
Hi all,
I did test the alignment fixes with the current master and rebased the fixes accordingly.
from grid_map.
Related Issues (20)
- Compilation bug in foxy-devel where variable outputColor is not initialzied in pkg grid_map_filters HOT 1
- Wrong parameter name in grid_map_pcl
- Build issue possibly related to Eigen add-on macros HOT 3
- How to convert grid map from Elevation Mapping to CostMap2D? HOT 3
- Invoking "make -j16 -l16" failed when building the grid map HOT 1
- loadFromBag crashes in ROS2 when bag contains multiple topics HOT 3
- Efficient way to update an existing grid map object
- Superflous CMake Calls to old ament
- MedianFillFilter.cpp -> function cleanedMask() 's morphological operational question
- unable to build grid_map on ros2 humble
- How do I access and test the costmap2Dconvertor ?
- Visualize multiple grid maps in rviz
- Publish a Float32MultiArray in a GridMap message HOT 1
- Request to add maintainers for ROS 2 or transfer of ownership of ROS 2 to ethz-asl HOT 2
- grid_map_filters package fails during build HOT 1
- rolling: CI can't clone and all jobs fail HOT 4
- Deprecation of OgreVector3.h - Fix by ROS 2 Jazzy HOT 2
- grid_map_pcl and grid_map_sdf warnings with COMP0144 HOT 2
- Github CI on rolling/iron missing tests which causes build farm failures HOT 1
- There is a problem in grid_map_pcl config HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grid_map.