remove vectorization from binary arithmetic

This commit is contained in:
Dmitrii Kovalkov 2020-05-28 13:39:48 +02:00
parent 71fabcedc4
commit cdb353856d
2 changed files with 6 additions and 78 deletions

View File

@ -54,8 +54,11 @@ namespace ErrorCodes
extern const int CANNOT_ADD_DIFFERENT_AGGREGATE_STATES;
}
DECLARE_MULTITARGET_CODE(
/** Arithmetic operations: +, -, *, /, %,
* intDiv (integer division)
* Bitwise operations: |, &, ^, ~.
* Etc.
*/
template <typename A, typename B, typename Op, typename ResultType_ = typename Op::ResultType>
struct BinaryOperationImplBase
{
@ -86,79 +89,6 @@ struct BinaryOperationImplBase
}
};
) // DECLARE_MULTITARGET_CODE
/** Arithmetic operations: +, -, *, /, %,
* intDiv (integer division)
* Bitwise operations: |, &, ^, ~.
* Etc.
*/
template <typename A, typename B, typename Op, typename ResultType_ = typename Op::ResultType>
struct BinaryOperationImplBase
{
using ResultType = ResultType_;
static const constexpr bool allow_fixed_string = false;
static void vectorVector(const A * __restrict a, const B * __restrict b, ResultType * __restrict c, size_t size)
{
#if USE_MULTITARGET_CODE
if (IsArchSupported(TargetArch::AVX512F))
TargetSpecific::AVX512F::BinaryOperationImplBase<A, B, Op, ResultType>::vectorVector(a, b, c, size);
else if (IsArchSupported(TargetArch::AVX2))
TargetSpecific::AVX2::BinaryOperationImplBase<A, B, Op, ResultType>::vectorVector(a, b, c, size);
else if (IsArchSupported(TargetArch::AVX))
TargetSpecific::AVX::BinaryOperationImplBase<A, B, Op, ResultType>::vectorVector(a, b, c, size);
else if (IsArchSupported(TargetArch::SSE42))
TargetSpecific::SSE42::BinaryOperationImplBase<A, B, Op, ResultType>::vectorVector(a, b, c, size);
else
TargetSpecific::Default::BinaryOperationImplBase<A, B, Op, ResultType>::vectorVector(a, b, c, size);
#else
TargetSpecific::Default::BinaryOperationImplBase<A, B, Op, ResultType>::vectorVector(a, b, c, size);
#endif
}
static void vectorConstant(const A * __restrict a, B b, ResultType * __restrict c, size_t size)
{
#if USE_MULTITARGET_CODE
if (IsArchSupported(TargetArch::AVX512F))
TargetSpecific::AVX512F::BinaryOperationImplBase<A, B, Op, ResultType>::vectorConstant(a, b, c, size);
else if (IsArchSupported(TargetArch::AVX2))
TargetSpecific::AVX2::BinaryOperationImplBase<A, B, Op, ResultType>::vectorConstant(a, b, c, size);
else if (IsArchSupported(TargetArch::AVX))
TargetSpecific::AVX::BinaryOperationImplBase<A, B, Op, ResultType>::vectorConstant(a, b, c, size);
else if (IsArchSupported(TargetArch::SSE42))
TargetSpecific::SSE42::BinaryOperationImplBase<A, B, Op, ResultType>::vectorConstant(a, b, c, size);
else
TargetSpecific::Default::BinaryOperationImplBase<A, B, Op, ResultType>::vectorConstant(a, b, c, size);
#else
TargetSpecific::Default::BinaryOperationImplBase<A, B, Op, ResultType>::vectorConstant(a, b, c, size);
#endif
}
static void constantVector(A a, const B * __restrict b, ResultType * __restrict c, size_t size)
{
#if USE_MULTITARGET_CODE
if (IsArchSupported(TargetArch::AVX512F))
TargetSpecific::AVX512F::BinaryOperationImplBase<A, B, Op, ResultType>::constantVector(a, b, c, size);
else if (IsArchSupported(TargetArch::AVX2))
TargetSpecific::AVX2::BinaryOperationImplBase<A, B, Op, ResultType>::constantVector(a, b, c, size);
else if (IsArchSupported(TargetArch::AVX))
TargetSpecific::AVX::BinaryOperationImplBase<A, B, Op, ResultType>::constantVector(a, b, c, size);
else if (IsArchSupported(TargetArch::SSE42))
TargetSpecific::SSE42::BinaryOperationImplBase<A, B, Op, ResultType>::constantVector(a, b, c, size);
else
TargetSpecific::Default::BinaryOperationImplBase<A, B, Op, ResultType>::constantVector(a, b, c, size);
#else
TargetSpecific::Default::BinaryOperationImplBase<A, B, Op, ResultType>::constantVector(a, b, c, size);
#endif
}
static ResultType constantConstant(A a, B b)
{
return Op::template apply<ResultType>(a, b);
}
};
template <typename Op>
struct FixedStringOperationImpl

View File

@ -1,6 +1,4 @@
<!-- <test max_ignored_relative_change="0.4">
TODO(dakovalkov): uncomment this -->
<test>
<test max_ignored_relative_change="0.4">
<settings>
<max_memory_usage>30000000000</max_memory_usage>
</settings>