aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/CL
diff options
context:
space:
mode:
authorGian Marco Iodice <gianmarco.iodice@arm.com>2022-08-31 11:47:08 +0100
committerGian Marco Iodice <gianmarco.iodice@arm.com>2022-09-07 13:09:57 +0000
commit211a55d8218764c0a20d69d4cbdaea1906291c6b (patch)
treed8852d04cfefcd8868ad142449fa707adb6c1c03 /src/runtime/CL
parent13a2d003fd63e03d67ad28f608082126bf04046b (diff)
downloadComputeLibrary-211a55d8218764c0a20d69d4cbdaea1906291c6b.tar.gz
Optimize depthwise convolution on OpenCL
The optimization concerns the case where the depth multiplier is > 1. The depth multiplier for loop has been removed from the OpenCL kernel and the GWS has been mapped to the output shape. In this way, we can still perform a tile with N0 columns and improve the performance of depthwise conv over 80% when depth multiplier is > 1. Resolves COMPMID-5568 Change-Id: I604e287d4eeb31c54b9cc6c3072a698cd0e3e136 Signed-off-by: Gian Marco Iodice <gianmarco.iodice@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8184 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Gunes Bayir <gunes.bayir@arm.com> Benchmark: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/runtime/CL')
-rw-r--r--src/runtime/CL/functions/CLDepthwiseConvolutionLayer.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/runtime/CL/functions/CLDepthwiseConvolutionLayer.cpp b/src/runtime/CL/functions/CLDepthwiseConvolutionLayer.cpp
index e821726d0e..8546471fdd 100644
--- a/src/runtime/CL/functions/CLDepthwiseConvolutionLayer.cpp
+++ b/src/runtime/CL/functions/CLDepthwiseConvolutionLayer.cpp
@@ -54,19 +54,22 @@ bool export_weights_to_cl_image_heuristic(const ITensorInfo *weights, unsigned i
const size_t kernel_w = weights->tensor_shape()[idx_w];
const size_t kernel_h = weights->tensor_shape()[idx_h];
- if((kernel_w == 1) && (kernel_h == 1))
+ if(gpu_target == GPUTarget::G71 || get_arch_from_target(gpu_target) == GPUTarget::MIDGARD)
{
return false;
}
- if(depth_multiplier > 1)
+ if((kernel_w == 1) && (kernel_h == 1))
{
return false;
}
- if(gpu_target == GPUTarget::G71 || get_arch_from_target(gpu_target) == GPUTarget::MIDGARD)
+ if(depth_multiplier > 1)
{
- return false;
+ if((depth_multiplier % 4) != 0)
+ {
+ return false;
+ }
}
return true;
@@ -110,7 +113,18 @@ void initialize_dwc_native_compute_info(DWCComputeKernelInfo &dwc_compute_info,
}
else
{
- dwc_compute_info.n0 = 1;
+ if((depth_multiplier % 4) == 0)
+ {
+ dwc_compute_info.n0 = 4;
+ }
+ else if((depth_multiplier % 2) == 0)
+ {
+ dwc_compute_info.n0 = 2;
+ }
+ else
+ {
+ dwc_compute_info.n0 = 1;
+ }
}
dwc_compute_info.n0 = adjust_vec_size(dwc_compute_info.n0, weights->dimension(0));