Skip to content
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

Replace CCTAG_EIGEN_NO_ALIGN with CCTAG_EIGEN_MEMORY_ALIGNMENT #194

Merged
merged 1 commit into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Enable -faligned-new when CCTAG_EIGEN_NO_ALIGN is not set on GCC >= 7.1 [PR](https://github.com/alicevision/CCTag/pull/193)
- Enable -faligned-new when CCTAG_EIGEN_MEMORY_ALIGNMENT is set on GCC >= 7.1 [PR](https://github.com/alicevision/CCTag/pull/193)

### Changed

- Replaced CCTAG_EIGEN_MEMORY_ALIGNMENT with CCTAG_EIGEN_MEMORY_ALIGNMENT which has the opposite meaning.

### Fixed
- fix gcc11 ordered pointer comparison [PR](https://github.com/alicevision/CCTag/pull/191)

Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ option(CCTAG_WITH_CUDA "Compile the library with CUDA support" ON)
option(CCTAG_BUILD_APPS "Build the sample applications" ON)
option(CCTAG_CUDA_CC_CURRENT_ONLY "Set to on to build only for the current machine's CC" OFF)
option(CCTAG_NVCC_WARNINGS "Switch on several additional warnings for CUDA nvcc." OFF)
option(CCTAG_EIGEN_NO_ALIGN "Disable Eigen alignment" ON)
option(CCTAG_EIGEN_MEMORY_ALIGNMENT "Enable Eigen alignment" OFF)

option(CCTAG_USE_POSITION_INDEPENDENT_CODE "Generate position independent code." ON)
option(CCTAG_ENABLE_SIMD_AVX2 "Enable AVX2 optimizations" OFF)
Expand Down Expand Up @@ -232,7 +232,7 @@ if(MSVC AND CCTAG_WITH_CUDA)
endif()
find_package(Eigen3 ${CCTAG_EIGEN_REQUIRED_VERSION} REQUIRED)
message(STATUS "Found Eigen: version ${Eigen3_VERSION}")
if(CCTAG_EIGEN_NO_ALIGN)
if(NOT CCTAG_EIGEN_MEMORY_ALIGNMENT)
set(AV_EIGEN_DEFINITIONS -DEIGEN_MAX_ALIGN_BYTES=0 -DEIGEN_MAX_STATIC_ALIGN_BYTES=0)
endif()

Expand Down Expand Up @@ -272,7 +272,7 @@ message(STATUS "Cuda support: " ${CCTAG_WITH_CUDA})
if(CCTAG_WITH_CUDA)
message(STATUS "Compiling for CUDA CCs: ${ARCH_FLAGS}")
endif()
message(STATUS "Disable Eigen alignment: " ${CCTAG_EIGEN_NO_ALIGN})
message(STATUS "Enable Eigen alignment: " ${CCTAG_EIGEN_MEMORY_ALIGNMENT})
message(STATUS "Enable AVX2 optimizations: " ${CCTAG_ENABLE_SIMD_AVX2})
message(STATUS "[debug] Serialize all the output: " ${CCTAG_SERIALIZE})
message(STATUS "[debug] Enable visual debug: " ${CCTAG_VISUAL_DEBUG})
Expand Down
6 changes: 3 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -253,16 +253,16 @@ endif(CCTAG_NO_COUT)
if(CCTAG_VISUAL_DEBUG)
target_compile_definitions(CCTag PRIVATE "-DCCTAG_VISUAL_DEBUG")
endif(CCTAG_VISUAL_DEBUG)
if(CCTAG_EIGEN_NO_ALIGN)
target_compile_definitions(CCTag PUBLIC ${AV_EIGEN_DEFINITIONS})
else()
if(CCTAG_EIGEN_MEMORY_ALIGNMENT)
# If user enabled Eigen alignment assumptions, then allocations should be with appropriate
# alignment. Fortunately this is fixed in C++17. While we can't upgrade to C++17 just yet, some
# compilers support overaligned allocation feature with a separate flag.
# See https://eigen.tuxfamily.org/dox/group__TopicUnalignedArrayAssert.html
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 7.1)
target_compile_options(CCTag PRIVATE "-faligned-new")
endif()
else()
target_compile_definitions(CCTag PUBLIC ${AV_EIGEN_DEFINITIONS})
endif()
set_target_properties(CCTag PROPERTIES VERSION ${PROJECT_VERSION})
set_target_properties(CCTag PROPERTIES DEBUG_POSTFIX "d")
Expand Down