nfengine
nfengine copied to clipboard
Implement SSE/AVX code for Math module
Math module in nfCommon uses purely SSE4 code. We need to take into account other CPU extension sets:
- Implement no SSE/AVX version of Math module (should depend on NFE_MATH_USE_SSE macro)
- Implement AVX and older SSE versions of Math modules (needs discussion which SSE versions should we use)
- Upgrade current nfCommon Math tests to switch between SSE/AVX to test all available cases (this might require some code to discover available SSE version). Avoid code duplication.
I'm afraid that we can't do "switching between SSE/AVX" at the runtime. Most of Vector class methods are implemented in the header and is inlined everywhere. Theoretically we could implement different versions (SSE/SSE4/AVX) of some "bigger" functions like intersection tests or matrix inversion and choose the best version in the runtime (via some function pointers table). However, this requires a discussion.