Workaround for misalignment of SubmapSlice and Eigen data structures in heterogeneous builds - #1910
Open
twdragon wants to merge 3 commits into
Open
Workaround for misalignment of SubmapSlice and Eigen data structures in heterogeneous builds#1910twdragon wants to merge 3 commits into
SubmapSlice and Eigen data structures in heterogeneous builds#1910twdragon wants to merge 3 commits into
Conversation
- Added a workaround for misaligned SubmapSlice structure between cartographer and cartographer_ros built using different compilers or compile contexts - Rearranged SubmapSlice field order after static analysis performed with clangd - Added commented non-portable workaround with \#pragma pack - Closes cartographer-project#1909 Signed-off-by: Andrey Vukolov <andrey.vukolov@elettra.eu>
SubmapSlice in heterogeneous buildsSubmapSlice in heterogeneous builds
Author
|
This issue persists also in other parts of the project, so I will continue the investigation |
- Adopted C++17 standard, removed CXX standard requirement - Removed Abseil's absl::unique_ptr in favour of std::unique_ptr producing errors when built on Ubuntu 22 with fresh Abseil built from source - Added DISABLE_AVX_ALIGNMENT CMake option to prevent Eigen (especially built from source) from misalignment of the data structures passed outside the library namespace on the machines with modern CPUs providing AVX vectorization out of the box - Tested on Intel Core-i7 6700, any performance decreaseing was not discovered Signed-off-by: Andrey Vukolov <andrey.vukolov@elettra.eu>
SubmapSlice in heterogeneous buildsSubmapSlice and Eigen data structures in heterogeneous builds
Author
|
Updated involving the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Due to different structure alignment rules in different compilers (or even the same compiler in different compiling contexts), the
SubmapSlicestructure defined in ./cartographer/io/submap_painter.h comes intocartographer_rosor another external project misaligned by 48 bytes because of differentsizeof()return values (224 vs 256 bytes). This behaviour is proven when testing Cartographer compiled using Clang 15 and GCC 11.3 on Mint Linux 22 with a customized build of ROS. The reason is deeply sitting problem with implementation-defined STL shipped with different kernels and build pipelines. This pull request adds a semi-portable workaround for this issue forcing alignment ofSubmapSlicestructure to 32 bytes as is required by GCC.#pragma packfree()oncairo_data#1909