Skip to content

Commit

Permalink
Revert "[improvement](bitshuffle)Enable avx512 support in bitshuffle …
Browse files Browse the repository at this point in the history
…for performance boost (#15972)" (#24146)

This reverts commit 28fcc09.
  • Loading branch information
xiaokang authored Sep 10, 2023
1 parent 586492c commit ebac816
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 23 deletions.
4 changes: 0 additions & 4 deletions be/src/gutil/cpu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ CPU::CPU()
has_popcnt_(false),
has_avx_(false),
has_avx2_(false),
has_avx512_(false),
has_aesni_(false),
has_non_stop_time_stamp_counter_(false),
is_running_in_vm_(false),
Expand Down Expand Up @@ -201,8 +200,6 @@ void CPU::Initialize() {
(xgetbv(0) & 6) == 6 /* XSAVE enabled by kernel */;
has_aesni_ = (cpu_info[2] & 0x02000000) != 0;
has_avx2_ = has_avx_ && (cpu_info7[1] & 0x00000020) != 0;
has_avx512_ = has_avx2_ && (cpu_info7[1] & 0x00010000) != 0 &&
(cpu_info7[1] & 0x40000000) != 0 && (cpu_info7[1] & 0x80000000) != 0;
}
// Get the brand string of the cpu.
__cpuid(cpu_info, 0x80000000);
Expand Down Expand Up @@ -255,7 +252,6 @@ void CPU::Initialize() {
#endif
}
CPU::IntelMicroArchitecture CPU::GetIntelMicroArchitecture() const {
if (has_avx512()) return AVX512;
if (has_avx2()) return AVX2;
if (has_avx()) return AVX;
if (has_sse42()) return SSE42;
Expand Down
3 changes: 0 additions & 3 deletions be/src/gutil/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class CPU final {
SSE42,
AVX,
AVX2,
AVX512,
MAX_INTEL_MICRO_ARCHITECTURE
};
// Accessors for CPU information.
Expand All @@ -82,7 +81,6 @@ class CPU final {
bool has_popcnt() const { return has_popcnt_; }
bool has_avx() const { return has_avx_; }
bool has_avx2() const { return has_avx2_; }
bool has_avx512() const { return has_avx512_; }
bool has_aesni() const { return has_aesni_; }
bool has_non_stop_time_stamp_counter() const { return has_non_stop_time_stamp_counter_; }
bool is_running_in_vm() const { return is_running_in_vm_; }
Expand All @@ -109,7 +107,6 @@ class CPU final {
bool has_popcnt_;
bool has_avx_;
bool has_avx2_;
bool has_avx512_;
bool has_aesni_;
bool has_non_stop_time_stamp_counter_;
bool is_running_in_vm_;
Expand Down
17 changes: 1 addition & 16 deletions be/src/olap/rowset/segment_v2/bitshuffle_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,6 @@
#undef bshuf_compress_lz4
#undef bshuf_decompress_lz4

// Include the bitshuffle header again, but this time importing the
// AVX512-compiled symbols by defining some macros.
#undef BITSHUFFLE_H
#define bshuf_compress_lz4_bound bshuf_compress_lz4_bound_avx512
#define bshuf_compress_lz4 bshuf_compress_lz4_avx512
#define bshuf_decompress_lz4 bshuf_decompress_lz4_avx512
#include <bitshuffle/bitshuffle.h> // NOLINT(*)
#undef bshuf_compress_lz4_bound
#undef bshuf_compress_lz4
#undef bshuf_decompress_lz4

using base::CPU;

namespace doris {
Expand All @@ -65,11 +54,7 @@ decltype(&bshuf_decompress_lz4) g_bshuf_decompress_lz4;
// the cost of a 'std::once' call.
__attribute__((constructor)) void SelectBitshuffleFunctions() {
#if (defined(__i386) || defined(__x86_64__))
if (CPU().has_avx512()) {
g_bshuf_compress_lz4_bound = bshuf_compress_lz4_bound_avx512;
g_bshuf_compress_lz4 = bshuf_compress_lz4_avx512;
g_bshuf_decompress_lz4 = bshuf_decompress_lz4_avx512;
} else if (CPU().has_avx2()) {
if (CPU().has_avx2()) {
g_bshuf_compress_lz4_bound = bshuf_compress_lz4_bound_avx2;
g_bshuf_compress_lz4 = bshuf_compress_lz4_avx2;
g_bshuf_decompress_lz4 = bshuf_decompress_lz4_avx2;
Expand Down

0 comments on commit ebac816

Please sign in to comment.