You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
update
This commit is contained in:
@ -119,6 +119,24 @@ inline int compareBlock(const void* a, const void* b)
|
|||||||
return ((*(T*)a) - (*(T*)b));
|
return ((*(T*)a) - (*(T*)b));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class To, class From>
|
||||||
|
std::enable_if_t<
|
||||||
|
sizeof(To) == sizeof(From) &&
|
||||||
|
std::is_trivially_copyable_v<From> &&
|
||||||
|
std::is_trivially_copyable_v<To>,
|
||||||
|
To>
|
||||||
|
// constexpr support needs compiler magic
|
||||||
|
bitCast(const From& src) noexcept
|
||||||
|
{
|
||||||
|
static_assert(std::is_trivially_constructible_v<To>,
|
||||||
|
"This implementation additionally requires "
|
||||||
|
"destination type to be trivially constructible");
|
||||||
|
|
||||||
|
To dst;
|
||||||
|
std::memcpy(&dst, &src, sizeof(To));
|
||||||
|
return dst;
|
||||||
|
}
|
||||||
|
|
||||||
// this function is out-of-band, we don't need to inline it
|
// this function is out-of-band, we don't need to inline it
|
||||||
void logIt(int mid, int arg1, const string& arg2 = string())
|
void logIt(int mid, int arg1, const string& arg2 = string())
|
||||||
{
|
{
|
||||||
@ -925,7 +943,7 @@ inline void writeColValue(uint8_t OutputType, ColResultHeader* out, uint16_t rid
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__x86_64__) || defined(__aarch64__)
|
#if defined(__x86_64__)|| defined(__aarch64__)
|
||||||
template <typename T, ENUM_KIND KIND, bool HAS_INPUT_RIDS,
|
template <typename T, ENUM_KIND KIND, bool HAS_INPUT_RIDS,
|
||||||
typename std::enable_if<HAS_INPUT_RIDS == false, T>::type* = nullptr>
|
typename std::enable_if<HAS_INPUT_RIDS == false, T>::type* = nullptr>
|
||||||
inline void vectUpdateMinMax(const bool validMinMax, const bool isNonNullOrEmpty, T& Min, T& Max, T curValue,
|
inline void vectUpdateMinMax(const bool validMinMax, const bool isNonNullOrEmpty, T& Min, T& Max, T curValue,
|
||||||
@ -1222,7 +1240,7 @@ void scalarFiltering(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__x86_64__) || defined(__aarch64__)
|
#if defined(__x86_64__)|| defined(__aarch64__)
|
||||||
template <typename VT, typename SIMD_WRAPPER_TYPE, bool HAS_INPUT_RIDS, typename T,
|
template <typename VT, typename SIMD_WRAPPER_TYPE, bool HAS_INPUT_RIDS, typename T,
|
||||||
typename std::enable_if<HAS_INPUT_RIDS == false, T>::type* = nullptr>
|
typename std::enable_if<HAS_INPUT_RIDS == false, T>::type* = nullptr>
|
||||||
inline SIMD_WRAPPER_TYPE simdDataLoad(VT& processor, const T* srcArray, const T* origSrcArray,
|
inline SIMD_WRAPPER_TYPE simdDataLoad(VT& processor, const T* srcArray, const T* origSrcArray,
|
||||||
@ -1278,13 +1296,19 @@ inline SIMD_WRAPPER_TYPE simdSwapedOrderDataLoad(const ColRequestHeaderDataType
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename VT, typename SimdType>
|
template <typename VT, typename SimdType>
|
||||||
void vectorizedUpdateMinMax(const bool validMinMax, const MT nonNullOrEmptyMask, VT& simdProcessor,
|
void vectorizedUpdateMinMax(const bool validMinMax, const MT nonNullOrEmptyMask, VT simdProcessor,
|
||||||
SimdType& dataVec, SimdType& simdMin, SimdType& simdMax)
|
SimdType& dataVec, SimdType& simdMin, SimdType& simdMax)
|
||||||
{
|
{
|
||||||
if (validMinMax && nonNullOrEmptyMask)
|
if (validMinMax)
|
||||||
{
|
{
|
||||||
simdMin = simdProcessor.min(simdMin, dataVec);
|
simdMin = simdProcessor.blend(
|
||||||
simdMax = simdProcessor.max(simdMax, dataVec);
|
simdMin, dataVec,
|
||||||
|
simdProcessor.bwAnd(simdProcessor.cmpGt2(simdMin, dataVec),
|
||||||
|
bitCast<SimdType>(simd::bitMaskToByteMask16(nonNullOrEmptyMask))));
|
||||||
|
simdMax = simdProcessor.blend(
|
||||||
|
simdMax, dataVec,
|
||||||
|
simdProcessor.bwAnd(simdProcessor.cmpGt2(dataVec, simdMax),
|
||||||
|
bitCast<SimdType>(simd::bitMaskToByteMask16(nonNullOrEmptyMask))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1305,7 +1329,7 @@ void scalarUpdateMinMax(const bool validMinMax, const MT nonNullOrEmptyMask, VT&
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, typename VT, typename SimdType>
|
template<typename T, typename VT, typename SimdType>
|
||||||
void extractMinMax(VT& simdProcessor, SimdType& simdMin, SimdType& simdMax, T& min, T& max)
|
void extractMinMax(VT& simdProcessor, SimdType simdMin, SimdType simdMax, T& min, T& max)
|
||||||
{
|
{
|
||||||
constexpr const uint16_t size = VT::vecByteSize / sizeof(T);
|
constexpr const uint16_t size = VT::vecByteSize / sizeof(T);
|
||||||
T* simdMinVec = reinterpret_cast<T*>(&simdMin);
|
T* simdMinVec = reinterpret_cast<T*>(&simdMin);
|
||||||
@ -1313,6 +1337,13 @@ void extractMinMax(VT& simdProcessor, SimdType& simdMin, SimdType& simdMax, T& m
|
|||||||
max = *std::max_element(simdMaxVec, simdMaxVec + size);
|
max = *std::max_element(simdMaxVec, simdMaxVec + size);
|
||||||
min = *std::min_element(simdMinVec, simdMinVec + size);
|
min = *std::min_element(simdMinVec, simdMinVec + size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T, typename VT, typename SimdType>
|
||||||
|
void getInitialSimdMinMax(VT& simdProcessor, SimdType& simdMin, SimdType& simdMax, T min, T max)
|
||||||
|
{
|
||||||
|
simdMin = simdProcessor.loadValue(min);
|
||||||
|
simdMax = simdProcessor.loadValue(max);
|
||||||
|
}
|
||||||
// This routine filters input block in a vectorized manner.
|
// This routine filters input block in a vectorized manner.
|
||||||
// It supports all output types, all input types.
|
// It supports all output types, all input types.
|
||||||
// It doesn't support KIND==TEXT so upper layers filters this KIND out beforehand.
|
// It doesn't support KIND==TEXT so upper layers filters this KIND out beforehand.
|
||||||
@ -1448,9 +1479,12 @@ void vectorizedFiltering(NewColRequestHeader* in, ColResultHeader* out, const T*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[[maybe_unused]] SimdType simdMin = simdDataLoad<VT, SimdWrapperType, HAS_INPUT_RIDS, T>(simdProcessor, srcArray,
|
[[maybe_unused]] SimdType simdMin;
|
||||||
origSrcArray, ridArray, 0).v;;
|
[[maybe_unused]] SimdType simdMax;
|
||||||
[[maybe_unused]] SimdType simdMax = simdMin;
|
if constexpr (KIND != KIND_TEXT)
|
||||||
|
{
|
||||||
|
getInitialSimdMinMax(simdProcessor, simdMin, simdMax, min, max);
|
||||||
|
}
|
||||||
// main loop
|
// main loop
|
||||||
// writeMask tells which values must get into the result. Includes values that matches filters. Can have
|
// writeMask tells which values must get into the result. Includes values that matches filters. Can have
|
||||||
// NULLs. nonEmptyMask tells which vector coords are not EMPTY magics. nonNullMask tells which vector coords
|
// NULLs. nonEmptyMask tells which vector coords are not EMPTY magics. nonNullMask tells which vector coords
|
||||||
@ -1671,7 +1705,7 @@ void filterColumnData(NewColRequestHeader* in, ColResultHeader* out, uint16_t* r
|
|||||||
// Syscat queries mustn't follow vectorized processing path b/c PP must return
|
// Syscat queries mustn't follow vectorized processing path b/c PP must return
|
||||||
// all values w/o any filter(even empty values filter) applied.
|
// all values w/o any filter(even empty values filter) applied.
|
||||||
|
|
||||||
#if defined(__x86_64__) || defined(__aarch64__)
|
#if defined(__x86_64__)|| defined(__aarch64__)
|
||||||
// Don't use vectorized filtering for text based data types.
|
// Don't use vectorized filtering for text based data types.
|
||||||
if (WIDTH < 16 &&
|
if (WIDTH < 16 &&
|
||||||
(KIND != KIND_TEXT || (KIND == KIND_TEXT && in->colType.strnxfrmIsValid()) ))
|
(KIND != KIND_TEXT || (KIND == KIND_TEXT && in->colType.strnxfrmIsValid()) ))
|
||||||
@ -1903,4 +1937,4 @@ template void primitives::PrimitiveProcessor::columnScanAndFilter<int64_t>(NewCo
|
|||||||
template void primitives::PrimitiveProcessor::columnScanAndFilter<int128_t>(NewColRequestHeader*,
|
template void primitives::PrimitiveProcessor::columnScanAndFilter<int128_t>(NewColRequestHeader*,
|
||||||
ColResultHeader*);
|
ColResultHeader*);
|
||||||
|
|
||||||
} // namespace primitives
|
} // namespace primitives
|
Reference in New Issue
Block a user