Re: [eigen] MSVC bad inlining behavior

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


Hi,

Sorry for overlooking your PR, I don't have much time to devote to Eigen these days.

Thank you for investigating these inlining issues. Your changes look reasonable and I've merged the PR and ported it to the main branch.

best,
gael

On Sun, Mar 25, 2018 at 4:13 PM, Basil Fierz <basil.fierz@xxxxxxxxxxx> wrote:

Hi Eigen developers,

 

I’m using Eigen (personally and professionally) for quite a few years, mainly to solve many small fixed-size problems. While the template _expression_ engine is a wonderful tool to optimize the generated code, it only works reasonable well using clang/gcc. Using MSVC we’re constantly running into the issue that a lot of code is not properly inlined, which in turn hurts performance massively.

The issue can usually be resolved by patching Eigen and replacing some ‘inline’ with ‘EIGEN_STRONG_INLINE’. I’ve collected some very simple examples which demonstrate the problem:

https://godbolt.org/g/Q8Bvxv

 

The example is compiled using MSVC 2017 and Clang 4. In each of them the former does not properly inline the calls, while Clang does.

There is a lot of other cases where this happens. The most frustrating ones are some where calls to ‘derived()’ are found in the code as they should essentially be no-ops. While I don’t see Eigen as a culprit, I would like to propose adapting Eigen to accommodate for the bad inlining engine of MSVC. Some time ago, I’ve created a PR which at least fixes the most annoying inlining problems for us:

https://bitbucket.org/eigen/eigen/pull-requests/345

 

I am open to different solutions for this problem. If adding ‘EIGEN_STRONG_INLINE’ to the core structures of Eigen, I will give it another more complete try.

 

Best regards,

 

Basil




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