fixed Typos and Styles issues

This commit is contained in:
jasperzhu 2021-10-12 08:24:47 +05:30
parent be28e94471
commit 3be83a26d0
4 changed files with 17 additions and 18 deletions

View File

@ -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

View File

@ -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<const __m512i *>(filt_pos)), zero64, _MM_CMPINT_GT);
{
uint64_t mask = _mm512_cmp_epi8_mask(_mm512_loadu_si512(reinterpret_cast<const __m512i *>(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;

View File

@ -310,7 +310,6 @@ ColumnPtr ColumnVector<T>::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<T>::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<const __m512i *>(filt_pos)), zero64, _MM_CMPINT_GT);
if (0xFFFFFFFFFFFFFFFF == mask)
@ -339,7 +338,7 @@ ColumnPtr ColumnVector<T>::filter(const IColumn::Filter & filt, ssize_t result_s
mask = _blsr_u64(mask);
#else
mask = mask & (mask-1);
#endif
#endif
}
}

View File

@ -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<const __m512i *>(filt_pos)), zero_vec, _MM_CMPINT_GT);
{
uint64_t mask = _mm512_cmp_epi8_mask(_mm512_loadu_si512(reinterpret_cast<const __m512i *>(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<const __m256i *>(filt_pos)), zero_vec));
uint32_t mask = _mm256_movemask_epi8(_mm256_cmpgt_epi8(_mm256_loadu_si256(reinterpret_cast<const __m256i *>(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;