Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions source/adapters/cuda/enqueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,11 @@ void guessLocalWorkSize(ur_device_handle_t Device, size_t *ThreadsPerBlock,
ThreadsPerBlock[0] = std::min(
MaxThreadsPerBlock[0], std::min(GlobalSizeNormalized[0], MaxBlockDim[0]));

static auto IsPowerOf2 = [](size_t Value) -> bool {
return Value && !(Value & (Value - 1));
};

// Find a local work group size that is a divisor of the global
// work group size to produce uniform work groups.
// Additionally, for best compute utilisation, the local size has
// to be a power of two.
while (0u != (GlobalSizeNormalized[0] % ThreadsPerBlock[0]) ||
!IsPowerOf2(ThreadsPerBlock[0])) {
while (0u != (GlobalSizeNormalized[0] % ThreadsPerBlock[0])) {
--ThreadsPerBlock[0];
}
}
Expand Down