Skip to content

ENH: Update vendored Eigen3 to 5.0.1+master; verify USE_SYSTEM 3.3/3.4/5.x#6176

Open
hjmjohnson wants to merge 8 commits intoInsightSoftwareConsortium:mainfrom
hjmjohnson:eigen-5.0.1-update
Open

ENH: Update vendored Eigen3 to 5.0.1+master; verify USE_SYSTEM 3.3/3.4/5.x#6176
hjmjohnson wants to merge 8 commits intoInsightSoftwareConsortium:mainfrom
hjmjohnson:eigen-5.0.1-update

Conversation

@hjmjohnson
Copy link
Copy Markdown
Member

@hjmjohnson hjmjohnson commented Apr 30, 2026

Vendors Eigen master post-5.0.1 (gitlab libeigen/eigen tip fef1460e, late April 2026; EIGEN_VERSION_STRING="5.0.1-dev+master") via the canonical UpdateFromUpstream.sh flow, and demonstrates ITK_USE_SYSTEM_EIGEN=ON against system Eigen 3.3.9, 3.4.0, and 5.0.1. The 3.3 minimum-version gate is preserved.

Acceptance matrix (build + Eigen-related tests)
Row Eigen source Build Tests
A Vendored gitlab-tip via ISC fork 5a7cc61d6 (Eigen 5.0.1+master) 5246 / 5246 11 / 11
B0 conda-forge eigen=3.3.9 (proves min-version gate) 5974 / 5974 11 / 11
B conda-forge eigen=3.4.0 5974 / 5974 11 / 11
C conda-forge eigen=5.0.1 5974 / 5974 11 / 11

The 11 tests: itkSymmetricEigenAnalysisTest, itkEigenAnalysis2DImageFilterTest, itkSymmetricEigenAnalysisImageFilterTest{OrderByValue,OrderByMagnitude,DoNotOrder}, vnl_algo_test_{complex,generalized,real,symmetric}_eigensystem, ITKEigenKWStyleTest, ITKEigenInDoxygenGroup.

What changed in the vendored tree
  • UpdateFromUpstream.sh tag bumped to the new ISC fork tag (suffix -fef1460ek). Whitelist gained AccelerateSupport, KLUSupport, ThreadPool, Version (the Eigen/Version header is required because Eigen 5 moved EIGEN_{MAJOR,MINOR,PATCH}_VERSION out of src/Core/util/Macros.h).
  • The vendored src/itkeigen/CMakeLists.txt version parser was rewritten on the fork (be4bdb732) to read Eigen/Version (semver MAJOR.MINOR.PATCH) for Eigen 5+, falling back to Macros.h (WORLD.MAJOR.MINOR) for legacy 3.4.x. Eigen3ConfigVersion.cmake now reports PACKAGE_VERSION "5.0.1".
  • One merge conflict during the subtree import, in Eigen/src/Core/products/SelfadjointMatrixVector.h: Eigen 5 fully rewrote that kernel into 4-col / 2-col / 1-col phases, already initializing accumulators with pzero(Packet{}). Resolved by taking upstream entirely — the older in-tree COMP patch 91f6232 ("pzero(Packet{}) for SelfadjointMatrixVector accumulators") is subsumed and obsolete.
ISC fork (InsightSoftwareConsortium/eigen) state
  • New tag at 5a7cc61d6.
  • for/itk-master advanced to 5a7cc61d6.
  • Three ITK-overlay commits on top of gitlab fef1460e: CMake override (be4bdb732), .gitattributes lapacke relax (fb7121abd), and README.kitware.md (5a7cc61d6).
Outer-module CMake

Modules/ThirdParty/Eigen3/CMakeLists.txt keeps _Eigen3_min_version=3.3 (no upper bound). find_package(Eigen3 REQUIRED CONFIG) plus the explicit VERSION_LESS check accepts both 3.x and 5.x system installs without modification.

@github-actions github-actions Bot added the type:Enhancement Improvement of existing methods or implementation label Apr 30, 2026
@hjmjohnson
Copy link
Copy Markdown
Member Author

@greptile review

@greptile-apps

This comment was marked as resolved.

Comment thread Modules/ThirdParty/Eigen3/src/itkeigen/cmake/Eigen3Config.cmake.in
Comment thread Modules/ThirdParty/Eigen3/src/itkeigen/CMakeLists.txt Outdated
Comment thread Modules/ThirdParty/Eigen3/src/itkeigen/CMakeLists.txt Outdated
dzenanz

This comment was marked as resolved.

@dzenanz dzenanz requested a review from phcerdan April 30, 2026 19:14
@hjmjohnson hjmjohnson changed the title ENH: Update vendored Eigen3 to 5.0.1; verify USE_SYSTEM_EIGEN across 3.3, 3.4, 5.x ENH: Update vendored Eigen3 to 5.0.1+master; verify USE_SYSTEM 3.3/3.4/5.x Apr 30, 2026
@hjmjohnson

This comment was marked as resolved.

@hjmjohnson hjmjohnson force-pushed the eigen-5.0.1-update branch 2 times, most recently from 56a7240 to eda5a20 Compare May 1, 2026 00:11
@hjmjohnson
Copy link
Copy Markdown
Member Author

