From 75eea338eb232ebdafa2fb84d22e711b5f964785 Mon Sep 17 00:00:00 2001 From: Sang-Hoon Park Date: Fri, 13 Nov 2020 13:44:13 +0000 Subject: COMPMID-3961: Add Logical OR/AND/NOT operator on CL Change-Id: I612aeed6affa17624fb9044964dd59c41a5c9888 Signed-off-by: Sang-Hoon Park Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4448 Reviewed-by: Pablo Marquez Tello Tested-by: Arm Jenkins Comments-Addressed: Arm Jenkins --- src/core/CL/kernels/CLElementwiseOperationKernel.h | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'src/core/CL/kernels/CLElementwiseOperationKernel.h') diff --git a/src/core/CL/kernels/CLElementwiseOperationKernel.h b/src/core/CL/kernels/CLElementwiseOperationKernel.h index 75030cf3a3..e24d1564a8 100644 --- a/src/core/CL/kernels/CLElementwiseOperationKernel.h +++ b/src/core/CL/kernels/CLElementwiseOperationKernel.h @@ -26,6 +26,7 @@ #include "arm_compute/core/Types.h" #include "src/core/CL/ICLKernel.h" +#include "src/core/KernelTypes.h" namespace arm_compute { @@ -99,6 +100,49 @@ private: ITensorInfo *_output; /**< Destination tensor info */ }; +class CLLogicalBinaryKernel : public CLElementwiseOperationKernel +{ +public: + /** Default constructor */ + CLLogicalBinaryKernel() = default; + /** Prevent instances of this class from being copied (As this class contains pointers) */ + CLLogicalBinaryKernel(const CLLogicalBinaryKernel &) = delete; + /** Prevent instances of this class from being copied (As this class contains pointers) */ + CLLogicalBinaryKernel &operator=(const CLLogicalBinaryKernel &) = delete; + /** Allow instances of this class to be moved */ + CLLogicalBinaryKernel(CLLogicalBinaryKernel &&) = default; + /** Allow instances of this class to be moved */ + CLLogicalBinaryKernel &operator=(CLLogicalBinaryKernel &&) = default; + /** Default destructor */ + ~CLLogicalBinaryKernel() = default; + /** Function to configure kernel + * + * @param[in] compile_context The compile context to be used. + * @param[in] op Logical binary operation to be executed. + * @param[in] input1 First tensor input info. Data types supported: U8. + * @param[in] input2 Second tensor input info. Data types supported: U8. + * @param[in] output Output tensor info. Data types supported: U8. + */ + void configure(const CLCompileContext &compile_context, kernels::LogicalOperation op, ITensorInfo *input1, ITensorInfo *input2, ITensorInfo *output); + /** Static function to check if the given configuration is valid for this kernel + * + * @param[in] op Logical binary operation to be executed. + * @param[in] input1 First tensor input info. Data types supported: U8. + * @param[in] input2 Second tensor input info. Data types supported: U8. + * @param[in] output Output tensor info. Data types supported: U8. + */ + static Status validate(kernels::LogicalOperation op, const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output); + +private: + // Inherited methods overridden: + std::string name() override; + std::pair validate_and_configure_window(ITensorInfo &input1, ITensorInfo &input2, ITensorInfo &output) override; + CLBuildOptions generate_build_options(const ITensorInfo &input1, const ITensorInfo &input2, const ITensorInfo &output) override; + std::string generate_id_for_tuning(const std::string &kernel_name, const ITensorInfo &input1, const ITensorInfo &output) override; + + kernels::LogicalOperation _op{ kernels::LogicalOperation::Unknown }; +}; + /** Addition operation */ class CLSaturatedArithmeticOperationKernel : public CLElementwiseOperationKernel { -- cgit v1.2.1