|Re: [eigen] MSVC bad inlining behavior|
[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]
Thanks for merging the PR. As we are using Eigen heavily in performance critical areas, I am going to monitor these kinds compilation failures and maybe issue some further pull-requests.
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.
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:
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:
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.
|Mail converted by MHonArc 2.6.19+||http://listengine.tuxfamily.org/|