/azp run ITK.Windows

@hjmjohnson

This comment was marked as resolved.

@hjmjohnson
Copy link
Copy Markdown
Member Author

/azp run ITK.Windows

@hjmjohnson hjmjohnson marked this pull request as ready for review May 1, 2026 02:10
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 1, 2026

Too many files changed for review. (319 files found, 100 file limit)

@hjmjohnson hjmjohnson requested a review from dzenanz May 1, 2026 02:33
@hjmjohnson
Copy link
Copy Markdown
Member Author

/azp run ITK.Windows

Copy link
Copy Markdown
Member

@blowekamp blowekamp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good.

Thank you for updating the library. After I refactored from an off fetch_content in the root of the project to an itk standard third party library I ran out of steam to upgrade.

There were some rather odd usages of Eigen in external modules. The intention moving forward is just have it behave just like a normal ITK interface library without special cmake code.

Comment thread Modules/ThirdParty/Eigen3/src/itkeigen/CMakeLists.txt Outdated
@hjmjohnson hjmjohnson force-pushed the eigen-5.0.1-update branch from e7a197c to be77e85 Compare May 1, 2026 14:22
@hjmjohnson
Copy link
Copy Markdown
Member Author

/azp run ITK.Windows

hjmjohnson and others added 7 commits May 1, 2026 13:18
Phase 2 prep for Eigen 5.x update.  Points UpdateFromUpstream.sh at the
refreshed InsightSoftwareConsortium/eigen tag derived from gitlab
libeigen/eigen master tip 879885e (2026-05-01), which adds the
"Modernize internal utilities for C++14" patch (libeigen/eigen!2490)
on top of the 5.0.1 release tip plus three small follow-on fixes
(RealQZ pushDownZero counting, small-determinant LU fastpath, and
IncompleteLUT static row matching).

Adds new top-level support headers introduced since the previous import:
AccelerateSupport, KLUSupport, ThreadPool, and Version.  The Version
header is required because Eigen 5 moved EIGEN_{MAJOR,MINOR,PATCH}_VERSION
out of src/Core/util/Macros.h.
Code extracted from:

    https://github.com/InsightSoftwareConsortium/eigen

at commit 505023a2a0fc8eeff5f92d07683ab5ff0c03ba0f (for/itk-20260501-879885e1).
* upstream-Eigen3:
  Eigen3 2026-05-01 (505023a2)

# Conflicts:
#	Modules/ThirdParty/Eigen3/src/itkeigen/Eigen/src/Core/products/SelfadjointMatrixVector.h
The warning is purely from the Eigen master post-5.0.1 update
(EIGEN_VERSION_STRING="5.0.1-dev+master") changing instantiation/
inlining. Eigen's own CMakeLists.txt already adds
-Wno-maybe-uninitialized for its own builds (line 444, with a comment
that GCC 12+ emits false positives), and DisableStupidWarnings.h
doesn't cover this one. The fix is to suppress at the ITK consumer
site, mirroring Eigen's stance.
- Restore @EIGEN3_TARGETS_FILE@ substitution in Eigen3Config.cmake.in.
- Remove duplicate option(ITK_USE_EIGEN_MPL2_ONLY) declaration.
- Remove commented-out binary-dir generator expression.

USE_SYSTEM_EIGEN for 3.3+ unaffected (all under itkeigen, only
configured when USE_SYSTEM_EIGEN=OFF).
Bump line 2 from 3.10.2 to 3.16.3 to match ITK proper, and replace the
if(FALSE) ... endif() wrapper around the upstream Eigen logic with
#[[ ... #]] CMake multiline-comment markers so IDEs render the
disabled region as dimmed dead code.
Tridiagonalization.h emits C4750 ('function with _alloca() inlined into
a loop') under MSVC whenever an ITK consumer instantiates the symmetric
eigen-decomposition path.  The warning is benign (Eigen's intentional
small-allocation alloca path) but cannot be addressed inside ITK and
fails CDash because the dashboard treats any warning as fatal.

The previous attempt to set CMAKE_CXX_FLAGS in the vendored Eigen
CMakeLists was a no-op (Eigen is header-only, so no .cxx file picks up
the flag) and the alternative -- attaching /wd4750 to the eigen_internal
INTERFACE library -- would propagate to ITKCommon (which DEPENDS on
ITKEigen3) and from there to most of the toolkit, suppressing C4750
for non-Eigen ITK code too.  Both rejected per @blowekamp.

Instead, extend the existing 'Modules/ThirdParty/Eigen3/.*warning:.*'
CTestCustom regex with a sibling that matches MSVC's
'warning C####:' form.  Compiler still emits the warning so reviewers
see it in build logs, but the dashboard ignores it for warning-count
purposes -- exactly the same scope the GCC/Clang side has had since
this exception was added.
@hjmjohnson hjmjohnson force-pushed the eigen-5.0.1-update branch from be77e85 to 76d09b8 Compare May 1, 2026 18:21
@hjmjohnson
Copy link
Copy Markdown
Member Author

/azp run ITK.Linux.Python

@hjmjohnson hjmjohnson added this to the ITK 6.0 Release Candidate 1 milestone May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:Enhancement Improvement of existing methods or implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants