-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
Fixing compilation with optimisation: Set optimisation flags when building shuffle.c #436
Conversation
@@ -172,11 +172,17 @@ if(COMPILER_SUPPORT_SSE2) | |||
set_source_files_properties( | |||
shuffle-sse2.c bitshuffle-sse2.c blosclz.c fastcopy.c | |||
PROPERTIES COMPILE_FLAGS "/arch:SSE2") | |||
set_property( | |||
SOURCE shuffle.c | |||
APPEND PROPERTY COMPILE_OPTIONS "/arch:SSE2") |
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.
Using COMPILE_OPTIONS
here since COMPILE_FLAGS
is deprecated (see https://cmake.org/cmake/help/latest/prop_tgt/COMPILE_FLAGS.html).
Also COMPILE_OPTIONS
is a ;
-separated list which fits set_property
as opposed to COMPILE_FLAGS
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.
After your new commits, is really necessary to add SSE2 / AVX2 support to shuffle.c. This was not necessary before.
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.
Yes, it is needed or it needs other modifications:
shuffle.c
is using SHUFFLE_USE_AVX2
which is defined as:
Lines 28 to 30 in e204359
#if defined(SHUFFLE_AVX2_ENABLED) && defined(__AVX2__) | |
#define SHUFFLE_USE_AVX2 | |
#endif |
So the definition needs
-mavx2
flag to have __AVX2__
defined. Same applies for SSE2/NEON/ALTIVEC.
To avoid this, it looks to require to change the conditional include of [bit]shuffle-*.h
and the way get_shuffle_implementation
is implemented.
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.
I am fine with that. I just want to make sure we don't abuse of SIMD flags.
I also reverted commit 89f9335. This breaks the With this, I get the following for |
8317f81
to
6529f75
Compare
Yes, your last fix seems to work for me too. I just have a comment. Thanks! |
I haven't checked yet the build for |
It would be possible to disable AVX2 just for |
756eadb
to
1b8cf93
Compare
I checked I just updated the comment at the end of |
Thanks @t20100 ! |
This PR fixes a compilation issue introduced in PR #431 (commit c603171) and first raised here: #431 (comment).
The definition of
SHUFFLE_USE_*
made inshuffle.h
relies on hardware optimisation macros (__SSE2__
,__AVX2__
,__ARM_NEON
and__ALTIVEC__
), so the hardware optimisation compilation flags must also be set whereSHUFFLE_USE_*
macros are used, thus inshuffle.c
.blosc2.c
also includesshuffle.h
, but does not useSHUFFLE_USE_*
macros. Should it also be compiled with the optimisations flags? or all blosc source to avoid such issues in the future?