core(ocl): workaround CL_OUT_OF_RESOURCES error
authorAlexander Alekhin <alexander.alekhin@intel.com>
Mon, 30 Oct 2017 14:54:56 +0000 (17:54 +0300)
committerAlexander Alekhin <alexander.alekhin@intel.com>
Mon, 30 Oct 2017 14:54:56 +0000 (17:54 +0300)
Flush deallocation queue before calling map/unmap

modules/core/src/ocl.cpp

index 6da86b7..c50af04 100644 (file)
@@ -3613,11 +3613,12 @@ public:
                         if (u->tempUMat())
                         {
                             CV_Assert(u->mapcount == 0);
+                            flushCleanupQueue(); // workaround for CL_OUT_OF_RESOURCES problem (#9960)
                             void* data = clEnqueueMapBuffer(q, (cl_mem)u->handle, CL_TRUE,
                                 (CL_MAP_READ | CL_MAP_WRITE),
                                 0, u->size, 0, 0, 0, &retval);
+                            CV_Assert(retval == CL_SUCCESS);
                             CV_Assert(u->origdata == data);
-                            CV_OclDbgAssert(retval == CL_SUCCESS);
                             if (u->originalUMatData)
                             {
                                 CV_Assert(u->originalUMatData->data == data);