diff options
author | Sang-Hoon Park <sang-hoon.park@arm.com> | 2021-01-18 14:20:27 +0000 |
---|---|---|
committer | Georgios Pinitas <georgios.pinitas@arm.com> | 2021-01-22 22:37:10 +0000 |
commit | 63001acdefa6c62b5e8b08ceda529bc119483c5a (patch) | |
tree | 9a341eeee1028860973664540b44570041be1f75 /src/core | |
parent | 360f576603680ebd8a2d535da0ac6ffe9fac507f (diff) | |
download | ComputeLibrary-63001acdefa6c62b5e8b08ceda529bc119483c5a.tar.gz |
Rename functions/classes for elementwise operations
* Create CpuElementwise operator
* Rename kernel classes
* Make the kernels stateless
Partially implements: COMPMID-4003
Change-Id: I4ef9c61a3acc3ac5dbe46463d62dcb88a5face21
Signed-off-by: Sang-Hoon Park <sang-hoon.park@arm.com>
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4881
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Sheri Zhang <sheri.zhang@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/NEON/NEKernels.h | 1 | ||||
-rw-r--r-- | src/core/cpu/kernels/CpuElementwiseKernel.cpp (renamed from src/core/NEON/kernels/NEElementwiseOperationKernel.cpp) | 165 | ||||
-rw-r--r-- | src/core/cpu/kernels/CpuElementwiseKernel.h (renamed from src/core/NEON/kernels/NEElementwiseOperationKernel.h) | 105 | ||||
-rw-r--r-- | src/core/cpu/kernels/elementwise/neon/elementwise_list.h (renamed from src/core/NEON/kernels/elementwise/impl/elementwise_list.h) | 0 | ||||
-rw-r--r-- | src/core/cpu/kernels/elementwise/neon/elementwise_quantized_list.h (renamed from src/core/NEON/kernels/elementwise/impl/elementwise_quantized_list.h) | 2 | ||||
-rw-r--r-- | src/core/cpu/kernels/elementwise/sve/elementwise_list.h (renamed from src/core/SVE/kernels/elementwise/impl/elementwise_list.h) | 0 | ||||
-rw-r--r-- | src/core/cpu/kernels/elementwise/sve/elementwise_quantized_list.h (renamed from src/core/SVE/kernels/elementwise/impl/elementwise_quantized_list.h) | 2 |
7 files changed, 156 insertions, 119 deletions
diff --git a/src/core/NEON/NEKernels.h b/src/core/NEON/NEKernels.h index a678a86e4c..c009a6d3af 100644 --- a/src/core/NEON/NEKernels.h +++ b/src/core/NEON/NEKernels.h @@ -54,7 +54,6 @@ #include "src/core/NEON/kernels/NEDilateKernel.h" #include "src/core/NEON/kernels/NEDirectConvolutionLayerKernel.h" #include "src/core/NEON/kernels/NEDirectConvolutionLayerOutputStageKernel.h" -#include "src/core/NEON/kernels/NEElementwiseOperationKernel.h" #include "src/core/NEON/kernels/NEElementwiseUnaryKernel.h" #include "src/core/NEON/kernels/NEErodeKernel.h" #include "src/core/NEON/kernels/NEFFTDigitReverseKernel.h" diff --git a/src/core/NEON/kernels/NEElementwiseOperationKernel.cpp b/src/core/cpu/kernels/CpuElementwiseKernel.cpp index b250465e14..ab915b9d72 100644 --- a/src/core/NEON/kernels/NEElementwiseOperationKernel.cpp +++ b/src/core/cpu/kernels/CpuElementwiseKernel.cpp @@ -21,16 +21,16 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "src/core/NEON/kernels/NEElementwiseOperationKernel.h" +#include "src/core/cpu/kernels/CpuElementwiseKernel.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/IAccessWindow.h" #include "src/core/CPP/Validate.h" -#include "src/core/NEON/kernels/elementwise/impl/elementwise_list.h" -#include "src/core/NEON/kernels/elementwise/impl/elementwise_quantized_list.h" -#include "src/core/SVE/kernels/elementwise/impl/elementwise_list.h" -#include "src/core/SVE/kernels/elementwise/impl/elementwise_quantized_list.h" #include "src/core/common/Registrars.h" +#include "src/core/cpu/kernels/elementwise/neon/elementwise_list.h" +#include "src/core/cpu/kernels/elementwise/neon/elementwise_quantized_list.h" +#include "src/core/cpu/kernels/elementwise/sve/elementwise_list.h" +#include "src/core/cpu/kernels/elementwise/sve/elementwise_quantized_list.h" #include "src/core/helpers/AutoConfiguration.h" #include "src/core/helpers/WindowHelpers.h" @@ -38,10 +38,14 @@ namespace arm_compute { +namespace cpu +{ +namespace kernels +{ namespace { using ElementwiseSelector = std::add_pointer<bool(DataType)>::type; -using UKernelType = NEElementwiseOperationKernel::ElementwiseFunction; +using UKernelType = CpuElementwiseKernel::ElementwiseFunction; struct ElementwiseKernel { const char *name; @@ -154,12 +158,7 @@ configure_comp_func(const ITensorInfo *input1, const ITensorInfo *input2, ITenso } } // namespace -NEElementwiseOperationKernel::NEElementwiseOperationKernel() - : _function(nullptr), _input1(nullptr), _input2(nullptr), _output(nullptr) -{ -} - -Status NEElementwiseOperationKernel::validate_arguments_common(const ITensorInfo &input1, const ITensorInfo &input2, const ITensorInfo &output) +Status CpuElementwiseKernel::validate_arguments_common(const ITensorInfo &input1, const ITensorInfo &input2, const ITensorInfo &output) { ARM_COMPUTE_RETURN_ERROR_ON_CPU_F16_UNSUPPORTED(&input1); ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(&input1, &input2); @@ -178,7 +177,7 @@ Status NEElementwiseOperationKernel::validate_arguments_common(const ITensorInfo return Status{}; } -void NEElementwiseOperationKernel::configure_common(const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output) +void CpuElementwiseKernel::configure_common(const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output) { ARM_COMPUTE_ERROR_ON_NULLPTR(input1, input2, output); @@ -192,45 +191,33 @@ void NEElementwiseOperationKernel::configure_common(const ITensorInfo *input1, c Window win = calculate_max_window(valid_region); - INEKernel::configure(win); + ICpuKernel::configure(win); } -void NEElementwiseOperationKernel::run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) +void CpuElementwiseKernel::run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) { ARM_COMPUTE_UNUSED(info, window); ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this); - ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(INEKernel::window(), window); - ARM_COMPUTE_ERROR_ON(_function == nullptr); - _function(tensors.get_const_tensor(TensorType::ACL_SRC_0), - tensors.get_const_tensor(TensorType::ACL_SRC_1), - tensors.get_tensor(TensorType::ACL_DST), window); + ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(ICpuKernel::window(), window); + + auto src0 = tensors.get_const_tensor(TensorType::ACL_SRC_0); + auto src1 = tensors.get_const_tensor(TensorType::ACL_SRC_1); + auto dst = tensors.get_tensor(TensorType::ACL_DST); + + auto function = get_implementation(src0->info(), src1->info(), dst->info()); + ARM_COMPUTE_ERROR_ON(function == nullptr); + function(src0, src1, dst, window); } /** Arithmetic operators (min, max, squared_diff) */ -void NEArithmeticOperationKernel::configure(ArithmeticOperation op, const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output) +void CpuArithmeticKernel::configure(ArithmeticOperation op, const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output) { ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(*input1, *input2, *output)); configure_common(input1, input2, output); - switch(op) - { - case ArithmeticOperation::MAX: - _function = configure_arithm_func<ArithmeticOperation::MAX>(input1, input2, output); - break; - case ArithmeticOperation::MIN: - _function = configure_arithm_func<ArithmeticOperation::MIN>(input1, input2, output); - break; - case ArithmeticOperation::SQUARED_DIFF: - _function = configure_arithm_func<ArithmeticOperation::SQUARED_DIFF>(input1, input2, output); - break; - case ArithmeticOperation::PRELU: - _function = configure_arithm_func<ArithmeticOperation::PRELU>(input1, input2, output); - break; - default: - ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); - } + _op = op; } -Status NEArithmeticOperationKernel::validate_arguments(const ITensorInfo &input1, const ITensorInfo &input2, const ITensorInfo &output) +Status CpuArithmeticKernel::validate_arguments(const ITensorInfo &input1, const ITensorInfo &input2, const ITensorInfo &output) { ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(&input1, 1, DataType::QASYMM8, DataType::QASYMM8_SIGNED, DataType::S16, DataType::F16, DataType::S32, DataType::F32); // Validate in case of configured output @@ -241,7 +228,7 @@ Status NEArithmeticOperationKernel::validate_arguments(const ITensorInfo &input1 return validate_arguments_common(input1, input2, output); } -Status NEArithmeticOperationKernel::validate(ArithmeticOperation op, const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output) +Status CpuArithmeticKernel::validate(ArithmeticOperation op, const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output) { ARM_COMPUTE_UNUSED(op); ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input1, input2, output); @@ -249,22 +236,45 @@ Status NEArithmeticOperationKernel::validate(ArithmeticOperation op, const ITens return Status{}; } +std::function<CpuElementwiseKernel::ElementwiseFunction> +CpuArithmeticKernel::get_implementation(const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output) +{ + switch(_op) + { + case ArithmeticOperation::MAX: + return configure_arithm_func<ArithmeticOperation::MAX>(input1, input2, output); + case ArithmeticOperation::MIN: + return configure_arithm_func<ArithmeticOperation::MIN>(input1, input2, output); + case ArithmeticOperation::SQUARED_DIFF: + return configure_arithm_func<ArithmeticOperation::SQUARED_DIFF>(input1, input2, output); + case ArithmeticOperation::PRELU: + return configure_arithm_func<ArithmeticOperation::PRELU>(input1, input2, output); + case ArithmeticOperation::DIV: + return configure_arithm_func<ArithmeticOperation::DIV>(input1, input2, output); + case ArithmeticOperation::POWER: + return configure_arithm_func<ArithmeticOperation::POWER>(input1, input2, output); + default: + ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); + } + return nullptr; +} + /** The division operator */ -void NEDivisionOperationKernel::configure(const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output) +void CpuDivisionKernel::configure(const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output) { ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(*input1, *input2, *output)); configure_common(input1, input2, output); - _function = configure_arithm_func<ArithmeticOperation::DIV>(input1, input2, output); + _op = ArithmeticOperation::DIV; } -Status NEDivisionOperationKernel::validate_arguments(const ITensorInfo &input1, const ITensorInfo &input2, const ITensorInfo &output) +Status CpuDivisionKernel::validate_arguments(const ITensorInfo &input1, const ITensorInfo &input2, const ITensorInfo &output) { ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(&input1, 1, DataType::S32, DataType::F16, DataType::F32); - return NEArithmeticOperationKernel::validate_arguments(input1, input2, output); + return CpuArithmeticKernel::validate_arguments(input1, input2, output); } -Status NEDivisionOperationKernel::validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output) +Status CpuDivisionKernel::validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output) { ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input1, input2, output); ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(*input1, *input2, *output)); @@ -272,20 +282,20 @@ Status NEDivisionOperationKernel::validate(const ITensorInfo *input1, const ITen } /** The power operator */ -void NEPowerOperationKernel::configure(const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output) +void CpuPowerKernel::configure(const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output) { ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(*input1, *input2, *output)); configure_common(input1, input2, output); - _function = configure_arithm_func<ArithmeticOperation::POWER>(input1, input2, output); + _op = ArithmeticOperation::POWER; } -Status NEPowerOperationKernel::validate_arguments(const ITensorInfo &input1, const ITensorInfo &input2, const ITensorInfo &output) +Status CpuPowerKernel::validate_arguments(const ITensorInfo &input1, const ITensorInfo &input2, const ITensorInfo &output) { ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(&input1, 1, DataType::F16, DataType::F32); - return NEArithmeticOperationKernel::validate_arguments(input1, input2, output); + return CpuArithmeticKernel::validate_arguments(input1, input2, output); } -Status NEPowerOperationKernel::validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output) +Status CpuPowerKernel::validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output) { ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input1, input2, output); ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(*input1, *input2, *output)); @@ -293,36 +303,14 @@ Status NEPowerOperationKernel::validate(const ITensorInfo *input1, const ITensor } /** Comparison operators (equal, not equal, less than, greater than, less than or equal, greater than or equal) */ -void NEComparisonOperationKernel::configure(ComparisonOperation op, const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output) +void CpuComparisonKernel::configure(ComparisonOperation op, const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output) { ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(*input1, *input2, *output)); configure_common(input1, input2, output); - switch(op) - { - case ComparisonOperation::Equal: - _function = configure_comp_func<ComparisonOperation::Equal>(input1, input2, output); - break; - case ComparisonOperation::NotEqual: - _function = configure_comp_func<ComparisonOperation::NotEqual>(input1, input2, output); - break; - case ComparisonOperation::Greater: - _function = configure_comp_func<ComparisonOperation::Greater>(input1, input2, output); - break; - case ComparisonOperation::GreaterEqual: - _function = configure_comp_func<ComparisonOperation::GreaterEqual>(input1, input2, output); - break; - case ComparisonOperation::Less: - _function = configure_comp_func<ComparisonOperation::Less>(input1, input2, output); - break; - case ComparisonOperation::LessEqual: - _function = configure_comp_func<ComparisonOperation::LessEqual>(input1, input2, output); - break; - default: - ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); - } + _op = op; } -Status NEComparisonOperationKernel::validate_arguments(const ITensorInfo &input1, const ITensorInfo &input2, const ITensorInfo &output) +Status CpuComparisonKernel::validate_arguments(const ITensorInfo &input1, const ITensorInfo &input2, const ITensorInfo &output) { ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(&input1, 1, DataType::U8, DataType::QASYMM8, DataType::QASYMM8_SIGNED, DataType::S16, DataType::F16, DataType::S32, DataType::F32); // Validate in case of configured output @@ -333,11 +321,36 @@ Status NEComparisonOperationKernel::validate_arguments(const ITensorInfo &input1 return validate_arguments_common(input1, input2, output); } -Status NEComparisonOperationKernel::validate(ComparisonOperation op, const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output) +Status CpuComparisonKernel::validate(ComparisonOperation op, const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output) { ARM_COMPUTE_UNUSED(op); ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input1, input2, output); ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(*input1, *input2, *output)); return Status{}; } + +std::function<CpuElementwiseKernel::ElementwiseFunction> +CpuComparisonKernel::get_implementation(const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output) +{ + switch(_op) + { + case ComparisonOperation::Equal: + return configure_comp_func<ComparisonOperation::Equal>(input1, input2, output); + case ComparisonOperation::NotEqual: + return configure_comp_func<ComparisonOperation::NotEqual>(input1, input2, output); + case ComparisonOperation::Greater: + return configure_comp_func<ComparisonOperation::Greater>(input1, input2, output); + case ComparisonOperation::GreaterEqual: + return configure_comp_func<ComparisonOperation::GreaterEqual>(input1, input2, output); + case ComparisonOperation::Less: + return configure_comp_func<ComparisonOperation::Less>(input1, input2, output); + case ComparisonOperation::LessEqual: + return configure_comp_func<ComparisonOperation::LessEqual>(input1, input2, output); + default: + ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); + } + return nullptr; +} +} // namespace kernels +} // namespace cpu } // namespace arm_compute diff --git a/src/core/NEON/kernels/NEElementwiseOperationKernel.h b/src/core/cpu/kernels/CpuElementwiseKernel.h index b0037d357f..92cf880172 100644 --- a/src/core/NEON/kernels/NEElementwiseOperationKernel.h +++ b/src/core/cpu/kernels/CpuElementwiseKernel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020 Arm Limited. + * Copyright (c) 2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -21,41 +21,35 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef ARM_COMPUTE_NEELEMENTWISEOPERATIONKERNEL_H -#define ARM_COMPUTE_NEELEMENTWISEOPERATIONKERNEL_H +#ifndef ARM_COMPUTE_CPU_ELEMENTWISE_KERNEL_H +#define ARM_COMPUTE_CPU_ELEMENTWISE_KERNEL_H -#include "arm_compute/core/Types.h" -#include "src/core/NEON/INEKernel.h" +#include "src/core/common/Macros.h" +#include "src/core/cpu/ICpuKernel.h" namespace arm_compute { class ITensor; - +namespace cpu +{ +namespace kernels +{ /** Interface for an element-wise operation kernel * * Element-wise operation is computed by: * @f[ output(x,y) = OP(input1(x,y), input2(x,y))@f] * */ -class NEElementwiseOperationKernel : public INEKernel +class CpuElementwiseKernel : public ICpuKernel { public: const char *name() const override { - return "NEElementwiseOperationKernel"; + return "CpuElementwiseKernel"; } - /** Default constructor */ - NEElementwiseOperationKernel(); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - NEElementwiseOperationKernel(const NEElementwiseOperationKernel &) = delete; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - NEElementwiseOperationKernel &operator=(const NEElementwiseOperationKernel &) = delete; - /** Allow instances of this class to be moved */ - NEElementwiseOperationKernel(NEElementwiseOperationKernel &&) = default; - /** Allow instances of this class to be moved */ - NEElementwiseOperationKernel &operator=(NEElementwiseOperationKernel &&) = default; - /** Default destructor */ - ~NEElementwiseOperationKernel() = default; + + CpuElementwiseKernel() = default; + ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(CpuElementwiseKernel); /** Common signature for all the specialised arithmetic functions * @@ -64,7 +58,7 @@ public: * @param[out] output Output tensor info. Data types supported: Dependent on subclass. * @param[in] window Region on which to execute the kernel. */ - using ElementwiseFunction = void(const ITensor *input1, const ITensor *input2, ITensor *output, const Window &window); + using ElementwiseFunction = void(const ITensor *, const ITensor *, ITensor *, const Window &); // Inherited methods overridden: void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) override; @@ -83,19 +77,22 @@ protected: */ void configure_common(const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output); - /** Function to use for the particular tensor types passed to configure() */ - std::function<void(const ITensor *input1, const ITensor *input2, ITensor *output, const Window &window)> _function; - - const ITensor *_input1; - const ITensor *_input2; - ITensor *_output; + /** Function to get the micro kernel implementation + * + * @param[in] input1 First input tensor information + * @param[in] input2 Second input tensor information + * @param[in] output Output tensor information + * + * @return the function instance for the micro kernel + */ + virtual std::function<ElementwiseFunction> get_implementation(const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output) = 0; }; -class NEArithmeticOperationKernel : public NEElementwiseOperationKernel +class CpuArithmeticKernel : public CpuElementwiseKernel { public: /** Default constructor */ - NEArithmeticOperationKernel() = default; + CpuArithmeticKernel() = default; /** Configure kernel * @@ -106,7 +103,7 @@ public: */ void configure(ArithmeticOperation op, const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output); - /** Static function to check if given info will lead to a valid configuration of @ref NEArithmeticOperationKernel + /** Static function to check if given info will lead to a valid configuration of @ref cpu::kernels::CpuArithmeticKernel * * @param[in] op Arithmetic operation to be executed. * @param[in] input1 First tensor input info. Data types supported: QASYMM8/S16/F16/S32/F32. @@ -120,13 +117,26 @@ public: protected: // Inherited methods overridden: static Status validate_arguments(const ITensorInfo &input1, const ITensorInfo &input2, const ITensorInfo &output); + + ArithmeticOperation _op{}; + +private: + /** Function to get the micro kernel implementation + * + * @param[in] input1 First input tensor information + * @param[in] input2 Second input tensor information + * @param[in] output Output tensor information + * + * @return the function instance for the micro kernel + */ + std::function<ElementwiseFunction> get_implementation(const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output) override; }; -class NEDivisionOperationKernel : public NEArithmeticOperationKernel +class CpuDivisionKernel : public CpuArithmeticKernel { public: /** Default constructor */ - NEDivisionOperationKernel() = default; + CpuDivisionKernel() = default; /** Configure kernel * @@ -136,7 +146,7 @@ public: */ void configure(const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output); - /** Static function to check if given info will lead to a valid configuration of @ref NEDivisionOperationKernel + /** Static function to check if given info will lead to a valid configuration of @ref CpuDivisionKernel * * @param[in] input1 First tensor input info. Data types supported: S32/F16/F32. * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1. @@ -151,11 +161,11 @@ protected: static Status validate_arguments(const ITensorInfo &input1, const ITensorInfo &input2, const ITensorInfo &output); }; -class NEPowerOperationKernel : public NEArithmeticOperationKernel +class CpuPowerKernel : public CpuArithmeticKernel { public: /** Default constructor */ - NEPowerOperationKernel() = default; + CpuPowerKernel() = default; /** Configure kernel * @@ -165,7 +175,7 @@ public: */ void configure(const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output); - /** Static function to check if given info will lead to a valid configuration of @ref NEPowerOperationKernel + /** Static function to check if given info will lead to a valid configuration of @ref CpuPowerKernel * * @param[in] input1 First tensor input info. Data types supported: F16/F32. * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1. @@ -180,11 +190,11 @@ protected: static Status validate_arguments(const ITensorInfo &input1, const ITensorInfo &input2, const ITensorInfo &output); }; -class NEComparisonOperationKernel : public NEElementwiseOperationKernel +class CpuComparisonKernel : public CpuElementwiseKernel { public: /** Default constructor */ - NEComparisonOperationKernel() = default; + CpuComparisonKernel() = default; /** Configure kernel * @@ -195,7 +205,7 @@ public: */ void configure(ComparisonOperation op, const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output); - /** Static function to check if given info will lead to a valid configuration of @ref NEComparisonOperationKernel + /** Static function to check if given info will lead to a valid configuration of @ref cpu::kernels::CpuComparisonKernel * * @param[in] op Comparison operation to be executed. * @param[in] input1 First tensor input info. Data types supported: QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. @@ -209,6 +219,21 @@ public: protected: // Inherited methods overridden: static Status validate_arguments(const ITensorInfo &input1, const ITensorInfo &input2, const ITensorInfo &output); + +private: + /** Function to get the micro kernel implementation + * + * @param[in] input1 First input tensor information + * @param[in] input2 Second input tensor information + * @param[in] output Output tensor information + * + * @return the function instance for the micro kernel + */ + std::function<ElementwiseFunction> get_implementation(const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output) override; + + ComparisonOperation _op{}; }; +} // namespace kernels +} // namespace cpu } // namespace arm_compute -#endif /* ARM_COMPUTE_NEELEMENTWISEOPERATIONKERNEL_H */ +#endif /* ARM_COMPUTE_CPU_ELEMENTWISE_KERNEL_H */
\ No newline at end of file diff --git a/src/core/NEON/kernels/elementwise/impl/elementwise_list.h b/src/core/cpu/kernels/elementwise/neon/elementwise_list.h index 43e44be5e2..43e44be5e2 100644 --- a/src/core/NEON/kernels/elementwise/impl/elementwise_list.h +++ b/src/core/cpu/kernels/elementwise/neon/elementwise_list.h diff --git a/src/core/NEON/kernels/elementwise/impl/elementwise_quantized_list.h b/src/core/cpu/kernels/elementwise/neon/elementwise_quantized_list.h index fd1fb002ad..1ff4632f5c 100644 --- a/src/core/NEON/kernels/elementwise/impl/elementwise_quantized_list.h +++ b/src/core/cpu/kernels/elementwise/neon/elementwise_quantized_list.h @@ -24,7 +24,7 @@ #ifndef SRC_CORE_NEON_KERNELS_ELEMENTWISE_QUANTIZED_LIST_H #define SRC_CORE_NEON_KERNELS_ELEMENTWISE_QUANTIZED_LIST_H -#include "src/core/NEON/kernels/elementwise/impl/elementwise_list.h" +#include "src/core/cpu/kernels/elementwise/neon/elementwise_list.h" namespace arm_compute { diff --git a/src/core/SVE/kernels/elementwise/impl/elementwise_list.h b/src/core/cpu/kernels/elementwise/sve/elementwise_list.h index 83c3355de4..83c3355de4 100644 --- a/src/core/SVE/kernels/elementwise/impl/elementwise_list.h +++ b/src/core/cpu/kernels/elementwise/sve/elementwise_list.h diff --git a/src/core/SVE/kernels/elementwise/impl/elementwise_quantized_list.h b/src/core/cpu/kernels/elementwise/sve/elementwise_quantized_list.h index e85b0891f5..b6342c727c 100644 --- a/src/core/SVE/kernels/elementwise/impl/elementwise_quantized_list.h +++ b/src/core/cpu/kernels/elementwise/sve/elementwise_quantized_list.h @@ -26,7 +26,7 @@ #if defined(__ARM_FEATURE_SVE2) -#include "src/core/SVE/kernels/elementwise/impl/elementwise_list.h" +#include "src/core/cpu/kernels/elementwise/sve/elementwise_list.h" namespace arm_compute { |