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

[Build] Eigen build error in inverse.cc #17927

Closed
meerfrau opened this issue Oct 12, 2023 · 5 comments
Closed

[Build] Eigen build error in inverse.cc #17927

meerfrau opened this issue Oct 12, 2023 · 5 comments
Labels
build build issues; typically submitted using template

Comments

@meerfrau
Copy link

meerfrau commented Oct 12, 2023

Describe the issue

In file included from /usr/include/eigen3/Eigen/Core:358,
                 from ./onnxruntime/onnxruntime/core/util/math_cpuonly.h:68,
                 from ./onnxruntime/onnxruntime/contrib_ops/cpu/inverse.cc:8:
/usr/include/eigen3/Eigen/src/Core/PartialReduxEvaluator.h: In instantiation of 'PacketType Eigen::internal::packetwise_redux_empty_value(const Func&) [with PacketType = eigen_packet_wrapper<__vector(2) long long int, 2>; Func = scalar_sum_op<Eigen::half, Eigen::half>]':
/usr/include/eigen3/Eigen/src/Core/PartialReduxEvaluator.h:112:54:   required from 'static PacketType Eigen::internal::packetwise_redux_impl<Func, Evaluator, 0>::run(const Evaluator&, const Func&, Eigen::Index) [with PacketType = Eigen::internal::eigen_packet_wrapper<__vector(2) long long int, 2>; Func = Eigen::internal::scalar_sum_op<Eigen::half, Eigen::half>; Evaluator = Eigen::internal::redux_evaluator<Eigen::Block<const Eigen::CwiseUnaryOp<Eigen::internal::scalar_abs_op<Eigen::half>, const Eigen::Matrix<Eigen::half, -1, -1, 1, -1, -1> >, -1, 8, true> >; Eigen::Index = long int]'
/usr/include/eigen3/Eigen/src/Core/PartialReduxEvaluator.h:219:102:   required from 'PacketType Eigen::internal::evaluator<Eigen::PartialReduxExpr<MatrixType, MemberOp, Direction> >::packet(Eigen::Index) const [with int LoadMode = 0; PacketType = Eigen::internal::eigen_packet_wrapper<__vector(2) long long int, 2>; ArgType = const Eigen::CwiseUnaryOp<Eigen::internal::scalar_abs_op<Eigen::half>, const Eigen::Matrix<Eigen::half, -1, -1, 1, -1, -1> >; MemberOp = Eigen::internal::member_sum<Eigen::half, Eigen::half>; int Direction = 0; Eigen::Index = long int]'
/usr/include/eigen3/Eigen/src/Core/Redux.h:251:78:   required from 'static Eigen::internal::redux_impl<Func, Evaluator, 3, 0>::Scalar Eigen::internal::redux_impl<Func, Evaluator, 3, 0>::run(const Evaluator&, const Func&, const XprType&) [with XprType = Eigen::PartialReduxExpr<const Eigen::CwiseUnaryOp<Eigen::internal::scalar_abs_op<Eigen::half>, const Eigen::Matrix<Eigen::half, -1, -1, 1, -1, -1> >, Eigen::internal::member_sum<Eigen::half, Eigen::half>, 0>; Func = Eigen::internal::scalar_max_op<Eigen::half, Eigen::half, 0>; Evaluator = Eigen::internal::redux_evaluator<Eigen::PartialReduxExpr<const Eigen::CwiseUnaryOp<Eigen::internal::scalar_abs_op<Eigen::half>, const Eigen::Matrix<Eigen::half, -1, -1, 1, -1, -1> >, Eigen::internal::member_sum<Eigen::half, Eigen::half>, 0> >; Scalar = Eigen::half]'
/usr/include/eigen3/Eigen/src/Core/Redux.h:418:56:   required from 'typename Eigen::internal::traits<T>::Scalar Eigen::DenseBase<Derived>::redux(const Func&) const [with BinaryOp = Eigen::internal::scalar_max_op<Eigen::half, Eigen::half, 0>; Derived = Eigen::PartialReduxExpr<const Eigen::CwiseUnaryOp<Eigen::internal::scalar_abs_op<Eigen::half>, const Eigen::Matrix<Eigen::half, -1, -1, 1, -1, -1> >, Eigen::internal::member_sum<Eigen::half, Eigen::half>, 0>; typename Eigen::internal::traits<T>::Scalar = Eigen::half]'
/usr/include/eigen3/Eigen/src/Core/Redux.h:448:25:   required from 'typename Eigen::internal::traits<T>::Scalar Eigen::DenseBase<Derived>::maxCoeff() const [with int NaNPropagation = 0; Derived = Eigen::PartialReduxExpr<const Eigen::CwiseUnaryOp<Eigen::internal::scalar_abs_op<Eigen::half>, const Eigen::Matrix<Eigen::half, -1, -1, 1, -1, -1> >, Eigen::internal::member_sum<Eigen::half, Eigen::half>, 0>; typename Eigen::internal::traits<T>::Scalar = Eigen::half]'
/usr/include/eigen3/Eigen/src/Core/DenseBase.h:466:37:   [ skipping 6 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/usr/include/eigen3/Eigen/src/LU/InverseImpl.h:322:60:   required from 'static void Eigen::internal::Assignment<DstXprType, Eigen::Inverse<Rhs>, Eigen::internal::assign_op<typename DstXprType::Scalar, typename SrcXprType::Scalar>, Eigen::internal::Dense2Dense>::run(DstXprType&, const SrcXprType&, const Eigen::internal::assign_op<typename DstXprType::Scalar, typename SrcXprType::Scalar>&) [with DstXprType = Eigen::Map<Eigen::Matrix<Eigen::half, -1, -1, 1, -1, -1>, 0, Eigen::Stride<0, 0> >; XprType = Eigen::Map<const Eigen::Matrix<Eigen::half, -1, -1, 1, -1, -1> >; SrcXprType = Eigen::Inverse<Eigen::Map<const Eigen::Matrix<Eigen::half, -1, -1, 1, -1, -1> > >; typename DstXprType::Scalar = Eigen::half; typename SrcXprType::Scalar = Eigen::half]'
/usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:890:49:   required from 'void Eigen::internal::call_assignment_no_alias(Dst&, const Src&, const Func&) [with Dst = Eigen::Map<Eigen::Matrix<Eigen::half, -1, -1, 1, -1, -1>, 0, Eigen::Stride<0, 0> >; Src = Eigen::Inverse<Eigen::Map<const Eigen::Matrix<Eigen::half, -1, -1, 1, -1, -1> > >; Func = assign_op<Eigen::half, Eigen::half>]'
/usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:858:27:   required from 'void Eigen::internal::call_assignment(Dst&, const Src&, const Func&, typename enable_if<(! evaluator_assume_aliasing<Src>::value), void*>::type) [with Dst = Eigen::Map<Eigen::Matrix<Eigen::half, -1, -1, 1, -1, -1>, 0, Eigen::Stride<0, 0> >; Src = Eigen::Inverse<Eigen::Map<const Eigen::Matrix<Eigen::half, -1, -1, 1, -1, -1> > >; Func = assign_op<Eigen::half, Eigen::half>; typename enable_if<(! evaluator_assume_aliasing<Src>::value), void*>::type = void*; typename evaluator_traits<SrcXprType>::Shape = Eigen::DenseShape]'
/usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:836:18:   required from 'void Eigen::internal::call_assignment(Dst&, const Src&) [with Dst = Eigen::Map<Eigen::Matrix<Eigen::half, -1, -1, 1, -1, -1>, 0, Eigen::Stride<0, 0> >; Src = Eigen::Inverse<Eigen::Map<const Eigen::Matrix<Eigen::half, -1, -1, 1, -1, -1> > >]'
/usr/include/eigen3/Eigen/src/Core/Assign.h:66:28:   required from 'Derived& Eigen::MatrixBase<Derived>::operator=(const Eigen::DenseBase<OtherDerived>&) [with OtherDerived = Eigen::Inverse<Eigen::Map<const Eigen::Matrix<Eigen::half, -1, -1, 1, -1, -1> > >; Derived = Eigen::Map<Eigen::Matrix<Eigen::half, -1, -1, 1, -1, -1>, 0, Eigen::Stride<0, 0> >]'
./onnxruntime/onnxruntime/contrib_ops/cpu/inverse.cc:62:42:   required from here
/usr/include/eigen3/Eigen/src/Core/PartialReduxEvaluator.h:57:82: error: invalid initialization of reference of type 'const Eigen::half&' from expression of type 'int'
   57 | PacketType packetwise_redux_empty_value(const Func& ) { return pset1<PacketType>(0); }
      |                                                                                  ^
In file included from /usr/include/eigen3/Eigen/Core:199:
/usr/include/eigen3/Eigen/src/Core/arch/AVX/PacketMath.h:938:76: note: in passing argument 1 of 'Packet Eigen::internal::pset1(const typename unpacket_traits<T>::type&) [with Packet = eigen_packet_wrapper<__vector(2) long long int, 2>; typename unpacket_traits<T>::type = Eigen::half]'
  938 | template<> EIGEN_STRONG_INLINE Packet8h pset1<Packet8h>(const Eigen::half& from) {
      |                                                         ~~~~~~~~~~~~~~~~~~~^~~~
make[2]: *** [CMakeFiles/onnxruntime_providers.dir/build.make:2246: CMakeFiles/onnxruntime_providers.dir./onnxruntime/onnxruntime/contrib_ops/cpu/inverse.cc.o] Error 1

Using the upstream patch from https://gitlab.com/libeigen/eigen/-/commit/d0e3791b1a0e2db9edd5f1d1befdb2ac5a40efe0 for eigen fixes this error, but then it stumbles about this:

[ 56%] Building CXX object CMakeFiles/onnxruntime_providers.dir./onnxruntime/onnxruntime/core/providers/cpu/math/element_wise_ops.cc.o
In file included from /usr/include/eigen3/Eigen/Core:172,
                 from ./onnxruntime/onnxruntime/core/util/math_cpuonly.h:68,
                 from ./onnxruntime/onnxruntime/core/providers/cpu/math/element_wise_ops.h:10,
                 from ./onnxruntime/onnxruntime/core/providers/cpu/math/element_wise_ops.cc:4:
/usr/include/eigen3/Eigen/src/Core/functors/BinaryFunctors.h: In instantiation of 'struct Eigen::internal::scalar_bitwise_xor_op<bool>':
/usr/include/c++/13.2.1/type_traits:2558:26:   required by substitution of 'template<class _Fn, class ... _Args> static std::__result_of_success<decltype (declval<_Fn>()((declval<_Args>)()...)), std::__invoke_other> std::__result_of_other_impl::_S_test(int) [with _Fn = Eigen::internal::scalar_bitwise_xor_op<bool>; _Args = {const bool&, const bool&}]'
/usr/include/c++/13.2.1/type_traits:2569:55:   required from 'struct std::__result_of_impl<false, false, Eigen::internal::scalar_bitwise_xor_op<bool>, const bool&, const bool&>'
/usr/include/c++/13.2.1/type_traits:2574:12:   required from 'struct std::__invoke_result<Eigen::internal::scalar_bitwise_xor_op<bool>, const bool&, const bool&>'
/usr/include/c++/13.2.1/type_traits:3061:12:   required from 'struct std::invoke_result<Eigen::internal::scalar_bitwise_xor_op<bool>, const bool&, const bool&>'
/usr/include/eigen3/Eigen/src/Core/util/Meta.h:272:61:   required from 'struct Eigen::internal::result_of<Eigen::internal::scalar_bitwise_xor_op<bool>(const bool&, const bool&)>'
/usr/include/eigen3/Eigen/src/Core/CwiseBinaryOp.h:41:28:   required from 'struct Eigen::internal::traits<Eigen::CwiseBinaryOp<Eigen::internal::scalar_bitwise_xor_op<bool>, const Eigen::ArrayWrapper<Eigen::Map<const Eigen::Matrix<bool, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > >, const Eigen::ArrayWrapper<Eigen::Map<const Eigen::Matrix<bool, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > > > >'
/usr/include/eigen3/Eigen/src/Core/CwiseBinaryOp.h:151:7:   required from 'class Eigen::CwiseBinaryOpImpl<Eigen::internal::scalar_bitwise_xor_op<bool>, const Eigen::ArrayWrapper<Eigen::Map<const Eigen::Matrix<bool, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > >, const Eigen::ArrayWrapper<Eigen::Map<const Eigen::Matrix<bool, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > >, Eigen::Dense>'
/usr/include/eigen3/Eigen/src/Core/CwiseBinaryOp.h:80:7:   required from 'class Eigen::CwiseBinaryOp<Eigen::internal::scalar_bitwise_xor_op<bool>, const Eigen::ArrayWrapper<Eigen::Map<const Eigen::Matrix<bool, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > >, const Eigen::ArrayWrapper<Eigen::Map<const Eigen::Matrix<bool, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > > >'
./onnxruntime/onnxruntime/core/providers/cpu/math/element_wise_ops.cc:970:93:   required from here
/usr/include/eigen3/Eigen/src/Core/functors/BinaryFunctors.h:647:24: error: static assertion failed: DONT USE BITWISE OPS ON BOOLEAN TYPES
  647 |   EIGEN_STATIC_ASSERT((!internal::is_same<Scalar, bool>::value), DONT USE BITWISE OPS ON BOOLEAN TYPES)
      |                       ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/eigen3/Eigen/src/Core/util/StaticAssert.h:26:50: note: in definition of macro 'EIGEN_STATIC_ASSERT'
   26 | #define EIGEN_STATIC_ASSERT(X,MSG) static_assert(X,#MSG);
      |                                                  ^
/usr/include/eigen3/Eigen/src/Core/functors/BinaryFunctors.h:647:24: note: 'false' evaluates to false
  647 |   EIGEN_STATIC_ASSERT((!internal::is_same<Scalar, bool>::value), DONT USE BITWISE OPS ON BOOLEAN TYPES)
      |                       ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/eigen3/Eigen/src/Core/util/StaticAssert.h:26:50: note: in definition of macro 'EIGEN_STATIC_ASSERT'
   26 | #define EIGEN_STATIC_ASSERT(X,MSG) static_assert(X,#MSG);
      |                                                  ^
make[2]: *** [CMakeFiles/onnxruntime_providers.dir/build.make:426: CMakeFiles/onnxruntime_providers.dir./onnxruntime/onnxruntime/core/providers/cpu/math/element_wise_ops.cc.o] Error 1

Urgency

No response

Target platform

Linux

Build script

cmake -S onnxruntime/cmake -B build
cmake --build build 

Error / output

BTW: Would onnxruntime use system libeigen without -Donnxruntime_USE_PREINSTALLED_EIGEN=ON?

Visual Studio Version

No response

GCC / Compiler Version

13.2.1

@meerfrau meerfrau added the build build issues; typically submitted using template label Oct 12, 2023
@snnn
Copy link
Member

snnn commented Oct 16, 2023

The cmake option you mentioned was added for a historical reason for a customer that I don't remember who he/she was. :-( Sorry. I should have marked it as deprecated. Adding "-DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=NEVER" to your first build command should help.

Copy link
Contributor

This issue has been automatically marked as stale due to inactivity and will be closed in 7 days if no further activity occurs. If further support is needed, please provide an update and/or more details.

@github-actions github-actions bot added the stale issues that have not been addressed in a while; categorized by a bot label Nov 16, 2023
@snnn
Copy link
Member

snnn commented Nov 16, 2023

Is the target platform 32-bit or 64-bit ?

@meerfrau
Copy link
Author

64-bit, but my issue has resolved itself with current git master

@github-actions github-actions bot removed the stale issues that have not been addressed in a while; categorized by a bot label Nov 17, 2023
@snnn snnn closed this as completed Nov 17, 2023
@snnn
Copy link
Member

snnn commented Nov 17, 2023

#18246

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build issues; typically submitted using template
Projects
None yet
Development

No branches or pull requests

2 participants