diff options
author | Michalis Spyrou <michalis.spyrou@arm.com> | 2020-06-18 10:14:57 +0100 |
---|---|---|
committer | Michalis Spyrou <michalis.spyrou@arm.com> | 2020-06-19 14:35:22 +0000 |
commit | ce0c67559cf03965acc8f212263a9f53205a0a3f (patch) | |
tree | c37105c72538108c46e5964cf49d15acd2d85980 /arm_compute/core | |
parent | 3be0b8c8d4e90bd264e9575dc2b6994ce8e14d50 (diff) | |
download | ComputeLibrary-ce0c67559cf03965acc8f212263a9f53205a0a3f.tar.gz |
COMPMID-3377: Async support to NEElementwiseUnaryLayerKernel kernels/functions
Signed-off-by: Michalis Spyrou <michalis.spyrou@arm.com>
Change-Id: I208287b44ece051e95f891d43a691cb0ac6e56c5
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3419
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute/core')
-rw-r--r-- | arm_compute/core/CPP/ICPPKernel.h | 2 | ||||
-rw-r--r-- | arm_compute/core/NEON/kernels/NEActivationLayerKernel.h | 2 | ||||
-rw-r--r-- | arm_compute/core/NEON/kernels/NEElementwiseOperationKernel.h | 47 | ||||
-rw-r--r-- | arm_compute/core/NEON/kernels/NEReshapeLayerKernel.h | 2 | ||||
-rw-r--r-- | arm_compute/core/experimental/Types.h | 26 |
5 files changed, 30 insertions, 49 deletions
diff --git a/arm_compute/core/CPP/ICPPKernel.h b/arm_compute/core/CPP/ICPPKernel.h index 3ec54756a0..45c7b52af4 100644 --- a/arm_compute/core/CPP/ICPPKernel.h +++ b/arm_compute/core/CPP/ICPPKernel.h @@ -84,7 +84,7 @@ public: * @param[in] window Region on which to execute the kernel. (Must be a region of the window returned by window()) * @param[in] info Info about executing thread and CPU. */ - virtual void run_op(const std::vector<InputTensor> &inputs, const std::vector<OutputTensor> &outputs, const Window &window, const ThreadInfo &info) + virtual void run_op(const InputTensorMap &inputs, const OutputTensorMap &outputs, const Window &window, const ThreadInfo &info) { ARM_COMPUTE_UNUSED(inputs, outputs, window, info); } diff --git a/arm_compute/core/NEON/kernels/NEActivationLayerKernel.h b/arm_compute/core/NEON/kernels/NEActivationLayerKernel.h index 399afa63c6..7064e3dc7c 100644 --- a/arm_compute/core/NEON/kernels/NEActivationLayerKernel.h +++ b/arm_compute/core/NEON/kernels/NEActivationLayerKernel.h @@ -76,7 +76,7 @@ public: static Status validate(const ITensorInfo *input, const ITensorInfo *output, const ActivationLayerInfo &act_info); // Inherited methods overridden: - void run_op(const std::vector<InputTensor> &inputs, const std::vector<OutputTensor> &outputs, + void run_op(const InputTensorMap &inputs, const OutputTensorMap &outputs, const Window &window, const ThreadInfo &info) override; private: diff --git a/arm_compute/core/NEON/kernels/NEElementwiseOperationKernel.h b/arm_compute/core/NEON/kernels/NEElementwiseOperationKernel.h index 61c25e1a2a..b109ddd0f8 100644 --- a/arm_compute/core/NEON/kernels/NEElementwiseOperationKernel.h +++ b/arm_compute/core/NEON/kernels/NEElementwiseOperationKernel.h @@ -57,18 +57,19 @@ public: /** Default destructor */ ~NEElementwiseOperationKernel() = default; - // Inherited methods overridden: - void run(const Window &window, const ThreadInfo &info) override; - /** Common signature for all the specialised arithmetic functions * - * @param[in] input1 First tensor input. Data types supported: QASYMM8/S16/F16/S32/F32. - * @param[in] input2 Second tensor input. Data types supported: Same as @p input1. - * @param[in] output Output tensor. Data types supported: Dependent on subclass. + * @param[in] input1 First tensor input info. Data types supported: QASYMM8/S16/F16/S32/F32. + * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1. + * @param[in] 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); + // Inherited methods overridden: + void run_op(const InputTensorMap &inputs, const OutputTensorMap &outputs, + const Window &window, const ThreadInfo &info) override; + protected: /** Validate the argument passed to the kernel * @@ -81,7 +82,7 @@ protected: /** Commmon configure function for element-wise operators with no additional options (e.g. Min, Max, SquaredDiff) * */ - void configure_common(const ITensor *input1, const ITensor *input2, ITensor *output); + 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; @@ -100,11 +101,11 @@ public: /** Static function to check if given info will lead to a valid configuration of @ref NEArithmeticOperationKernel * * @param[in] op Arithmetic operation to be executed. - * @param[in] input1 First tensor input. Data types supported: QASYMM8/S16/F16/S32/F32. - * @param[in] input2 Second tensor input. Data types supported: Same as @p input1. - * @param[in] output Output tensor. Data types supported: Same as @p input1. + * @param[in] input1 First tensor input info. Data types supported: QASYMM8/S16/F16/S32/F32. + * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1. + * @param[in] output Output tensor info. Data types supported: Same as @p input1. */ - void configure(ArithmeticOperation op, const ITensor *input1, const ITensor *input2, ITensor *output); + 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 * @@ -130,11 +131,11 @@ public: /** Static function to check if given info will lead to a valid configuration of @ref NEArithmeticOperationKernel * - * @param[in] input1 First tensor input. Data types supported: F16/F32. - * @param[in] input2 Second tensor input. Data types supported: Same as @p input1. - * @param[in] output Output tensor. Data types supported: Same as @p input1. + * @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. + * @param[in] output Output tensor info. Data types supported: Same as @p input1. */ - void configure(const ITensor *input1, const ITensor *input2, ITensor *output); + 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 NEArithmeticOperationKernel * @@ -159,11 +160,11 @@ public: /** Static function to check if given info will lead to a valid configuration of @ref NEArithmeticOperationKernel * - * @param[in] input1 First tensor input. Data types supported: F16/F32. - * @param[in] input2 Second tensor input. Data types supported: Same as @p input1. - * @param[out] output Output tensor. Data types supported: Same as @p input1. + * @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. + * @param[out] output Output tensor info. Data types supported: Same as @p input1. */ - void configure(const ITensor *input1, const ITensor *input2, ITensor *output); + 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 NEArithmeticOperationKernel * @@ -189,11 +190,11 @@ public: /** Static function to check if given info will lead to a valid configuration of @ref NEComparisonOperationKernel * * @param[in] op Comparison operation to be executed. - * @param[in] input1 First tensor input. Data types supported: QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. - * @param[in] input2 Second tensor input. Data types supported: Same as @p input1. - * @param[in] output Output tensor. Data types supported: U16/U32. + * @param[in] input1 First tensor input info. Data types supported: QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. + * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1. + * @param[in] output Output tensor info. Data types supported: U16/U32. */ - void configure(ComparisonOperation op, const ITensor *input1, const ITensor *input2, ITensor *output); + 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 * diff --git a/arm_compute/core/NEON/kernels/NEReshapeLayerKernel.h b/arm_compute/core/NEON/kernels/NEReshapeLayerKernel.h index 7a4dce128d..1ed3554db2 100644 --- a/arm_compute/core/NEON/kernels/NEReshapeLayerKernel.h +++ b/arm_compute/core/NEON/kernels/NEReshapeLayerKernel.h @@ -57,7 +57,7 @@ public: static Status validate(const ITensorInfo *input, const ITensorInfo *output); // Inherited methods overridden: - void run_op(const std::vector<InputTensor> &inputs, const std::vector<OutputTensor> &outputs, + void run_op(const InputTensorMap &inputs, const OutputTensorMap &outputs, const Window &window, const ThreadInfo &info) override; }; } // namespace arm_compute diff --git a/arm_compute/core/experimental/Types.h b/arm_compute/core/experimental/Types.h index 2b5591872a..62dd6ff305 100644 --- a/arm_compute/core/experimental/Types.h +++ b/arm_compute/core/experimental/Types.h @@ -50,29 +50,9 @@ enum class TensorType ACL_INT_2 = 52 }; -/** Input tensor aggregate */ -struct InputTensor -{ - InputTensor(TensorType type, const ITensor *tensor) - : type(type), tensor(tensor) - { - } - - TensorType type{ TensorType::ACL_UNKNOWN }; - const ITensor *tensor{ nullptr }; -}; -/** Output tensor aggregate */ -struct OutputTensor -{ - OutputTensor(TensorType type, ITensor *tensor) - : type(type), tensor(tensor) - { - } - - TensorType type{ TensorType::ACL_UNKNOWN }; - ITensor *tensor{ nullptr }; -}; -using OperatorTensor = OutputTensor; +using InputTensorMap = std::map<TensorType, const ITensor *>; +using OutputTensorMap = std::map<TensorType, ITensor *>; +using OperatorTensorMap = OutputTensorMap; namespace experimental { |