Core: Restore configuration macros lost in the typedef-to-using rewrite

4529102e6 ("Replace typedef with using in Eigen/src") expanded three configuration macros to their default values instead of preserving the indirection. The macros are still guarded in Macros.h/MKL_support.h, still documented, and still consumed elsewhere, so the configuration points they provide are now silently inert — or, in one case, a build break.

Was Became
typedef EIGEN_DEFAULT_DENSE_INDEX_TYPE Index; using Index = std::ptrdiff_t;
typedef EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex; using DenseIndex = std::ptrdiff_t;
typedef EIGEN_BLAS_INT BlasIndex; using BlasIndex = int;
typedef Map<PlainObject, EIGEN_DEFAULT_ALIGN_BYTES> ObjectType; using ObjectType = Map<PlainObject, 16>;

BlasIndex — hard build break for non-MKL ILP64

EIGEN_BLAS_INT is std::int64_t under EIGEN_64BIT_BLAS (MKL_support.h:129-133), and the prototypes in src/misc/blas.h use it. With BlasIndex frozen to int, EIGEN_USE_BLAS + EIGEN_64BIT_BLAS no longer compiles:

GeneralMatrixMatrix_BLAS.h:103:34: error: cannot convert 'Eigen::BlasIndex*' {aka 'int*'}
                                   to 'const int64_t*' {aka 'const long int*'}

This affects OpenBLAS INTERFACE64=1 and reference LAPACK BUILD_INDEX64_EXT_API. BlasTypes.h:39-40 still documents BlasIndex as following EIGEN_BLAS_INT, and MKL_support.h:126-127 calls EIGEN_64BIT_BLAS an ABI-affecting macro. The MKL branch guards its width with static_asserts; the non-MKL branch had none, so nothing caught this. This MR adds the mirror check.

Eigen::Index — documented configuration point is inert

EIGEN_DEFAULT_DENSE_INDEX_TYPE is documented in Meta.h, EigenBase.h and PreprocessorDirectives.dox, and UsingNVCC.dox tells users they are required to define it to int. Defining it now does nothing.

Nested-eval alignment

local_nested_eval_wrapper's Map claimed 16-byte alignment regardless of EIGEN_DEFAULT_ALIGN_BYTES: less than available on AVX (32) and AVX-512 (64), and more than guaranteed when the macro is 0, where the buffer may be caller-supplied.

Testing

New test/index_type.cpp, compiled with -DEIGEN_DEFAULT_DENSE_INDEX_TYPE=int, fails at the parent commit on all three of its static assertions. ILP64 and LP64 configurations both compile again. Smoke suite passes; stable_norm_fastmath_2 fails both with and without this change (pre-existing).

🤖 Generated with Claude Code

Merge request reports

Loading
Loading