p12tic / libsimdpp

Portable header-only C++ low level SIMD library
Boost Software License 1.0
1.24k stars 129 forks source link

VS 2017 strange behavior for AVX512 #69

Closed mbrucher closed 7 years ago

mbrucher commented 7 years ago

Can be seen here: https://ci.appveyor.com/project/mbrucher/audiotk/build/2.2.0.565/job/2rl0xf4j6aa3fbam For VS2015, everything is fine, the AVX512 test fails, and we don't compile the AVX version of the code. For VS2017, the test succeeds, but can't be compiled after. Known issue or new one?

p12tic commented 7 years ago

Thanks for the bug report! Could it be that you're using a version of libsimdpp from before e83b61be8 landed? Visual Studio 2017 does not support a large set of AVX512F intrinsics thus AVX512F support has been disabled there.

mbrucher commented 7 years ago

I think I used a fork of the trunk dated from this week-end. But I'll check again, I messed up the submodules in my project. Apparently, on appveyor, you don't have _mm512_load_ps in my projects, although I may have it in the checks (which seems quite crazy).

mbrucher commented 7 years ago

It also seems like for GCC 5/6 and Clang there is a difference in behavior (and clang wins, as gcc generates and runs code that crashes on unsupported platforms): https://travis-ci.org/mbrucher/AudioTK/jobs/275214040 (AVX512 works and crashes at runtime) https://travis-ci.org/mbrucher/AudioTK/jobs/275214044 (AVX512 doesn't work and all the tests pass)

mbrucher commented 7 years ago

Oh, my bad, I didn't understand that there is a check for compile and one for runtime check (as there are done in the opposite ordre). So I have a test, and I suppose that I should use a flag to check if I can actually run it on the platform. Is there such a flag in CMake builds? So that I can do an #ifndef CANTRUNONTHISPLATFORM of some sorts? As I'd like to test all configurations possible, I can't just use the dispatcher, I may end up with one bug on one platform.

mbrucher commented 7 years ago

So it's just me, I used compilable architectures instead of runnable ones in my builds... Although it would be interesting to pass a CAN_RUN flag to the compiler so that tests can be bypassed.

p12tic commented 7 years ago

You could look into how libsimdpp tests are written. They use the dispatcher to collect function pointers to all versions of the multiversioned functions available in the binary (see get_test_archs here ) and then run all versions that are supported on the current CPU (see here ).

The functionality depends on internal APIs at the moment, but your use cases is a strong reason to expose and document them.

mbrucher commented 7 years ago

If I can inject that inside BOOST_TEST macro, that would be great! Now creating a factory for these objects :p