-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement runtime dispatch of SIMD code #96
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
Given that the platform
value depends on the specific compilation parameter passed by the user, is it necessary to check it all around? That is, doesn't platform == ComputePlatform::SSE2
means that HAVE_SSE2
is defined?
Thank you for your contribution!
Yes, You could include stub files to still compile a mostly empty |
Hi @nicodr97 !
Sorry for the small delay in getting this implemented, I finally got to sit down and work on some extra code besides what I need for my PhD 😄
I added the
cpu_features
from Google as agit
submodule, and updated the CMake files to compile it as a subdirectory.cpu_features
is available under the Apache 2.0 license so there is no licensing issue here. When a newManager
is creeate, it checks the local CPU feature flags to check what backend is supported, using a mixture of compilation flags and runtime flags:x86
, it checks for SSE2 and AVX2x86-64
, SSE2 is always available, it checks for AVX2arm
, it checks for NEONaarch64
, NEON is always supported.It's still possible to disable AVX2, NEON, or SSE2 at compile time; but now a single binary can be compiled and distributed for each platforms. I also added an
[INFO]
-level message to report when an optimized implementation of the statistics is being used, to make it easier to debug.