Force early exit of threads when output_height=1 and channels=1 in assembly pooling
authorMichele Di Giorgio <michele.digiorgio@arm.com>
Wed, 27 Jan 2021 16:22:05 +0000 (16:22 +0000)
committerTeresaARM <teresa.charlinreyes@arm.com>
Wed, 27 Jan 2021 17:40:01 +0000 (17:40 +0000)
Resolves COMPMID-4156, COMPMID-4125

Change-Id: I408e51e9759448e6190490975ccab2c1bc07a813
Signed-off-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4927
Reviewed-by: TeresaARM <teresa.charlinreyes@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
src/core/NEON/kernels/arm_conv/pooling/pooling_depthfirst_generic.hpp
src/core/NEON/kernels/arm_conv/pooling/pooling_depthfirst_generic_quantized.hpp

index 3a15b28d929de9c35939aa1936c171f94824961e..fa06a0078b44689512f9cc616280f71541cb61f9 100644 (file)
@@ -159,6 +159,12 @@ class PoolingDepthfirstGeneric : public PoolingCommon<typename strategy::operand
       end_out_height = output_height;
     }
 
+    if(start_channel >= end_channel)
+    {
+        // Early exit in case of multiple threads parallelising on channels
+        return;
+    }
+
     // Cast input and output pointers into the right types
     const TInput *const inptr = static_cast<const TInput *>(_input) + start_channel;
     TOutput *const outptr = static_cast<TOutput *>(_output) + start_channel;
index 9516042eed4945dc9d1de3c8c67601c73801e3d3..1f2891f814c779cd52c3824ca5785bcb5545f790 100644 (file)
@@ -160,6 +160,12 @@ class PoolingDepthfirstGenericQuantized : public PoolingCommon<typename strategy
       end_out_height = output_height;
     }
 
+    if(start_channel >= end_channel)
+    {
+        // Early exit in case of multiple threads parallelising on channels
+        return;
+    }
+
     // Cast input and output pointers into the right types
     const TInput *const inptr = static_cast<const TInput *>(_input) + start_channel;
     TOutput *const outptr = static_cast<TOutput *>(_output) + start_channel;