File tree 1 file changed +5
-2
lines changed 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -329,7 +329,8 @@ template <typename T> class Result {
329
329
static inline void
330
330
roundToHighestFactorOfGlobalSize (size_t &ThreadsPerBlockInDim,
331
331
const size_t GlobalWorkSizeInDim) {
332
- while (GlobalWorkSizeInDim % ThreadsPerBlockInDim) {
332
+ while (ThreadsPerBlockInDim > 1 &&
333
+ GlobalWorkSizeInDim % ThreadsPerBlockInDim) {
333
334
--ThreadsPerBlockInDim;
334
335
}
335
336
}
@@ -359,8 +360,10 @@ static inline void roundToHighestFactorOfGlobalSizeIn3d(
359
360
360
361
ThreadsPerBlock[0 ] = std::min (
361
362
GlobalSize[0 ], MaxBlockSize / (ThreadsPerBlock[1 ] * ThreadsPerBlock[2 ]));
363
+
362
364
// Make the X dim a factor of 2
363
365
do {
364
366
roundToHighestFactorOfGlobalSize (ThreadsPerBlock[0 ], GlobalSize[0 ]);
365
- } while (!isPowerOf2 (ThreadsPerBlock[0 ]));
367
+ } while (!isPowerOf2 (ThreadsPerBlock[0 ]) && ThreadsPerBlock[0 ] > 32 &&
368
+ --ThreadsPerBlock[0 ]);
366
369
}
You can’t perform that action at this time.
0 commit comments