• Zhigang Gong's avatar
    fix potential race condition in canny.cl. · 0b08d255
    Zhigang Gong authored
    See the below code snippet:
    
    while(l_counter != 0)
    {
        int mod = l_counter % LOCAL_TOTAL;
        int pix_per_thr = l_counter / LOCAL_TOTAL + ((lid < mod) ? 1 : 0);
    
        for (int i = 0; i < pix_per_thr; ++i)
        {
            int index = atomic_dec(&l_counter) - 1;
            ....
        }
        ....
        barrier(CLK_LOCAL_MEM_FENCE);
    }
    
    If we don't put a barrier before the for loop, then there is a possiblity
    that some work item enter this loop but the others are not, the the l_counter
    will be reduced in the for loop and may be changed to zero, and the other
    work items may can't enter the while loop. If this happens, it breaks the
    barrier's rule which requires all the work items reach the same barrier.
    And it may hang the GPU depends on the implementation of opencl platform.
    
    This issue is raised at:
    https://github.com/Itseez/opencv/issues/5175Signed-off-by: 's avatarZhigang Gong <zhigang.gong@linux.intel.com>
    0b08d255
Name
Last commit
Last update
..
calib3d Loading commit data...
core Loading commit data...
cudaarithm Loading commit data...
cudabgsegm Loading commit data...
cudacodec Loading commit data...
cudafeatures2d Loading commit data...
cudafilters Loading commit data...
cudaimgproc Loading commit data...
cudalegacy Loading commit data...
cudaobjdetect Loading commit data...
cudaoptflow Loading commit data...
cudastereo Loading commit data...
cudawarping Loading commit data...
cudev Loading commit data...
features2d Loading commit data...
flann Loading commit data...
highgui Loading commit data...
imgcodecs Loading commit data...
imgproc Loading commit data...
java Loading commit data...
ml Loading commit data...
objdetect Loading commit data...
photo Loading commit data...
python Loading commit data...
shape Loading commit data...
stitching Loading commit data...
superres Loading commit data...
ts Loading commit data...
video Loading commit data...
videoio Loading commit data...
videostab Loading commit data...
viz Loading commit data...
world Loading commit data...
CMakeLists.txt Loading commit data...