From 1a4ae04ed1918352864909c955da93b435f0ef9b Mon Sep 17 00:00:00 2001 From: Viet-Hoa Do Date: Wed, 16 Aug 2023 14:14:39 +0100 Subject: Fix depthwise convolution not using assembly kernel * Take dilation into account when checking padding. Resolves: COMPMID-6348 Signed-off-by: Viet-Hoa Do Change-Id: I897a13ba7f37382733c35c1701d1ec310ed55331 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/10147 Reviewed-by: SiCong Li Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins Benchmark: Arm Jenkins --- .../kernels/internal/CpuDepthwiseConv2dAssemblyWrapperKernel.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cpu/kernels/internal/CpuDepthwiseConv2dAssemblyWrapperKernel.cpp b/src/cpu/kernels/internal/CpuDepthwiseConv2dAssemblyWrapperKernel.cpp index e092c836af..b503a8b734 100644 --- a/src/cpu/kernels/internal/CpuDepthwiseConv2dAssemblyWrapperKernel.cpp +++ b/src/cpu/kernels/internal/CpuDepthwiseConv2dAssemblyWrapperKernel.cpp @@ -306,11 +306,15 @@ Status CpuDepthwiseConv2dAssemblyWrapperKernel::validate(const ITensorInfo *src, // Assembly kernels cannot work with padding greater than the kernel. const auto &padding = info.pad_stride_info; + const auto &dilation = info.dilation; const auto &wei_shape = weights->tensor_shape(); + const auto dilated_wei_w = wei_shape[1] + (wei_shape[1] - 1) * (dilation.x() - 1); + const auto dilated_wei_h = wei_shape[2] + (wei_shape[2] - 1) * (dilation.y() - 1); + ARM_COMPUTE_RETURN_ERROR_ON( - padding.pad_top() >= wei_shape[2] || padding.pad_bottom() >= wei_shape[2] || - padding.pad_left() >= wei_shape[1] || padding.pad_right() >= wei_shape[1] + padding.pad_left() >= dilated_wei_w || padding.pad_right() >= dilated_wei_w || + padding.pad_top() >= dilated_wei_h || padding.pad_bottom() >= dilated_wei_h ); return Status{}; -- cgit v1.2.1