avoid PPL auto_partitioner on ARM64

This commit is contained in:
Prasadayus
2026-08-31 16:23:26 +05:30
parent 6e4c669be8
commit 879577b2dd

View File

@@ -449,6 +449,18 @@ namespace {
this->ParallelLoopBodyWrapper::operator()(cv::Range(i, i + 1));
}
};
// PPL's default auto_partitioner silently skips whole chunks of the range on
// ARM64 (unfixed MSVC bug, developercommunity.visualstudio.com/t/1027444).
template <typename Body>
static inline void pplParallelFor(int first, int last, const Body& body)
{
#if defined(_M_ARM64) || defined(_M_ARM64EC)
Concurrency::parallel_for(first, last, body, Concurrency::static_partitioner());
#else
Concurrency::parallel_for(first, last, body);
#endif
}
#else
typedef ParallelLoopBodyWrapper ProxyLoopBody;
#endif
@@ -593,18 +605,18 @@ static void parallel_for_impl(const cv::Range& range, const cv::ParallelLoopBody
#elif defined WINRT
Concurrency::parallel_for(stripeRange.start, stripeRange.end, pbody);
pplParallelFor(stripeRange.start, stripeRange.end, pbody);
#elif defined HAVE_CONCURRENCY
if(!pplScheduler || pplScheduler->Id() == Concurrency::CurrentScheduler::Id())
{
Concurrency::parallel_for(stripeRange.start, stripeRange.end, pbody);
pplParallelFor(stripeRange.start, stripeRange.end, pbody);
}
else
{
pplScheduler->Attach();
Concurrency::parallel_for(stripeRange.start, stripeRange.end, pbody);
pplParallelFor(stripeRange.start, stripeRange.end, pbody);
Concurrency::CurrentScheduler::Detach();
}