From b0c5037d94ba7073ccabb0ebaff54db320f184c4 Mon Sep 17 00:00:00 2001 From: Gian Marco Iodice Date: Fri, 15 Mar 2019 10:13:05 +0000 Subject: COMPMID-2043: Add support for "dummy threads" in CLGEMMReshaped Change-Id: I89403b97503fbb99f6a32f5d62b8c535ab26a7be Signed-off-by: Gian Marco Iodice Reviewed-on: https://review.mlplatform.org/c/877 Reviewed-by: Michele Di Giorgio Tested-by: Arm Jenkins Reviewed-by: Georgios Pinitas Comments-Addressed: Arm Jenkins --- arm_compute/core/Helpers.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'arm_compute/core/Helpers.h') 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" -- cgit v1.2.1