Hi,
I noticed something that's ringing my alarm bells: In the OpenCV 3.0 overview slides you state that the OpenCL "kernel is compiled only once and cached". However, when I use the suggested code like this and use Nsight for Visual Studio as a profiler, I can see that every call of a processing method/function with OpenCL support seems to recreate a new OpenCL Kernel object since every call is associated with a new Kernel ID. E.g. if I run this code here...
cv::UMat m1;
cv::UMat m2;
cv::Mat kernel = cv::getStructuringElement( cv::MORPH_ELLIPSE, cv::Size( 5, 5 ), cv::Point( 3, 3 ) );
cv::imread( "frame.tiff" ).copyTo( m1 );
for( int i = 0; i < 10; i++ )
cv::morphologyEx( m1, m1, cv::MORPH_DILATE, kernel );
...I can see ten calls of "morph" like this:
Kernel ID Creation Time (μs) Lifetime (μs) Kernel Name Program ID Count
1 144,977.128 2,639,412.861 morph 1 1
2 149,341.788 2,635,090.195 morph 1 1
3 150,546.564 2,633,925.752 morph 1 1
4 151,932.220 2,632,580.169 morph 1 1
5 153,527.674 2,631,024.282 morph 1 1
6 155,105.123 2,629,485.587 morph 1 1
7 156,673.963 2,627,955.218 morph 1 1
8 158,268.724 2,626,399.276 morph 1 1
9 160,592.615 2,624,114.423 morph 1 1
10 161,995.603 2,622,750.544 morph 1 1
That said, I didn't step into the OpenCV code with the debugger, because right now I don't got time for this, and I also didn't compare to OpenCV 3.0 source code. I also am by no means an expert in OpenCL and am not entirely sure what a Kernel ID is and at what point it's issued, so I can only speculate on what's going on, but to me it seems like Kernel objects are created over and over again and I'm pretty sure this isn't good.
Are the slides outdated? Is this a bug? It certainly doesn't seem like it's meant that way.