aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/core/Helpers.h
diff options
context:
space:
mode:
authorGian Marco Iodice <gianmarco.iodice@arm.com>2019-03-15 10:13:05 +0000
committerGian Marco Iodice <gianmarco.iodice@arm.com>2019-03-20 11:21:46 +0000
commitb0c5037d94ba7073ccabb0ebaff54db320f184c4 (patch)
tree126f2332df60b6eff1e630b2585b2bd407501a20 /arm_compute/core/Helpers.h
parent5ed7b5bc98feb848874730c9bb9c30759e58d453 (diff)
downloadComputeLibrary-b0c5037d94ba7073ccabb0ebaff54db320f184c4.tar.gz
COMPMID-2043: Add support for "dummy threads" in CLGEMMReshaped
Change-Id: I89403b97503fbb99f6a32f5d62b8c535ab26a7be Signed-off-by: Gian Marco Iodice <gianmarco.iodice@arm.com> Reviewed-on: https://review.mlplatform.org/c/877 Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute/core/Helpers.h')
-rw-r--r--arm_compute/core/Helpers.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/arm_compute/core/Helpers.h b/arm_compute/core/Helpers.h
index 91d85be086..c7c7110ef5 100644
--- a/arm_compute/core/Helpers.h
+++ b/arm_compute/core/Helpers.h
@@ -756,6 +756,34 @@ inline T wrap_around(T x, T m)
{
return x >= 0 ? x % m : (x % m + m) % m;
}
+
+/** Given an integer value, this function returns the next power of two
+ *
+ * @param[in] x Input value
+ *
+ * @return the next power of two
+ */
+inline unsigned int get_next_power_two(unsigned int x)
+{
+ // Decrement by 1
+ x--;
+
+ // Shift right by 1
+ x |= x >> 1u;
+ // Shift right by 2
+ x |= x >> 2u;
+ // Shift right by 4
+ x |= x >> 4u;
+ // Shift right by 8
+ x |= x >> 8u;
+ // Shift right by 16
+ x |= x >> 16u;
+
+ // Increment by 1
+ x++;
+
+ return x;
+}
} // namespace arm_compute
#include "arm_compute/core/Helpers.inl"