diff --git a/source/ur/ur.hpp b/source/ur/ur.hpp index cf84bb437d..77c55a4b6f 100644 --- a/source/ur/ur.hpp +++ b/source/ur/ur.hpp @@ -351,28 +351,18 @@ template inline bool isPowerOf2(const T &Value) { static inline void roundToHighestFactorOfGlobalSizeIn3d( size_t *ThreadsPerBlock, const size_t *GlobalSize, const size_t *MaxBlockDim, const size_t MaxBlockSize, - const size_t WorkDim) { + const size_t) { ThreadsPerBlock[0] = std::min(GlobalSize[0], MaxBlockDim[0]); - // Make the X dim a factor of 2 - do { - roundToHighestFactorOfGlobalSize(ThreadsPerBlock[0], GlobalSize[0]); - } while (WorkDim == 3 && !isPowerOf2(ThreadsPerBlock[0]) && - ThreadsPerBlock[0] > 32 && --ThreadsPerBlock[0]); + roundToHighestFactorOfGlobalSize(ThreadsPerBlock[0], GlobalSize[0]); ThreadsPerBlock[1] = std::min(GlobalSize[1], std::min(MaxBlockSize / ThreadsPerBlock[0], MaxBlockDim[1])); - do { - roundToHighestFactorOfGlobalSize(ThreadsPerBlock[1], GlobalSize[1]); - } while (WorkDim == 2 && !isPowerOf2(ThreadsPerBlock[1]) && - ThreadsPerBlock[1] > 32 && --ThreadsPerBlock[1]); + roundToHighestFactorOfGlobalSize(ThreadsPerBlock[1], GlobalSize[1]); ThreadsPerBlock[2] = std::min( GlobalSize[2], std::min(MaxBlockSize / (ThreadsPerBlock[1] * ThreadsPerBlock[0]), MaxBlockDim[2])); - do { - roundToHighestFactorOfGlobalSize(ThreadsPerBlock[2], GlobalSize[2]); - } while (WorkDim == 1 && !isPowerOf2(ThreadsPerBlock[2]) && - ThreadsPerBlock[2] > 32 && --ThreadsPerBlock[2]); + roundToHighestFactorOfGlobalSize(ThreadsPerBlock[2], GlobalSize[2]); }