[eigen] Strong inlining is sometimes ignored...

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


While fixing some of the /W4 warnings, I recognized that with the following code:

#include "Eigen/Core"
#include "Eigen/Array"

template <int size>
void redux_prod()
{
  typedef typename Eigen::Matrix<double,1,size> Vector;
  Vector a = Vector::Random();
  std::cout << a.prod() << std::endl;
}

int main()
{
  redux_prod<1>();
  redux_prod<2>();
  redux_prod<3>();
  redux_prod<4>();
}

I am getting the warning C4714, which tells us that a function marked as _forceinline has not been inlined. The actual output is here:

Warning    6    warning C4714: function 'static double __cdecl Eigen::ei_redux_novec_unroller<struct Eigen::ei_scalar_product_op<double>,class Eigen::Matrix<double,1,4,0,1,4>,4,0>::run(class Eigen::Matrix<double,1,4,0,1,4> const & __ptr64,struct Eigen::ei_scalar_product_op<double> const & __ptr64)' marked as __forceinline not inlined    \eigen\src\core\redux.h    95
Warning    7    warning C4714: function 'static double __cdecl Eigen::ei_redux_novec_unroller<struct Eigen::ei_scalar_product_op<double>,class Eigen::Matrix<double,1,4,0,1,4>,4,0>::run(class Eigen::Matrix<double,1,4,0,1,4> const & __ptr64,struct Eigen::ei_scalar_product_op<double> const & __ptr64)' marked as __forceinline not inlined    \eigen\src\core\redux.h    95
Warning    8    warning C4714: function 'static double __cdecl Eigen::ei_redux_novec_unroller<struct Eigen::ei_scalar_product_op<double>,class Eigen::Matrix<double,1,2,0,1,2>,2,0>::run(class Eigen::Matrix<double,1,2,0,1,2> const & __ptr64,struct Eigen::ei_scalar_product_op<double> const & __ptr64)' marked as __forceinline not inlined    \eigen\src\core\redux.h    95
Warning    9    warning C4714: function 'static double __cdecl Eigen::ei_redux_novec_unroller<struct Eigen::ei_scalar_product_op<double>,class Eigen::Matrix<double,1,2,0,1,2>,2,0>::run(class Eigen::Matrix<double,1,2,0,1,2> const & __ptr64,struct Eigen::ei_scalar_product_op<double> const & __ptr64)' marked as __forceinline not inlined    \eigen\src\core\redux.h    95

As you can see, it happens here only for even size vectors.

I tried to disable exceptions and it did not help, I tried to declare ei_redux_novec_unroller::run with declspec(nothrow), again no help. I have no idea how to fix this.

Maybe someone has more experience with issues like this and is ready to help us.

Cheers,
Hauke



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/