Skip to content
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

Do not pass -m flags when compiling shuffle.c #622

Merged
merged 8 commits into from
Jul 4, 2024
24 changes: 0 additions & 24 deletions blosc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -300,17 +300,11 @@ if(COMPILER_SUPPORT_SSE2)
set_source_files_properties(
shuffle-sse2.c bitshuffle-sse2.c blosclz.c fastcopy.c
PROPERTIES COMPILE_OPTIONS "/arch:SSE2")
set_property(
SOURCE shuffle.c
APPEND PROPERTY COMPILE_OPTIONS "/arch:SSE2")
endif()
else()
set_source_files_properties(
shuffle-sse2.c bitshuffle-sse2.c blosclz.c fastcopy.c
PROPERTIES COMPILE_OPTIONS -msse2)
set_property(
SOURCE shuffle.c
APPEND PROPERTY COMPILE_OPTIONS -msse2)
# Add SIMD flags for the bytedelta filter and Intel (it seems that ARM64 does not need these)
set_source_files_properties(
${PROJECT_SOURCE_DIR}/plugins/filters/bytedelta/bytedelta.c
Expand All @@ -330,16 +324,10 @@ if(COMPILER_SUPPORT_AVX2)
set_source_files_properties(
shuffle-avx2.c bitshuffle-avx2.c
PROPERTIES COMPILE_OPTIONS "/arch:AVX2")
set_property(
SOURCE shuffle.c
APPEND PROPERTY COMPILE_OPTIONS "/arch:AVX2")
else()
set_source_files_properties(
shuffle-avx2.c bitshuffle-avx2.c
PROPERTIES COMPILE_OPTIONS -mavx2)
set_property(
SOURCE shuffle.c
APPEND PROPERTY COMPILE_OPTIONS -mavx2)
endif()

# Define a symbol for the shuffle-dispatch implementation
Expand All @@ -354,16 +342,10 @@ if(COMPILER_SUPPORT_AVX512)
set_source_files_properties(
bitshuffle-avx512.c
PROPERTIES COMPILE_OPTIONS "/arch:AVX512")
set_property(
SOURCE shuffle.c
APPEND PROPERTY COMPILE_OPTIONS "/arch:AVX512")
else()
set_source_files_properties(
bitshuffle-avx512.c
PROPERTIES COMPILE_OPTIONS "-mavx512f;-mavx512bw")
set_property(
SOURCE shuffle.c
APPEND PROPERTY COMPILE_OPTIONS "-mavx512f;-mavx512bw")
endif()

# Define a symbol for the shuffle-dispatch implementation
Expand All @@ -377,17 +359,11 @@ if(COMPILER_SUPPORT_NEON)
set_source_files_properties(
shuffle-neon.c bitshuffle-neon.c
PROPERTIES COMPILE_OPTIONS "-flax-vector-conversions")
set_property(
SOURCE shuffle.c
APPEND PROPERTY COMPILE_OPTIONS "-flax-vector-conversions")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l)
# Only armv7l needs special -mfpu=neon flag; aarch64 doesn't.
set_source_files_properties(
shuffle-neon.c bitshuffle-neon.c
PROPERTIES COMPILE_OPTIONS "-mfpu=neon;-flax-vector-conversions")
set_property(
SOURCE shuffle.c
APPEND PROPERTY COMPILE_OPTIONS "-mfpu=neon;-flax-vector-conversions")
endif()
# Define a symbol for the shuffle-dispatch implementation
# so it knows NEON is supported even though that file is
Expand Down
23 changes: 21 additions & 2 deletions blosc/bitshuffle-altivec.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include "bitshuffle-altivec.h"
#include "bitshuffle-generic.h"
#include <stdlib.h>

/* Make sure ALTIVEC is available for the compilation target and compiler. */
#if defined(__ALTIVEC__) && defined(__VSX__) && defined(_ARCH_PWR8)
Expand All @@ -33,7 +34,6 @@
#include <altivec.h>

#include <stdint.h>
#include <stdlib.h>

/* The next is useful for debugging purposes */
#if 0
Expand Down Expand Up @@ -592,4 +592,23 @@ int64_t bshuf_untrans_bit_elem_altivec(const void* in, void* out, const size_t s
return count;
}

#endif /* defined(__ALTIVEC__) */

const bool is_bshuf_altivec = true;

#else /* defined(__ALTIVEC__) && defined(__VSX__) && defined(_ARCH_PWR8) */

const bool is_bshuf_altivec = false;

