Implementation detector and selector for IPP and OpenCL;
IPP can be switched on and off on runtime; Optional implementation collector was added (switched off by default in CMake). Gathers data of implementation used in functions and report this info through performance TS; TS modifications for implementations control;
This commit is contained in:
@@ -566,6 +566,8 @@ CV_EXPORTS void setIppStatus(int status, const char * const funcname = NULL, con
|
||||
int line = 0);
|
||||
CV_EXPORTS int getIppStatus();
|
||||
CV_EXPORTS String getIppErrorLocation();
|
||||
CV_EXPORTS bool useIPP();
|
||||
CV_EXPORTS void setUseIPP(bool flag);
|
||||
|
||||
} // ipp
|
||||
|
||||
|
@@ -5,6 +5,7 @@
|
||||
// Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
|
||||
#include "opencv2/core/utility.hpp"
|
||||
//#define CV_OPENCL_RUN_ASSERT
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
@@ -16,6 +17,7 @@
|
||||
{ \
|
||||
printf("%s: OpenCL implementation is running\n", CV_Func); \
|
||||
fflush(stdout); \
|
||||
CV_IMPL_ADD(CV_IMPL_OCL); \
|
||||
return __VA_ARGS__; \
|
||||
} \
|
||||
else \
|
||||
@@ -29,14 +31,24 @@
|
||||
{ \
|
||||
if (cv::ocl::useOpenCL() && (condition)) \
|
||||
{ \
|
||||
CV_Assert(func); \
|
||||
if(func) \
|
||||
{ \
|
||||
CV_IMPL_ADD(CV_IMPL_OCL); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
CV_Error(cv::Error::StsAssert, #func); \
|
||||
} \
|
||||
return __VA_ARGS__; \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define CV_OCL_RUN_(condition, func, ...) \
|
||||
if (cv::ocl::useOpenCL() && (condition) && func) \
|
||||
return __VA_ARGS__;
|
||||
{ \
|
||||
CV_IMPL_ADD(CV_IMPL_OCL); \
|
||||
return __VA_ARGS__; \
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
@@ -254,6 +254,9 @@ static inline IppDataType ippiGetDataType(int depth)
|
||||
# define IPP_VERSION_X100 0
|
||||
#endif
|
||||
|
||||
#define CV_IPP_CHECK_COND (cv::ipp::useIPP())
|
||||
#define CV_IPP_CHECK() if(CV_IPP_CHECK_COND)
|
||||
|
||||
#ifndef IPPI_CALL
|
||||
# define IPPI_CALL(func) CV_Assert((func) >= 0)
|
||||
#endif
|
||||
|
@@ -53,6 +53,30 @@
|
||||
namespace cv
|
||||
{
|
||||
|
||||
#ifdef CV_COLLECT_IMPL_DATA
|
||||
CV_EXPORTS void setImpl(int flags); // set implementation flags and reset storage arrays
|
||||
CV_EXPORTS void addImpl(int flag, const char* func = 0); // add implementation and function name to storage arrays
|
||||
// Get stored implementation flags and fucntions names arrays
|
||||
// Each implementation entry correspond to function name entry, so you can find which implementation was executed in which fucntion
|
||||
CV_EXPORTS int getImpl(std::vector<int> &impl, std::vector<String> &funName);
|
||||
|
||||
CV_EXPORTS bool useCollection(); // return implementation colelction state
|
||||
CV_EXPORTS void setUseCollection(bool flag); // set implementation collection state
|
||||
|
||||
#define CV_IMPL_PLAIN 0x01 // native CPU OpenCV implementation
|
||||
#define CV_IMPL_OCL 0x02 // OpenCL implementation
|
||||
#define CV_IMPL_IPP 0x04 // IPP implementation
|
||||
#define CV_IMPL_MT 0x10 // multithreaded implementation
|
||||
|
||||
#define CV_IMPL_ADD(impl) \
|
||||
if(cv::useCollection()) \
|
||||
{ \
|
||||
cv::addImpl(impl, CV_Func); \
|
||||
}
|
||||
#else
|
||||
#define CV_IMPL_ADD(impl)
|
||||
#endif
|
||||
|
||||
/*!
|
||||
Automatically Allocated Buffer Class
|
||||
|
||||
|
Reference in New Issue
Block a user