Skip to content

Fix Eigen ABI pin when a parent project shadows the Eigen recipe - #300

Merged
zfergus merged 1 commit into
mainfrom
fix/eigen-abi-pin-shadowed-recipe
Nov 9, 2026
Merged

zfergus merged 1 commit into
mainfrom
fix/eigen-abi-pin-shadowed-recipe

Conversation

@zfergus

@zfergus zfergus commented Nov 9, 2026

Copy link
Copy Markdown
Member

Description

The Eigen ABI pin from #297 now applies even when a parent project's own eigen.cmake recipe shadows the toolkit's. A guard in the library fails the build if the pin is ever lost.

  • CMakeLists.txt calls ipc_toolkit_pin_eigen_abi(Eigen3::Eigen ...) right after include(eigen), and cmake/recipes/eigen.cmake goes back to its pre-Pin Eigen's ABI on the Eigen target #297 form.
    • include(eigen) loads the first eigen.cmake on CMAKE_MODULE_PATH. Parents such as CloIPC and PolyFEM put their own recipe first, so code in the toolkit's recipe never runs.
    • ipc_toolkit_eigen_abi.cmake has a name no parent will reuse, so the pin now runs whichever recipe created Eigen3::Eigen.
  • src/ipc/utils/eigen_abi.cpp raises an #error when IPC_TOOLKIT_WITH_SIMD is set without EIGEN_DONT_VECTORIZE, or IPC_TOOLKIT_WITH_CUDA is set without EIGEN_MAX_ALIGN_BYTES=0 and EIGEN_MAX_STATIC_ALIGN_BYTES=0.
    • eigen_abi_matches_library() cannot catch a missing pin, because the library and its consumers then agree on the wrong ABI.

Impact

  • Before: in a parent with a shadowing recipe, no target got any of the three definitions. In CloIPC (SIMD + CUDA), the host compiles with -march=native and nvcc does not, so TestAirDampingEnergy aborted in free() with heap corruption.
  • After: every target that links Eigen carries all three definitions, whichever recipe created the target.
  • No API changes.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Configured CloIPC (feature/internal-damping, which shadows eigen.cmake) as the parent project, with SIMD and CUDA on. I checked CXX_DEFINES/CUDA_DEFINES in every flags.make that includes Eigen:
    • main (f388443): 0 of 8 Eigen-linking targets have the definitions.
    • This branch: 8 of 8 have all three.
  • Compiled the new eigen_abi.cpp with main's unpinned ipc_toolkit flags from that build. Both #errors fire.
  • CloIPC's tests against this branch: 303 of 305 cases pass and 2 are skipped, including [AirDampingEnergy], which aborted on main.
  • Toolkit test preset (Debug, CUDA on): 485 of 485 ctest tests pass (6 skipped by design).

Test Configuration:

  • OS and Version: AlmaLinux 9.8, NVIDIA RTX 5080
  • Compiler and Version: GCC 11.5 (toolkit), GCC 14 (CloIPC), nvcc 12.8

Checklist

  • I have followed the project style guide
  • My code follows the clang-format style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

- Call ipc_toolkit_pin_eigen_abi() from CMakeLists.txt after
  include(eigen); a parent's eigen.cmake earlier in CMAKE_MODULE_PATH
  replaces ours, so the pin in the recipe never ran
- Restore cmake/recipes/eigen.cmake to its pre-#297 form
- Fail the build in eigen_abi.cpp when the pin is missing

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zfergus
zfergus merged commit 814bc8c into main Nov 9, 2026
21 of 22 checks passed
@zfergus
zfergus deleted the fix/eigen-abi-pin-shadowed-recipe branch November 9, 2026 22:46
@codecov

codecov Bot commented Nov 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.86%. Comparing base (f388443) to head (d215dc8).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #300   +/-   ##
=======================================
  Coverage   96.86%   96.86%           
=======================================
  Files         229      229           
  Lines       23047    23047           
  Branches     1619     1619           
=======================================
  Hits        22324    22324           
  Misses        723      723           
Flag Coverage Δ
unittests 96.86% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant