Skip to content

Use 'always inline' attribute to force compiler to inline functions used by CPU dispatch methods

I just noticed a small issue with my CPU dispatch methods in the quartic reconstruction which is one of the methods, inlined from the quartic solver, was not being inlined by the compiler (for likely good reasons, too big). Normally this is fine, its best to go with what the compiler decides but in this case I need it to be inlined, as there is the issue that there can only be one instance of the method in the final library, so which SIMD compilation does the linker use ? In the best case scenario it picks the lowest common denominator, so all the methods run but not quite as fast as they could, because for instance the SSE4 version is being called from the AVX2 dispatch method. In the worst case scenario we get the AVX2 called from the AVX or below, which will result in a runtime exception...

This MR hopefully fixes this by adding some attributes to help convince the compiler to inline these methods... valgrind profiling shows the compiler does indeed take note of the attributes.

Merge request reports