• 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
..
accumulate.cl Loading commit data...
bilateral.cl Loading commit data...
blend_linear.cl Loading commit data...
boxFilter.cl Loading commit data...
calc_back_project.cl Loading commit data...
canny.cl Loading commit data...
clahe.cl Loading commit data...
corner.cl Loading commit data...
covardata.cl Loading commit data...
cvtcolor.cl Loading commit data...
filter2D.cl Loading commit data...
filter2DSmall.cl Loading commit data...
filterSepCol.cl Loading commit data...
filterSepRow.cl Loading commit data...
filterSep_singlePass.cl Loading commit data...
filterSmall.cl Loading commit data...
gftt.cl Loading commit data...
histogram.cl Loading commit data...
hough_lines.cl Loading commit data...
integral_sum.cl Loading commit data...
laplacian5.cl Loading commit data...
match_template.cl Loading commit data...
medianFilter.cl Loading commit data...
moments.cl Loading commit data...
morph.cl Loading commit data...
precornerdetect.cl Loading commit data...
pyr_down.cl Loading commit data...
pyr_up.cl Loading commit data...
remap.cl Loading commit data...
resize.cl Loading commit data...
threshold.cl Loading commit data...
warp_affine.cl Loading commit data...
warp_perspective.cl Loading commit data...