From 3be83a26d00dcfa4712627fc57a08169919a34d6 Mon Sep 17 00:00:00 2001 From: jasperzhu Date: Tue, 12 Oct 2021 08:24:47 +0530 Subject: [PATCH] fixed Typos and Styles issues --- src/CMakeLists.txt | 2 +- src/Columns/ColumnFixedString.cpp | 8 ++++---- src/Columns/ColumnVector.cpp | 7 +++---- src/Columns/ColumnsCommon.cpp | 18 +++++++++--------- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 45bb1a21d59..d5977b31159 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -284,7 +284,7 @@ target_link_libraries (clickhouse_common_io dragonbox_to_chars ) -# Use X86 AVX2/AVX512 instructions to accelerate filter opertions +# Use X86 AVX2/AVX512 instructions to accelerate filter operations set_source_files_properties( Columns/ColumnFixedString.cpp Columns/ColumnsCommon.cpp diff --git a/src/Columns/ColumnFixedString.cpp b/src/Columns/ColumnFixedString.cpp index 4b31677d37e..65f56495445 100644 --- a/src/Columns/ColumnFixedString.cpp +++ b/src/Columns/ColumnFixedString.cpp @@ -238,13 +238,13 @@ ColumnPtr ColumnFixedString::filter(const IColumn::Filter & filt, ssize_t result */ #if defined(__AVX512F__) && defined(__AVX512BW__) static constexpr size_t SIMD_BYTES = 64; - const __m512i zero64 = _mm512_setzero_epi32(); + const __m512i zero64 = _mm512_setzero_epi32(); const UInt8 * filt_end_avx512 = filt_pos + col_size / SIMD_BYTES * SIMD_BYTES; const size_t chars_per_simd_elements = SIMD_BYTES * n; while (filt_pos < filt_end_avx512) - { - uint64_t mask = _mm512_cmp_epi8_mask(_mm512_loadu_si512(reinterpret_cast(filt_pos)), zero64, _MM_CMPINT_GT); + { + uint64_t mask = _mm512_cmp_epi8_mask(_mm512_loadu_si512(reinterpret_cast(filt_pos)), zero64, _MM_CMPINT_GT); if (0xFFFFFFFFFFFFFFFF == mask) { @@ -263,7 +263,7 @@ ColumnPtr ColumnFixedString::filter(const IColumn::Filter & filt, ssize_t result mask = _blsr_u64(mask); #else mask = mask & (mask-1); - #endif + #endif } } data_pos += chars_per_simd_elements; diff --git a/src/Columns/ColumnVector.cpp b/src/Columns/ColumnVector.cpp index 37f60e9f2b9..78922841e37 100644 --- a/src/Columns/ColumnVector.cpp +++ b/src/Columns/ColumnVector.cpp @@ -310,7 +310,6 @@ ColumnPtr ColumnVector::filter(const IColumn::Filter & filt, ssize_t result_s const UInt8 * filt_pos = filt.data(); const UInt8 * filt_end = filt_pos + size; const T * data_pos = data.data(); - /** A slightly more optimized version. * Based on the assumption that often pieces of consecutive values * completely pass or do not pass the filter. @@ -318,11 +317,11 @@ ColumnPtr ColumnVector::filter(const IColumn::Filter & filt, ssize_t result_s */ #if defined(__AVX512F__) && defined(__AVX512BW__) static constexpr size_t SIMD_BYTES = 64; - const __m512i zero64 = _mm512_setzero_epi32(); + const __m512i zero64 = _mm512_setzero_epi32(); const UInt8 * filt_end_avx512 = filt_pos + size / SIMD_BYTES * SIMD_BYTES; while (filt_pos < filt_end_avx512) - { + { UInt64 mask = _mm512_cmp_epi8_mask(_mm512_loadu_si512(reinterpret_cast(filt_pos)), zero64, _MM_CMPINT_GT); if (0xFFFFFFFFFFFFFFFF == mask) @@ -339,7 +338,7 @@ ColumnPtr ColumnVector::filter(const IColumn::Filter & filt, ssize_t result_s mask = _blsr_u64(mask); #else mask = mask & (mask-1); - #endif + #endif } } diff --git a/src/Columns/ColumnsCommon.cpp b/src/Columns/ColumnsCommon.cpp index 36c292b4196..d8e0cf74669 100644 --- a/src/Columns/ColumnsCommon.cpp +++ b/src/Columns/ColumnsCommon.cpp @@ -235,8 +235,8 @@ namespace const auto * filt_end_aligned = filt_pos + size / SIMD_BYTES * SIMD_BYTES; while (filt_pos < filt_end_aligned) - { - uint64_t mask = _mm512_cmp_epi8_mask(_mm512_loadu_si512(reinterpret_cast(filt_pos)), zero_vec, _MM_CMPINT_GT); + { + uint64_t mask = _mm512_cmp_epi8_mask(_mm512_loadu_si512(reinterpret_cast(filt_pos)), zero_vec, _MM_CMPINT_GT); if (mask == 0xffffffffffffffff) { @@ -258,18 +258,18 @@ namespace while (mask) { size_t index = __builtin_ctzll(mask); - copy_array(offsets_pos + index); + copy_array(offsets_pos + index); #ifdef __BMI__ mask = _blsr_u64(mask); #else mask = mask & (mask-1); - #endif + #endif } } filt_pos += SIMD_BYTES; offsets_pos += SIMD_BYTES; - } + } #elif defined(__AVX2__) const __m256i zero_vec = _mm256_setzero_si256(); static constexpr size_t SIMD_BYTES = 32; @@ -277,7 +277,7 @@ namespace while (filt_pos < filt_end_aligned) { - uint32_t mask = _mm256_movemask_epi8(_mm256_cmpgt_epi8(_mm256_loadu_si256(reinterpret_cast(filt_pos)), zero_vec)); + uint32_t mask = _mm256_movemask_epi8(_mm256_cmpgt_epi8(_mm256_loadu_si256(reinterpret_cast(filt_pos)), zero_vec)); if (mask == 0xffffffff) { @@ -299,18 +299,18 @@ namespace while (mask) { size_t index = __builtin_ctz(mask); - copy_array(offsets_pos + index); + copy_array(offsets_pos + index); #ifdef __BMI__ mask = _blsr_u32(mask); #else mask = mask & (mask-1); - #endif + #endif } } filt_pos += SIMD_BYTES; offsets_pos += SIMD_BYTES; - } + } #elif defined(__SSE2__) const __m128i zero_vec = _mm_setzero_si128(); static constexpr size_t SIMD_BYTES = 16;