Repository navigation
Pin Eigen's ABI on the Eigen target - #297
Merged
Merged
Conversation
- Define EIGEN_DONT_VECTORIZE (and the CUDA alignment pins) on Eigen3::Eigen via ipc_toolkit_pin_eigen_abi(), so every dependency that links Eigen inherits them - Drop the per-dependency defines for finite-diff and MeshFEMSparse - Add ipc::eigen_abi_matches_library() and a test for it - Add an LTO -Wodr workflow that fails on ODR violations Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #297 +/- ##
=======================================
Coverage 96.86% 96.86%
=======================================
Files 227 229 +2
Lines 23035 23047 +12
Branches 1619 1620 +1
=======================================
+ Hits 22312 22325 +13
+ Misses 723 722 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- Drop the weekly scheduled run - Run on pushes to main so PRs can restore its cache Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Pin a parent project's Eigen target before the recipe's early return - Skip definitions the target already has, since the recipe is included repeatedly Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zfergus
marked this pull request as ready for review
November 9, 2026 01:47
This was referenced Nov 9, 2026
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.
Description
Moves the Eigen ABI settings (
EIGEN_DONT_VECTORIZEand the CUDA alignment pins) fromipc_toolkitand individual dependencies onto theEigen3::Eigentarget. It touches the CMake setup,ipc/utils, the tests and CI.cmake/ipc_toolkit/ipc_toolkit_eigen_abi.cmakeaddsipc_toolkit_pin_eigen_abi(<eigen_target> [DONT_VECTORIZE] [PIN_ALIGNMENT]). It appends the definitions to the Eigen target'sINTERFACE_COMPILE_DEFINITIONS, so every target that links Eigen inherits them.finite_diff.cmakeandmeshfem_sparse.cmakeare removed, since those targets now inherit the settings.ipc/utils/eigen_abi.hppadds a runtime check that the caller and the library agree on Eigen's ABI..github/workflows/odr-check.ymllinks the tests with LTO and-Wodr, and fails on any ODR violation.Why. Eigen picks its alignment per translation unit from the compile flags. That alignment decides the layout of fixed-size types and which allocator Eigen uses. Before this PR only
ipc_toolkitand a hand-patched list of dependencies carriedEIGEN_DONT_VECTORIZE.EIGEN_MAX_ALIGN_BYTESsizeof(struct { double; Vector2d; })sizeof(VectorMax<double, 18>)EIGEN_DONT_VECTORIZE(IPC Toolkit)malloc/freemalloc/free-march=x86-64-v3, no define*** stack smashing detected ***. A mismatched allocator fails withfree(): invalid pointer.-O0the linker keeps one consistent copy and nothing fails, so passing tests don't rule it out.dynamics,polysolve_linearwas built without the define. LTO-Wodrfound itsVector2d(16-byte aligned) conflicting with the IPC Toolkit's (8-byte aligned) inPointEdgeDistance<double, 2>::point_edge_closest_point_direction.main:tight-inclusion,scalable-ccdandtinyadwere built without the define. They don't currently share a mismatched type, but they now inherit the pin.API changes
ipc::EigenAbi,ipc::eigen_abi(),ipc::library_eigen_abi()andipc::eigen_abi_matches_library().eigen_abi()andeigen_abi_matches_library()arestaticon purpose. Asinlinefunctions the linker would merge them, and the library would report the caller's values.ipc::toolkitnow get the definitions throughEigen3::Eigen. That also applies to the parent project's other targets that link the same Eigen target.Type of change
How Has This Been Tested?
[eigen_abi]test passes.EIGEN_DONT_VECTORIZEand linked againsteigen_abi.cpp.oreports a mismatch. With matching flags it reports a match.-march=x86-64-v3). 456/456 on macOS arm64 (Apple clang 21, Debug) before the CMake helper refactor.EIGEN_DONT_VECTORIZE(finite-diff, MeshFEM,tight-inclusion,scalable-ccd,tinyad). I checked this per target from the build commands.-Wodrbuild reports 0 violations on this branch. Its check step reports the violation above on adynamicsbuild without the polysolve fix.ODR Checkworkflow has not run on GitHub yet; this PR is its first run.Test Configuration:
Checklist