mirror of
https://github.com/opencv/opencv.git
synced 2025-06-12 20:42:53 +08:00
core(ocl): add option to abort on OpenCL kernel build failure
- exceptions are catched by fallback CPU path - OPENCV_OPENCL_ABORT_ON_BUILD_ERROR (disabled by default)
This commit is contained in:
parent
523c3cd50b
commit
c5a86c22a4
@ -153,6 +153,17 @@ static bool isRaiseError()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void onOpenCLKernelBuildError()
|
||||||
|
{
|
||||||
|
// NB: no need to cache this value
|
||||||
|
bool value = cv::utils::getConfigurationParameterBool("OPENCV_OPENCL_ABORT_ON_BUILD_ERROR", false);
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Abort on OpenCL kernel build failure!\n");
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if CV_OPENCL_TRACE_CHECK
|
#if CV_OPENCL_TRACE_CHECK
|
||||||
static inline
|
static inline
|
||||||
void traceOpenCLCheck(cl_int status, const char* message)
|
void traceOpenCLCheck(cl_int status, const char* message)
|
||||||
@ -3881,6 +3892,12 @@ struct Program::Impl
|
|||||||
CV_OCL_DBG_CHECK(clReleaseProgram(handle));
|
CV_OCL_DBG_CHECK(clReleaseProgram(handle));
|
||||||
handle = NULL;
|
handle = NULL;
|
||||||
}
|
}
|
||||||
|
if (retval != CL_SUCCESS &&
|
||||||
|
sourceName_ != "dummy" // used for testing of compilation flags
|
||||||
|
)
|
||||||
|
{
|
||||||
|
onOpenCLKernelBuildError();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#if CV_OPENCL_VALIDATE_BINARY_PROGRAMS
|
#if CV_OPENCL_VALIDATE_BINARY_PROGRAMS
|
||||||
if (handle && CV_OPENCL_VALIDATE_BINARY_PROGRAMS_VALUE)
|
if (handle && CV_OPENCL_VALIDATE_BINARY_PROGRAMS_VALUE)
|
||||||
|
Loading…
Reference in New Issue
Block a user