From ebbae9411f1babe6bba9966ba83c540d11e77410 Mon Sep 17 00:00:00 2001 From: Dana Zlotnik Date: Thu, 3 Feb 2022 12:52:15 +0200 Subject: Decouple CpuDepthwiseConv2dNativeKernel Resolves COMPMID-4632 Change-Id: I5e2a9f0f7801a2afaa35de871ab29cd7238923fd Signed-off-by: Dana Zlotnik Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/7115 Tested-by: Arm Jenkins Reviewed-by: Giorgio Arena Comments-Addressed: Arm Jenkins --- src/cpu/kernels/CpuDepthwiseConv2dNativeKernel.h | 35 ++++++++++-------------- 1 file changed, 14 insertions(+), 21 deletions(-) (limited to 'src/cpu/kernels/CpuDepthwiseConv2dNativeKernel.h') diff --git a/src/cpu/kernels/CpuDepthwiseConv2dNativeKernel.h b/src/cpu/kernels/CpuDepthwiseConv2dNativeKernel.h index e23a0fac87..95835e6dcf 100644 --- a/src/cpu/kernels/CpuDepthwiseConv2dNativeKernel.h +++ b/src/cpu/kernels/CpuDepthwiseConv2dNativeKernel.h @@ -42,6 +42,10 @@ namespace kernels /** Interface for the kernel to run a depthwise convolution native on a tensor. */ class CpuDepthwiseConv2dNativeKernel : public ICpuKernel { +private: + using DepthwiseConv2dNativeKernelPtr = + std::add_pointer::type; + public: CpuDepthwiseConv2dNativeKernel() = default; ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(CpuDepthwiseConv2dNativeKernel); @@ -71,33 +75,22 @@ public: // Inherited methods overridden: void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) override; const char *name() const override; + struct DepthwiseConv2dNativeKernel + { + const char *name; + const DepthwiseConv2dNativeDataTypeISASelectorPtr is_selected; + DepthwiseConv2dNativeKernelPtr ukernel; + }; + static const std::vector &get_available_kernels(); private: - template - using FloatEnalber = typename std::enable_if::value, int>::type; - - template = 0> - void run_depthwise(const ITensor *src, const ITensor *weights, const ITensor *bias, ITensor *dst, const Window &window, bool has_biases); - - template - using Quantized8bitEnalber = typename std::enable_if < std::is_same::value || std::is_same::value, int >::type; - - template = 0> - void run_depthwise(const ITensor *src, const ITensor *weights, const ITensor *bias, ITensor *dst, const Window &window, bool has_biases); - /** Common signature for all the specialised depthwise convolution native functions * * @param[in] window Region on which to execute the kernel. */ - using DepthwiseFunctionPtr = void (CpuDepthwiseConv2dNativeKernel::*)(const ITensor *src, const ITensor *weights, const ITensor *bias, ITensor *dst, const Window &window, bool has_biases); - - DepthwiseFunctionPtr _func{ nullptr }; - PadStrideInfo _conv_info{}; - unsigned int _depth_multiplier{ 1 }; - Size2D _dilation{}; - std::vector _output_multiplier{}; - std::vector _output_shift{}; - bool _has_biases{ false }; + DepthwiseConv2dNativeKernelPtr _func{ nullptr }; + ConvolutionInfo _conv_info{}; + bool _has_biases{ false }; }; } // namespace kernels } // namespace cpu -- cgit v1.2.1