guillaumeblanc / ozz-animation

Open source c++ skeletal animation library and toolset
http://guillaumeblanc.github.io/ozz-animation/
Other
2.46k stars 302 forks source link

Compiling With Enhanced Instructions Fails #136

Closed kklouzal closed 2 years ago

kklouzal commented 2 years ago

Trying to compile my project, not OZZ itself, with any enhanced instruction set enabled fails:

1>C:\Users\kk\Desktop\ozz-animation-master\src\animation\runtime\sampling_job.cc(198): error C2220: the following warning is treated as an error
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): error C2220: the following warning is treated as an error
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_quaternion.h(136): error C2220: the following warning is treated as an error
1>C:\Users\kk\Desktop\ozz-animation-master\src\animation\runtime\sampling_job.cc(198): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator+(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\src\animation\runtime\sampling_job.cc(198): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\src\animation\runtime\sampling_job.cc(198): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\src\animation\runtime\sampling_job.cc(198): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_quaternion.h(136): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\src\animation\runtime\sampling_job.cc(198): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_quaternion.h(136): warning C4714: function 'union __m128 __cdecl operator+(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\src\animation\runtime\sampling_job.cc(198): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_quaternion.h(136): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\src\animation\runtime\sampling_job.cc(198): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\src\animation\runtime\sampling_job.cc(198): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_quaternion.h(136): warning C4714: function 'union __m128 __cdecl operator+(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\src\animation\runtime\sampling_job.cc(198): warning C4714: function 'union __m128 __cdecl operator+(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_quaternion.h(136): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_quaternion.h(136): warning C4714: function 'union __m128 __cdecl operator+(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\src\animation\runtime\sampling_job.cc(198): warning C4714: function 'union __m128 __cdecl operator+(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_quaternion.h(136): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator+(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_quaternion.h(136): warning C4714: function 'union __m128 __cdecl operator+(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\src\animation\runtime\sampling_job.cc(198): warning C4714: function 'union __m128 __cdecl operator+(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_quaternion.h(136): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\src\animation\runtime\sampling_job.cc(198): warning C4714: function 'union __m128 __cdecl ozz::math::Max(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator+(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_quaternion.h(136): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\src\animation\runtime\sampling_job.cc(198): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_quaternion.h(136): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_quaternion.h(136): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_quaternion.h(136): warning C4714: function 'union __m128 __cdecl operator+(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_quaternion.h(136): warning C4714: function 'union __m128 __cdecl operator+(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_quaternion.h(136): warning C4714: function 'union __m128 __cdecl operator+(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_quaternion.h(136): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_quaternion.h(136): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator+(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_quaternion.h(136): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_quaternion.h(136): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator+(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator+(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator+(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float4x4.h(104): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float.h(619): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float.h(619): warning C4714: function 'union __m128 __cdecl operator+(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float.h(619): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float.h(619): warning C4714: function 'union __m128 __cdecl operator+(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float.h(619): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\include\ozz\base\maths\soa_float.h(619): warning C4714: function 'union __m128 __cdecl operator+(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\src\animation\runtime\sampling_job.cc(269): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\src\animation\runtime\sampling_job.cc(269): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\src\animation\runtime\sampling_job.cc(269): warning C4714: function 'union __m128 __cdecl operator*(union __m128,union __m128)' marked as __forceinline not inlined
1>C:\Users\kk\Desktop\ozz-animation-master\src\animation\runtime\sampling_job.cc(298): warning C4714: function 'float __cdecl ozz::math::Clamp<float>(float,float,float)' marked as __forceinline not inlined
1>LINK : fatal error LNK1257: code generation failed

Unable to make the compiler ignore these warnings from being treated as errors..

guillaumeblanc commented 2 years ago

Hi,

that's very strange that this one line function (https://github.com/guillaumeblanc/ozz-animation/blob/master/include/ozz/base/maths/internal/simd_math_sse-inl.h#L2029) isn't inlined. You seem to be compiling with Microsoft compiler, right? Can you try to see if you have an option that can prevent inlining?

Anyway, here's where "warning treated as error" option is set: https://github.com/guillaumeblanc/ozz-animation/blob/master/build-utils/cmake/compiler_settings.cmake#L59. You can either disable that, or disable the warning only.

Last idea, replace __forceinline by a simple inline which will not trigger the warning: https://github.com/guillaumeblanc/ozz-animation/blob/master/include/ozz/base/platform.h#L53

I'd be interested to hear it if you can find why this code isn't inlined.

Hope it helps, Guillaume

kklouzal commented 2 years ago

Was able to recompile ozz with -wx and everything is good to go. Haven't delved deeper into the __forceinline yet.