zpzim / SCAMP

The fastest way to compute matrix profiles on CPU and GPU!
http://www.cs.ucr.edu/~eamonn/MatrixProfile.html
MIT License
155 stars 35 forks source link

Dramatically improve performance of CPU kernels on less sophisticated compilers #78

Closed zpzim closed 2 years ago

zpzim commented 2 years ago

This PR does a couple of things:

  1. Significantly increases the chance that a compiler will be able to autovectorize the inner loops of SCAMP
  2. Adds compiler output for popular compilers (MSVC/clang/gcc) indicating which loops from the kernel were vectorized
  3. Only handles NaNs in the CPU kernel when needed, as processing the nans can cause signifigant slowdown on less sophisticated compilers (MSVC)

Overall CPU performance in situations where these benefits were not already observed is 2-4x. Further optimization may be possible (e.g. explicitly enabling AVX code generation on MSVC on platforms that support it).

Platform specific optimizations are also possible on MSVC, as it does not support -march=native which we use everywhere else. Enabling AVX on MSVC