Skip to content

Commit

Permalink
Test CI
Browse files Browse the repository at this point in the history
  • Loading branch information
hdelan committed Mar 14, 2024
1 parent b5af496 commit 85f7bfc
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions source/ur/ur.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,28 +351,18 @@ template <typename T> 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]);
}

0 comments on commit 85f7bfc

Please sign in to comment.