From 4e2bbbbb23e6f4bd452f7f865e51228e1f51efec Mon Sep 17 00:00:00 2001 From: Pablo Marquez Tello Date: Mon, 9 Jan 2023 17:21:01 +0000 Subject: Add support for dilation > 1 in assembly DepthwiseConvolution * Resolve COMPMID-5689 Change-Id: I81a3791ad054db59562b76d1c729f2b2168aee8b Signed-off-by: Pablo Marquez Tello Signed-off-by: Andrew Mundy Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8919 Reviewed-by: Jakub Sujak Reviewed-by: Viet-Hoa Do Tested-by: Arm Jenkins Comments-Addressed: Arm Jenkins Benchmark: Arm Jenkins --- .../NEON/kernels/assembly/depthwise_common.hpp | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'src/core/NEON/kernels/assembly/depthwise_common.hpp') diff --git a/src/core/NEON/kernels/assembly/depthwise_common.hpp b/src/core/NEON/kernels/assembly/depthwise_common.hpp index 52963ab357..fea6326897 100644 --- a/src/core/NEON/kernels/assembly/depthwise_common.hpp +++ b/src/core/NEON/kernels/assembly/depthwise_common.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Arm Limited. + * Copyright (c) 2021-2023 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -26,6 +26,8 @@ #include "arm_gemm.hpp" #include "common.hpp" +#include +#include namespace arm_conv { @@ -64,6 +66,9 @@ class IDepthwiseCommon public: virtual ~IDepthwiseCommon() = default; + // Get the name of the depthwise implementation + virtual std::string name() const = 0; + // Determine the amount of storage space required for the rearranged weights // and bias. virtual size_t get_storage_size(void) const = 0; @@ -127,5 +132,25 @@ public: unsigned int n_threads) const = 0; }; +// To handle a dilation factor of D execute the kernel once for each d in +// [0..D). Each `d` corresponds to a portion or "view" of the input and output +// tensors. The output view corresponds to every Dth pixel starting from `d`; +// this function computes how many pixels are covered. The input view consists +// of an amount of before padding, every Dth pixel starting from an offset, and +// some after padding. This function computes the start padding, input offset, +// number of valid input pixels, and the after padding. +// +// Returns +// - Number of valid output pixels corresponding to `d` +// - Number of valid input pixels corresponding to `d` +// - Offset of the first pixel corresponding to `d` +// - Amount of padding in the view for `d` +std::tuple +get_reduced_view_for_dilation( + size_t out_size, size_t in_size, + size_t d, size_t dilation_factor, + size_t kernel_size, size_t stride, + size_t pad_before); + } // namespace depthwise } // namespace arm_conv -- cgit v1.2.1