diff --git a/modules/core/src/ocl.cpp b/modules/core/src/ocl.cpp index 0bf4e07856..ea4954ec33 100644 --- a/modules/core/src/ocl.cpp +++ b/modules/core/src/ocl.cpp @@ -1257,6 +1257,14 @@ struct Device::Impl else vendorID_ = UNKNOWN_VENDOR; + const size_t CV_OPENCL_DEVICE_MAX_WORK_GROUP_SIZE = utils::getConfigurationParameterSizeT("OPENCV_OPENCL_DEVICE_MAX_WORK_GROUP_SIZE", 0); + if (CV_OPENCL_DEVICE_MAX_WORK_GROUP_SIZE > 0) + { + const size_t new_maxWorkGroupSize = std::min(maxWorkGroupSize_, CV_OPENCL_DEVICE_MAX_WORK_GROUP_SIZE); + if (new_maxWorkGroupSize != maxWorkGroupSize_) + CV_LOG_WARNING(NULL, "OpenCL: using workgroup size: " << new_maxWorkGroupSize << " (was " << maxWorkGroupSize_ << ")"); + maxWorkGroupSize_ = new_maxWorkGroupSize; + } #if 0 if (isExtensionSupported("cl_khr_spir")) {