From d304adbb1c6a2f66144c9cac1104f6e3f30d255a Mon Sep 17 00:00:00 2001 From: Giorgio Arena Date: Fri, 2 Oct 2020 10:20:11 +0100 Subject: COMPMID-3703 Remove OpenCL padding: CLActivationLayerKernel + create utility macro Change-Id: I73edadc7299247e7bc51ae37c00d3709023da44a Signed-off-by: Giorgio Arena Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4073 Tested-by: Arm Jenkins Reviewed-by: Gian Marco Iodice Comments-Addressed: Arm Jenkins --- arm_compute/core/Utils.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'arm_compute/core/Utils.h') diff --git a/arm_compute/core/Utils.h b/arm_compute/core/Utils.h index 13c2971930..d2bc50c7c6 100644 --- a/arm_compute/core/Utils.h +++ b/arm_compute/core/Utils.h @@ -1322,6 +1322,30 @@ bool check_value_range(T val, DataType dt, QuantizationInfo qinfo = Quantization } } +/** Returns the adjusted vector size in case it is less than the input's first dimension, getting rounded down to its closest valid vector size + * + * @param[in] vec_size vector size to be adjusted + * @param[in] dim0 size of the first dimension + * + * @return the number of element processed along the X axis per thread + */ +inline unsigned int adjust_vec_size(unsigned int vec_size, size_t dim0) +{ + ARM_COMPUTE_ERROR_ON(vec_size > 16); + + if(dim0 == 3) + { + return dim0; + } + + while(vec_size > dim0) + { + vec_size >>= 1; + } + + return vec_size; +} + #ifdef ARM_COMPUTE_ASSERTS_ENABLED /** Print consecutive elements to an output stream. * -- cgit v1.2.1