diff options
Diffstat (limited to 'src/runtime/CPP/CPPScheduler.cpp')
-rw-r--r-- | src/runtime/CPP/CPPScheduler.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/CPP/CPPScheduler.cpp b/src/runtime/CPP/CPPScheduler.cpp index 5849218536..e684eeee98 100644 --- a/src/runtime/CPP/CPPScheduler.cpp +++ b/src/runtime/CPP/CPPScheduler.cpp @@ -338,9 +338,9 @@ void CPPScheduler::schedule(ICPPKernel *kernel, const Hints &hints) break; case StrategyHint::DYNAMIC: { + const unsigned int granule_threshold = (hints.threshold() <= 0) ? num_threads : static_cast<unsigned int>(hints.threshold()); // Make sure we don't use some windows which are too small as this might create some contention on the ThreadFeeder - const unsigned int max_iterations = static_cast<unsigned int>(_impl->_num_threads) * 3; - num_windows = num_iterations > max_iterations ? max_iterations : num_iterations; + num_windows = num_iterations > granule_threshold ? granule_threshold : num_iterations; break; } default: |