int64_t
bshuf_trans_bit_elem_altivec(const void* in, void* out, const size_t size,
const size_t elem_size) {
abort();
}

int64_t
bshuf_untrans_bit_elem_altivec(const void* in, void* out, const size_t size,
const size_t elem_size) {
abort();
}

#endif /* defined(__ALTIVEC__) && defined(__VSX__) && defined(_ARCH_PWR8) */
6 changes: 6 additions & 0 deletions blosc/bitshuffle-altivec.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@

#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>

/**
* ALTIVEC-accelerated bit(un)shuffle routines availability.
*/
extern const bool is_bshuf_altivec;

BLOSC_NO_EXPORT int64_t
bshuf_trans_byte_elem_altivec(const void* in, void* out, const size_t size,
Expand Down
19 changes: 19 additions & 0 deletions blosc/bitshuffle-avx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "bitshuffle-avx2.h"
#include "bitshuffle-sse2.h"
#include "bitshuffle-generic.h"
#include <stdlib.h>

/* Make sure AVX2 is available for the compilation target and compiler. */
#if defined(__AVX2__)
Expand Down Expand Up @@ -262,4 +263,22 @@ int64_t bshuf_untrans_bit_elem_AVX(const void* in, void* out, const size_t size,
return count;
}

const bool is_bshuf_AVX = true;

#else /* defined(__AVX2__) */

const bool is_bshuf_AVX = false;

int64_t
bshuf_trans_bit_elem_AVX(const void* in, void* out, const size_t size,
const size_t elem_size) {
abort();
}

int64_t
bshuf_untrans_bit_elem_AVX(const void* in, void* out, const size_t size,
const size_t elem_size) {
abort();
}

#endif /* defined(__AVX2__) */
7 changes: 7 additions & 0 deletions blosc/bitshuffle-avx2.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@

#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>

/**
* AVX2-accelerated bit(un)shuffle routines availability.
*/
extern const bool is_bshuf_AVX;


/**
* AVX2-accelerated bitshuffle routine.
Expand Down
28 changes: 24 additions & 4 deletions blosc/bitshuffle-avx512.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@
rights to use.
**********************************************************************/

/* Make sure AVX512 is available for the compilation target and compiler. */
#if defined(__AVX512F__) && defined (__AVX512BW__)
#include <immintrin.h>
#include "bitshuffle-avx512.h"
#include "bitshuffle-avx2.h"
#include "bitshuffle-sse2.h"
#include "bitshuffle-generic.h"
#include <stdlib.h>

/* Make sure AVX512 is available for the compilation target and compiler. */
#if defined(__AVX512F__) && defined (__AVX512BW__)
#include <immintrin.h>


/* Transpose bits within bytes. */
Expand Down Expand Up @@ -158,4 +160,22 @@ int64_t bshuf_untrans_bit_elem_AVX512(const void* in, void* out, const size_t si
return count;
}

#endif
const bool is_bshuf_AVX512 = true;

#else /* defined(__AVX512F__) && defined (__AVX512BW__) */

const bool is_bshuf_AVX512 = false;

int64_t
bshuf_trans_bit_elem_AVX512(const void* in, void* out, const size_t size,
const size_t elem_size) {
abort();
}

int64_t
bshuf_untrans_bit_elem_AVX512(const void* in, void* out, const size_t size,
const size_t elem_size) {
abort();
}

#endif /* defined(__AVX512F__) && defined (__AVX512BW__) */
6 changes: 6 additions & 0 deletions blosc/bitshuffle-avx512.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@

#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>

/**
* AVX512-accelerated bit(un)shuffle routines availability.
*/
extern const bool is_bshuf_AVX512;

BLOSC_NO_EXPORT int64_t
bshuf_trans_bit_elem_AVX512(const void* in, void* out, const size_t size,
Expand Down
18 changes: 17 additions & 1 deletion blosc/bitshuffle-neon.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@

#include "bitshuffle-neon.h"
#include "bitshuffle-generic.h"
#include <stdlib.h>

/* Make sure NEON is available for the compilation target and compiler. */
#if defined(__ARM_NEON)

#include <arm_neon.h>

#include <stdlib.h>

/* The next is useful for debugging purposes */
#if 0
Expand Down Expand Up @@ -491,4 +491,20 @@ int64_t bshuf_untrans_bit_elem_NEON(const void* in, void* out, const size_t size
return count;
}

const bool is_bshuf_NEON = true;

#else /* defined(__ARM_NEON) */

const bool is_bshuf_NEON = false;

int64_t bshuf_trans_bit_elem_NEON(const void* in, void* out, const size_t size,
const size_t elem_size) {
abort();
}

int64_t bshuf_untrans_bit_elem_NEON(const void* in, void* out, const size_t size,
const size_t elem_size) {
abort();
}

#endif /* defined(__ARM_NEON) */
6 changes: 6 additions & 0 deletions blosc/bitshuffle-neon.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@

#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>

/**
* NEON-accelerated bit(un)shuffle routines availability.
*/
extern const bool is_bshuf_NEON;

/**
NEON-accelerated bitshuffle routine.
Expand Down
18 changes: 18 additions & 0 deletions blosc/bitshuffle-sse2.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include "bitshuffle-sse2.h"
#include "bitshuffle-generic.h"
#include <stdlib.h>

/* Make sure SSE2 is available for the compilation target and compiler. */
#if defined(__SSE2__)
Expand Down Expand Up @@ -481,5 +482,22 @@ int64_t bshuf_untrans_bit_elem_SSE(const void* in, void* out, const size_t size,
return count;
}

const bool is_bshuf_SSE = true;

#else /* defined(__SSE2__) */

const bool is_bshuf_SSE = false;

int64_t
bshuf_trans_bit_elem_SSE(const void* in, void* out, const size_t size,
const size_t elem_size) {
abort();
}

int64_t
bshuf_untrans_bit_elem_SSE(const void* in, void* out, const size_t size,
const size_t elem_size) {
abort();
}

#endif /* defined(__SSE2__) */
6 changes: 6 additions & 0 deletions blosc/bitshuffle-sse2.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@

#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>

/**
* SSE2-accelerated bit(un)shuffle routines availability.
*/
extern const bool is_bshuf_SSE;

BLOSC_NO_EXPORT int64_t
bshuf_trans_byte_elem_SSE(const void* in, void* out, const size_t size,
Expand Down
19 changes: 18 additions & 1 deletion blosc/shuffle-altivec.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include "shuffle-altivec.h"
#include "shuffle-generic.h"
#include <stdlib.h>

/* Make sure ALTIVEC is available for the compilation target and compiler. */
#if defined(__ALTIVEC__) && defined(__VSX__) && defined(_ARCH_PWR8)
Expand Down Expand Up @@ -423,4 +424,20 @@ unshuffle_altivec(const int32_t bytesoftype, const int32_t blocksize,
}
}

#endif /* defined(__ALTIVEC__) */
const bool is_shuffle_altivec = true;

#else /* defined(__ALTIVEC__) && defined(__VSX__) && defined(_ARCH_PWR8) */

const bool is_shuffle_altivec = false;

void shuffle_altivec(const int32_t bytesoftype, const int32_t blocksize,
const uint8_t *_src, uint8_t *_dest) {
abort();
}

void unshuffle_altivec(const int32_t bytesoftype, const int32_t blocksize,
const uint8_t *_src, uint8_t *_dest) {
abort();
}

#endif /* defined(__ALTIVEC__) && defined(__VSX__) && defined(_ARCH_PWR8) */
6 changes: 6 additions & 0 deletions blosc/shuffle-altivec.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
#include "blosc2/blosc2-common.h"

#include <stdint.h>
#include <stdbool.h>

/**
* ALTIVEC-accelerated (un)shuffle routines availability.
*/
extern const bool is_shuffle_altivec;

/**
ALTIVEC-accelerated shuffle routine.
Expand Down
18 changes: 17 additions & 1 deletion blosc/shuffle-avx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

#include "shuffle-avx2.h"
#include "shuffle-generic.h"
#include <stdlib.h>

/* Make sure AVX2 is available for the compilation target and compiler. */
#if defined(__AVX2__)

#include <immintrin.h>

#include <stdlib.h>
#include <stdint.h>

/* The next is useful for debugging purposes */
Expand Down Expand Up @@ -746,4 +746,20 @@ unshuffle_avx2(const int32_t bytesoftype, const int32_t blocksize,
}
}

const bool is_shuffle_avx2 = true;

#else

const bool is_shuffle_avx2 = false;

void shuffle_avx2(const int32_t bytesoftype, const int32_t blocksize,
const uint8_t *_src, uint8_t *_dest) {
abort();
}

void unshuffle_avx2(const int32_t bytesoftype, const int32_t blocksize,
const uint8_t *_src, uint8_t *_dest) {
abort();
}

#endif /* defined(__AVX2__) */
Loading