diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/cpu/kernels/CpuMulKernel.cpp (renamed from src/core/cpu/kernels/CpuPixelWiseMultiplicationKernel.cpp) | 24 | ||||
-rw-r--r-- | src/core/cpu/kernels/CpuMulKernel.h (renamed from src/core/cpu/kernels/CpuPixelWiseMultiplicationKernel.h) | 53 | ||||
-rw-r--r-- | src/core/gpu/cl/kernels/ClMulKernel.cpp (renamed from src/core/gpu/cl/kernels/ClPixelWiseMultiplicationKernel.cpp) | 18 | ||||
-rw-r--r-- | src/core/gpu/cl/kernels/ClMulKernel.h (renamed from src/core/gpu/cl/kernels/ClPixelWiseMultiplicationKernel.h) | 50 |
4 files changed, 48 insertions, 97 deletions
diff --git a/src/core/cpu/kernels/CpuPixelWiseMultiplicationKernel.cpp b/src/core/cpu/kernels/CpuMulKernel.cpp index 91b7552ecf..dabf656e6e 100644 --- a/src/core/cpu/kernels/CpuPixelWiseMultiplicationKernel.cpp +++ b/src/core/cpu/kernels/CpuMulKernel.cpp @@ -21,7 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "src/core/cpu/kernels/CpuPixelWiseMultiplicationKernel.h" +#include "src/core/cpu/kernels/CpuMulKernel.h" #include "arm_compute/core/ITensor.h" #include "arm_compute/core/TensorInfo.h" @@ -1475,7 +1475,7 @@ void mul_U8_S16_S16(const ITensor *src1, const ITensor *src2, ITensor *out, cons } } // namespace -void CpuPixelWiseMultiplicationKernel::configure(ITensorInfo *src1, ITensorInfo *src2, ITensorInfo *dst, float scale, ConvertPolicy overflow_policy, RoundingPolicy rounding_policy) +void CpuMulKernel::configure(ITensorInfo *src1, ITensorInfo *src2, ITensorInfo *dst, float scale, ConvertPolicy overflow_policy, RoundingPolicy rounding_policy) { ARM_COMPUTE_UNUSED(rounding_policy); ARM_COMPUTE_ERROR_ON_NULLPTR(src1, src2, dst); @@ -1623,8 +1623,8 @@ void CpuPixelWiseMultiplicationKernel::configure(ITensorInfo *src1, ITensorInfo ICpuKernel::configure(win); } -Status CpuPixelWiseMultiplicationKernel::validate(const ITensorInfo *src1, const ITensorInfo *src2, const ITensorInfo *dst, float scale, ConvertPolicy overflow_policy, - RoundingPolicy rounding_policy) +Status CpuMulKernel::validate(const ITensorInfo *src1, const ITensorInfo *src2, const ITensorInfo *dst, float scale, ConvertPolicy overflow_policy, + RoundingPolicy rounding_policy) { ARM_COMPUTE_ERROR_ON_NULLPTR(src1, src2, dst); ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(src1, src2, dst, scale, overflow_policy, rounding_policy)); @@ -1632,7 +1632,7 @@ Status CpuPixelWiseMultiplicationKernel::validate(const ITensorInfo *src1, const return Status{}; } -void CpuPixelWiseMultiplicationKernel::run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) +void CpuMulKernel::run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) { ARM_COMPUTE_UNUSED(info); ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this); @@ -1656,9 +1656,9 @@ void CpuPixelWiseMultiplicationKernel::run_op(ITensorPack &tensors, const Window (*_func_float)(src1, src2, dst, window, _scale); } } -const char *CpuPixelWiseMultiplicationKernel::name() const +const char *CpuMulKernel::name() const { - return "CpuPixelWiseMultiplicationKernel"; + return "CpuMulKernel"; } namespace { @@ -1682,7 +1682,7 @@ Status validate_arguments_complex(const ITensorInfo *src1, const ITensorInfo *sr } } // namespace -void CpuComplexPixelWiseMultiplicationKernel::configure(ITensorInfo *src1, ITensorInfo *src2, ITensorInfo *dst) +void CpuComplexMulKernel::configure(ITensorInfo *src1, ITensorInfo *src2, ITensorInfo *dst) { ARM_COMPUTE_ERROR_ON_NULLPTR(src1, src2, dst); ARM_COMPUTE_ERROR_THROW_ON(validate_arguments_complex(src1, src2, dst)); @@ -1699,7 +1699,7 @@ void CpuComplexPixelWiseMultiplicationKernel::configure(ITensorInfo *src1, ITens ICpuKernel::configure(win); } -Status CpuComplexPixelWiseMultiplicationKernel::validate(const ITensorInfo *src1, const ITensorInfo *src2, const ITensorInfo *dst) +Status CpuComplexMulKernel::validate(const ITensorInfo *src1, const ITensorInfo *src2, const ITensorInfo *dst) { ARM_COMPUTE_ERROR_ON_NULLPTR(src1, src2, dst); ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments_complex(src1, src2, dst)); @@ -1707,7 +1707,7 @@ Status CpuComplexPixelWiseMultiplicationKernel::validate(const ITensorInfo *src1 return Status{}; } -void CpuComplexPixelWiseMultiplicationKernel::run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) +void CpuComplexMulKernel::run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) { ARM_COMPUTE_UNUSED(info); ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this); @@ -1720,9 +1720,9 @@ void CpuComplexPixelWiseMultiplicationKernel::run_op(ITensorPack &tensors, const c_mul_F32_F32_F32_n(src1, src2, dst, window); } -const char *CpuComplexPixelWiseMultiplicationKernel::name() const +const char *CpuComplexMulKernel::name() const { - return "CpuComplexPixelWiseMultiplicationKernel"; + return "CpuComplexMulKernel"; } } // namespace kernels } // namespace cpu diff --git a/src/core/cpu/kernels/CpuPixelWiseMultiplicationKernel.h b/src/core/cpu/kernels/CpuMulKernel.h index 567f08d06e..3e667bc4be 100644 --- a/src/core/cpu/kernels/CpuPixelWiseMultiplicationKernel.h +++ b/src/core/cpu/kernels/CpuMulKernel.h @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef ARM_COMPUTE_CPU_PIXELWISE_MULTIPLICATION_KERNEL_H -#define ARM_COMPUTE_CPU_PIXELWISE_MULTIPLICATION_KERNEL_H +#ifndef ARM_COMPUTE_CPU_MUL_KERNEL_H +#define ARM_COMPUTE_CPU_MUL_KERNEL_H #include "src/core/common/Macros.h" #include "src/core/cpu/ICpuKernel.h" @@ -33,13 +33,13 @@ namespace cpu { namespace kernels { -/** Interface for the kernel to perform addition between two tensors */ -class CpuPixelWiseMultiplicationKernel : public ICpuKernel +/** Interface for the kernel to perform multiplication between two tensors */ +class CpuMulKernel : public ICpuKernel { public: /** Default constructor */ - CpuPixelWiseMultiplicationKernel() = default; - ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(CpuPixelWiseMultiplicationKernel); + CpuMulKernel() = default; + ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(CpuMulKernel); /** Initialise the kernel's input, dst and border mode. * * Valid configurations (Src1,Src2) -> Dst : @@ -69,32 +69,9 @@ public: * @param[in] rounding_policy Rounding policy. */ void configure(ITensorInfo *src1, ITensorInfo *src2, ITensorInfo *dst, float scale, ConvertPolicy overflow_policy, RoundingPolicy rounding_policy); - /** Static function to check if given info will lead to a valid configuration of @ref CpuPixelWiseMultiplicationKernel + /** Static function to check if given info will lead to a valid configuration * - * Valid configurations (Src1,Src2) -> Dst : - * Support: Broadcast? Scale=1/255? - * - (U8,U8) -> U8, S16 N Y - * - (U8,S16) -> S16 N Y - * - (S16,U8) -> S16 N Y - * - (S16,S16) -> S16 N Y - * - (S32,S32) -> S32 Y N - * - (F16,F16) -> F16 N Y - * - (F32,F32) -> F32 Y Y - * - (QASYMM8,QASYMM8) -> QASYMM8 Y Y - * - (QASYMM8_SIGNED,QASYMM8_SIGNED) -> QASYMM8_SIGNED Y Y - * - (QSYMM16,QSYMM16) -> QSYMM16, S32 N Y - * - * @note For @p scale equal to 1/255 only round to nearest even (implemented as round half up) is supported. - * For all other scale values only round to zero (implemented as round towards minus infinity) is supported. - * - * @param[in] src1 First src tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/S32/QSYMM16/F16/F32 - * @param[in] src2 Second src tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/S32/QSYMM16/F16/F32 - * @param[in] dst Dst tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/S32/QSYMM16/F16/F32 - * @param[in] scale Scale to apply after multiplication. - * Scale must be positive and its value must be either 1/255 or 1/2^n where n is between 0 and 15. - * If both @p src1, @p src2 and @p dst are of datatype S32, scale cannot be 1/255 - * @param[in] overflow_policy Overflow policy. ConvertPolicy cannot be WRAP if any of the srcs is of quantized datatype - * @param[in] rounding_policy Rounding policy. + * Similar to @ref CpuMulKernel::configure() * * @return a status */ @@ -142,12 +119,12 @@ private: }; /** Interface for the complex pixelwise multiplication kernel. */ -class CpuComplexPixelWiseMultiplicationKernel : public ICpuKernel +class CpuComplexMulKernel : public ICpuKernel { public: /** Default constructor */ - CpuComplexPixelWiseMultiplicationKernel() = default; - ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(CpuComplexPixelWiseMultiplicationKernel); + CpuComplexMulKernel() = default; + ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(CpuComplexMulKernel); /** Initialise the kernel's src, dst and border mode. * * @param[in] src1 An src tensor. Data types supported: F32. Number of channels supported: 2 (complex tensor). @@ -155,11 +132,9 @@ public: * @param[out] dst The dst tensor, Data types supported: same as @p src1. Number of channels supported: same as @p src1. */ void configure(ITensorInfo *src1, ITensorInfo *src2, ITensorInfo *dst); - /** Static function to check if given info will lead to a valid configuration of @ref CpuComplexPixelWiseMultiplicationKernel + /** Static function to check if given info will lead to a valid configuration * - * @param[in] src1 An src tensor info. Data types supported: F32. Number of channels supported: 2 (complex tensor). - * @param[in] src2 An src tensor info. Data types supported: same as @p src1. Number of channels supported: same as @p src1. - * @param[in] dst The dst tensor info. Data types supported: same as @p src1. Number of channels supported: same as @p src1. + * Similar to @ref CpuComplexMulKernel::configure() * * @return a status */ @@ -172,4 +147,4 @@ public: } // namespace kernels } // namespace cpu } // namespace arm_compute -#endif /*ARM_COMPUTE_CPU_PIXELWISE_MULTIPLICATION_KERNEL_H */ +#endif /* ARM_COMPUTE_CPU_MUL_KERNEL_H */ diff --git a/src/core/gpu/cl/kernels/ClPixelWiseMultiplicationKernel.cpp b/src/core/gpu/cl/kernels/ClMulKernel.cpp index 5aed824d2c..837324ede2 100644 --- a/src/core/gpu/cl/kernels/ClPixelWiseMultiplicationKernel.cpp +++ b/src/core/gpu/cl/kernels/ClMulKernel.cpp @@ -21,7 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "src/core/gpu/cl/kernels/ClPixelWiseMultiplicationKernel.h" +#include "src/core/gpu/cl/kernels/ClMulKernel.h" #include "arm_compute/core/CL/CLHelpers.h" #include "arm_compute/core/CL/CLKernelLibrary.h" @@ -92,8 +92,8 @@ Status validate_arguments(const ITensorInfo *src1, const ITensorInfo *src2, cons } } // namespace -void ClPixelWiseMultiplicationKernel::configure(const CLCompileContext &compile_context, ITensorInfo *src1, ITensorInfo *src2, ITensorInfo *dst, float scale, - ConvertPolicy overflow_policy, RoundingPolicy rounding_policy, const ActivationLayerInfo &act_info) +void ClMulKernel::configure(const CLCompileContext &compile_context, ITensorInfo *src1, ITensorInfo *src2, ITensorInfo *dst, float scale, + ConvertPolicy overflow_policy, RoundingPolicy rounding_policy, const ActivationLayerInfo &act_info) { ARM_COMPUTE_ERROR_ON_NULLPTR(src1, src2, dst); ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(src1, src2, dst, @@ -228,8 +228,8 @@ void ClPixelWiseMultiplicationKernel::configure(const CLCompileContext &compile_ _config_id += support::cpp11::to_string(dst->dimension(2)); } -Status ClPixelWiseMultiplicationKernel::validate(const ITensorInfo *src1, const ITensorInfo *src2, const ITensorInfo *dst, float scale, - ConvertPolicy overflow_policy, RoundingPolicy rounding_policy, const ActivationLayerInfo &act_info) +Status ClMulKernel::validate(const ITensorInfo *src1, const ITensorInfo *src2, const ITensorInfo *dst, float scale, + ConvertPolicy overflow_policy, RoundingPolicy rounding_policy, const ActivationLayerInfo &act_info) { ARM_COMPUTE_ERROR_ON_NULLPTR(src1, src2, dst); ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(src1, src2, dst, scale, overflow_policy, rounding_policy, act_info)); @@ -237,7 +237,7 @@ Status ClPixelWiseMultiplicationKernel::validate(const ITensorInfo *src1, const return Status{}; } -void ClPixelWiseMultiplicationKernel::run_op(ITensorPack &tensors, const Window &window, cl::CommandQueue &queue) +void ClMulKernel::run_op(ITensorPack &tensors, const Window &window, cl::CommandQueue &queue) { ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this); ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(ICLKernel::window(), window); @@ -311,7 +311,7 @@ Status validate_arguments_complex(const ITensorInfo *src1, const ITensorInfo *sr } } // namespace -void ClComplexPixelWiseMultiplicationKernel::configure(const CLCompileContext &compile_context, ITensorInfo *src1, ITensorInfo *src2, ITensorInfo *dst, const ActivationLayerInfo &act_info) +void ClComplexMulKernel::configure(const CLCompileContext &compile_context, ITensorInfo *src1, ITensorInfo *src2, ITensorInfo *dst, const ActivationLayerInfo &act_info) { ARM_COMPUTE_ERROR_ON_NULLPTR(src1, src2, dst); ARM_COMPUTE_ERROR_THROW_ON(validate_arguments_complex(src1, src2, dst, act_info)); @@ -339,7 +339,7 @@ void ClComplexPixelWiseMultiplicationKernel::configure(const CLCompileContext &c ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } -Status ClComplexPixelWiseMultiplicationKernel::validate(const ITensorInfo *src1, const ITensorInfo *src2, const ITensorInfo *dst, const ActivationLayerInfo &act_info) +Status ClComplexMulKernel::validate(const ITensorInfo *src1, const ITensorInfo *src2, const ITensorInfo *dst, const ActivationLayerInfo &act_info) { ARM_COMPUTE_ERROR_ON_NULLPTR(src1, src2, dst); ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments_complex(src1, src2, dst, act_info)); @@ -347,7 +347,7 @@ Status ClComplexPixelWiseMultiplicationKernel::validate(const ITensorInfo *src1, return Status{}; } -void ClComplexPixelWiseMultiplicationKernel::run_op(ITensorPack &tensors, const Window &window, cl::CommandQueue &queue) +void ClComplexMulKernel::run_op(ITensorPack &tensors, const Window &window, cl::CommandQueue &queue) { ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this); ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(ICLKernel::window(), window); diff --git a/src/core/gpu/cl/kernels/ClPixelWiseMultiplicationKernel.h b/src/core/gpu/cl/kernels/ClMulKernel.h index 5b827262a1..e2e54a836e 100644 --- a/src/core/gpu/cl/kernels/ClPixelWiseMultiplicationKernel.h +++ b/src/core/gpu/cl/kernels/ClMulKernel.h @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef ARM_COMPUTE_CLPIXELWISEMULTIPLICATIONKERNEL_H -#define ARM_COMPUTE_CLPIXELWISEMULTIPLICATIONKERNEL_H +#ifndef ARM_COMPUTE_CL_MUL_KERNEL_H +#define ARM_COMPUTE_CL_MUL_KERNEL_H #include "src/core/common/Macros.h" #include "src/core/gpu/cl/ClCompileContext.h" @@ -35,12 +35,12 @@ namespace opencl namespace kernels { /** Interface for the pixelwise multiplication kernel. */ -class ClPixelWiseMultiplicationKernel : public IClKernel +class ClMulKernel : public IClKernel { public: /** Default constructor */ - ClPixelWiseMultiplicationKernel() = default; - ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(ClPixelWiseMultiplicationKernel); + ClMulKernel() = default; + ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(ClMulKernel); /** Initialise the kernel's src and dst. * * Valid configurations (Input1,Input2) -> Output : @@ -69,30 +69,9 @@ public: */ void configure(const CLCompileContext &compile_context, ITensorInfo *src1, ITensorInfo *src2, ITensorInfo *dst, float scale, ConvertPolicy overflow_policy, RoundingPolicy rounding_policy, const ActivationLayerInfo &act_info = ActivationLayerInfo()); - /** Static function to check if given info will lead to a valid configuration of @ref ClPixelWiseMultiplicationKernel + /** Static function to check if given info will lead to a valid configuration * - * Valid configurations (Input1,Input2) -> Output : - * - * - (U8,U8) -> U8 - * - (U8,U8) -> S16 - * - (U8,S16) -> S16 - * - (S16,U8) -> S16 - * - (S16,S16) -> S16 - * - (F16,F16) -> F16 - * - (F32,F32) -> F32 - * - (QASYMM8,QASYMM8) -> QASYMM8 - * - (QASYMM8_SIGNED,QASYMM8_SIGNED) -> QASYMM8_SIGNED - * - (QSYMM16,QSYMM16) -> QSYMM16 - * - (QSYMM16,QSYMM16) -> S32 - * - * @param[in] src1 An src tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/F32. - * @param[in] src2 An src tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/F32. - * @param[in] dst The dst tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/F32. - * @param[in] scale Scale to apply after multiplication. - * Scale must be positive and its value must be either 1/255 or 1/2^n where n is between 0 and 15. - * @param[in] overflow_policy Overflow policy. Supported overflow policies: Wrap, Saturate - * @param[in] rounding_policy Rounding policy. Supported rounding modes: to zero, to nearest even. - * @param[in] act_info (Optional) Activation layer information in case of a fused activation. + * Similar to @ref ClMulKernel::configure() * * @return a status */ @@ -104,12 +83,12 @@ public: }; /** Interface for the complex pixelwise multiplication kernel. */ -class ClComplexPixelWiseMultiplicationKernel : public ICLKernel +class ClComplexMulKernel : public ICLKernel { public: /** Default constructor */ - ClComplexPixelWiseMultiplicationKernel() = default; - ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(ClComplexPixelWiseMultiplicationKernel); + ClComplexMulKernel() = default; + ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(ClComplexMulKernel); /** Initialise the kernel's src and dst. * * @param[in] compile_context The compile context to be used. @@ -119,12 +98,9 @@ public: * @param[in] act_info (Optional) Activation layer information in case of a fused activation. */ void configure(const CLCompileContext &compile_context, ITensorInfo *src1, ITensorInfo *src2, ITensorInfo *dst, const ActivationLayerInfo &act_info = ActivationLayerInfo()); - /** Static function to check if given info will lead to a valid configuration of @ref ClComplexPixelWiseMultiplicationKernel + /** Static function to check if given info will lead to a valid configuration * - * @param[in] src1 An src tensor info. Data types supported: F32. Number of channels supported: 2. - * @param[in] src2 An src tensor info. Data types supported: same as @p src1. Number of channels supported: same as @p src1. - * @param[in] dst The dst tensor info. Data types supported: same as @p src1. Number of channels supported: same as @p src1. - * @param[in] act_info (Optional) Activation layer information in case of a fused activation. + * Similar to @ref ClComplexMulKernel::configure() * * @return a status */ @@ -136,4 +112,4 @@ public: } // namespace kernels } // namespace opencl } // namespace arm_compute -#endif /*ARM_COMPUTE_CLPIXELWISEMULTIPLICATIONKERNEL_H */ +#endif /* ARM_COMPUTE_CL_MUL_KERNEL_H */ |