aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/core/Utils.h
diff options
context:
space:
mode:
authorGiorgio Arena <giorgio.arena@arm.com>2020-10-02 10:20:11 +0100
committerGiorgio Arena <giorgio.arena@arm.com>2020-10-07 14:28:17 +0000
commitd304adbb1c6a2f66144c9cac1104f6e3f30d255a (patch)
tree325849f9280cfb0c92900794371d1c63d70a619c /arm_compute/core/Utils.h
parent1e75adac392dd979bd1a838583ed196e311bc77a (diff)
downloadComputeLibrary-d304adbb1c6a2f66144c9cac1104f6e3f30d255a.tar.gz
COMPMID-3703 Remove OpenCL padding: CLActivationLayerKernel + create utility macro
Change-Id: I73edadc7299247e7bc51ae37c00d3709023da44a Signed-off-by: Giorgio Arena <giorgio.arena@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4073 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute/core/Utils.h')
-rw-r--r--arm_compute/core/Utils.h24
1 files changed, 24 insertions, 0 deletions
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.
*