<h5 dir="auto">System information (version)</h5>

<ul dir="auto">
<li>OpenCV =&gt; 4.1.0</li>
<li>Operating System / Platform =&gt; Windows 7 x64</li>
<li>Compiler =&gt; mingw 7.3.0 x64</li>
</ul>
<h5 dir="auto">Detailed description</h5>

<p dir="auto">Segfault when I try to transfer any args to kernel args method (While opencl is working when I use cv::UMat in the algorithms like cv::normalize, cv::reduce etc..) May be is there any algorithm in opencv to reduce Mat by 8 column groups?</p>
<h5 dir="auto">Steps to reproduce</h5>

<p dir="auto">Using Qt 5.12.2 :</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="#include  &lt;opencv2/core/core.hpp&gt;
#include  &lt;opencv2/core/ocl.hpp&gt;
#include &lt;opencv2/opencv.hpp&gt;

QString kernelName = &quot;column_reduce&quot;;
QString kernelSrc = QStringLiteral(
&quot;__kernel void column_reduce                                                        &quot;
&quot;(__global float8*  img_in, __global float* img_out, int width, __local float8* tmp)&quot;
&quot;{                                                                                  &quot;
&quot;    const int2 pos_global = {get_global_id(0), get_global_id(1)};                  &quot;
&quot;    const int pos_1d_global = pos_global.x * width + pos_global.y;                 &quot;
&quot;    const int2 pos = {get_local_id(0), get_local_id(1)};                           &quot;
&quot;    const int pos_1d = pos.x * width + pos.y;                                      &quot;
&quot;    tmp[pos_1d] = img_in[pos_1d_global];                                           &quot;
&quot;    barrier(CLK_LOCAL_MEM_FENCE);                                                  &quot;
&quot;    float8 cols = tmp[pos_1d];                                                     &quot;
&quot;    float sum = cols.s0 + cols.s1 + cols.s2 + cols.s3 +                            &quot;
&quot;                cols.s4 + cols.s5 + cols.s6 + cols.s7;                             &quot;
&quot;    barrier(CLK_LOCAL_MEM_FENCE);                                                  &quot;
&quot;    img_out[pos_1d_global] = sum;                                                  &quot;
&quot;}                                                                                  &quot;);

cv::ocl::Kernel kernel(kernelName.toUtf8().constData(),
           cv::ocl::ProgramSource(kernelSrc.toUtf8().constData()));
assert(! kernel.empty());

cv::Mat src = cv::Mat(100, 128/*divide on 8*/, CV_32F, cv::Scalar(1));
UMat src_umat = src.getUMat(cv::ACCESS_READ);
Mat _dst = Mat(src.rows, src.cols, src.type());
UMat dst_umat = _dst.getUMat(cv::ACCESS_RW);

ocl::KernelArg srcarg = ocl::KernelArg::ReadOnly(src_umat),
temparg = ocl::KernelArg::WriteOnlyNoSize(dst_umat);

kernel.args(srcarg, temparg); // &lt;&lt; cause segfault"><pre class="notranslate"><code class="notranslate">#include  &lt;opencv2/core/core.hpp&gt;
#include  &lt;opencv2/core/ocl.hpp&gt;
#include &lt;opencv2/opencv.hpp&gt;

QString kernelName = "column_reduce";
QString kernelSrc = QStringLiteral(
"__kernel void column_reduce                                                        "
"(__global float8*  img_in, __global float* img_out, int width, __local float8* tmp)"
"{                                                                                  "
"    const int2 pos_global = {get_global_id(0), get_global_id(1)};                  "
"    const int pos_1d_global = pos_global.x * width + pos_global.y;                 "
"    const int2 pos = {get_local_id(0), get_local_id(1)};                           "
"    const int pos_1d = pos.x * width + pos.y;                                      "
"    tmp[pos_1d] = img_in[pos_1d_global];                                           "
"    barrier(CLK_LOCAL_MEM_FENCE);                                                  "
"    float8 cols = tmp[pos_1d];                                                     "
"    float sum = cols.s0 + cols.s1 + cols.s2 + cols.s3 +                            "
"                cols.s4 + cols.s5 + cols.s6 + cols.s7;                             "
"    barrier(CLK_LOCAL_MEM_FENCE);                                                  "
"    img_out[pos_1d_global] = sum;                                                  "
"}                                                                                  ");

cv::ocl::Kernel kernel(kernelName.toUtf8().constData(),
           cv::ocl::ProgramSource(kernelSrc.toUtf8().constData()));
assert(! kernel.empty());

cv::Mat src = cv::Mat(100, 128/*divide on 8*/, CV_32F, cv::Scalar(1));
UMat src_umat = src.getUMat(cv::ACCESS_READ);
Mat _dst = Mat(src.rows, src.cols, src.type());
UMat dst_umat = _dst.getUMat(cv::ACCESS_RW);

ocl::KernelArg srcarg = ocl::KernelArg::ReadOnly(src_umat),
temparg = ocl::KernelArg::WriteOnlyNoSize(dst_umat);

kernel.args(srcarg, temparg); // &lt;&lt; cause segfault
</code></pre></div>
<p dir="auto">Error signature:<br>
APPCRASH<br>
module with error: amdocl64.dll<br>
module with error version:	10.0.2766.5<br>
exception code:	c0000005<br>
exception offset:	00000000002f1619<br>
os ver:	6.1.7601.2.1.0.256.48<br>
lang code:	1049<br>
additional info 1:	3dd5<br>
additional info 2:	3dd52932c27223cd65366d12942569bf<br>
additional info 3:	ec76<br>
additional info 4:	ec76e410f94e0c815bd57985ba687292<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/3767353/61537289-7428c000-aa3f-11e9-83a2-8a61d30ceae6.png"><img src="https://user-images.githubusercontent.com/3767353/61537289-7428c000-aa3f-11e9-83a2-8a61d30ceae6.png" alt="OclError" style="max-width: 100%;"></a></p>
<p dir="auto">CMake Error: The following variables are used in this project, but they are set to NOTFOUND.<br>
Please set them or make sure they are set and tested correctly in the CMake files:<br>
CUDA_CUDA_LIBRARY (ADVANCED)<br>
linked by target "example_gpu_alpha_comp" in directory /home/shravankumar/apps/opencv-3.2.0/samples/gpu<br>
linked by target "example_gpu_bgfg_segm" in directory /home/shravankumar/apps/opencv-3.2.0/samples/gpu<br>
linked by target "example_gpu_cascadeclassifier" in directory /home/shravankumar/apps/opencv-3.2.0/samples/gpu<br>
linked by target "example_gpu_cascadeclassifier_nvidia_api" in directory /home/shravankumar/apps/opencv-3.2.0/samples/gpu<br>
linked by target "example_gpu_driver_api_multi" in directory /home/shravankumar/apps/opencv-3.2.0/samples/gpu<br>
linked by target "example_gpu_driver_api_stereo_multi" in directory /home/shravankumar/apps/opencv-3.2.0/samples/gpu<br>
linked by target "example_gpu_farneback_optical_flow" in directory /home/shravankumar/apps/opencv-3.2.0/samples/gpu<br>
linked by target "example_gpu_generalized_hough" in directory /home/shravankumar/apps/opencv-3.2.0/samples/gpu<br>
linked by target "example_gpu_hog" in directory /home/shravankumar/apps/opencv-3.2.0/samples/gpu<br>
linked by target "example_gpu_houghlines" in directory /home/shravankumar/apps/opencv-3.2.0/samples/gpu<br>
linked by target "example_gpu_morphology" in directory /home/shravankumar/apps/opencv-3.2.0/samples/gpu<br>
linked by target "example_gpu_multi" in directory /home/shravankumar/apps/opencv-3.2.0/samples/gpu<br>
linked by target "example_gpu_opengl" in directory /home/shravankumar/apps/opencv-3.2.0/samples/gpu<br>
linked by target "example_gpu_optical_flow" in directory /home/shravankumar/apps/opencv-3.2.0/samples/gpu<br>
linked by target "example_gpu_opticalflow_nvidia_api" in directory /home/shravankumar/apps/opencv-3.2.0/samples/gpu<br>
linked by target "example_gpu_pyrlk_optical_flow" in directory /home/shravankumar/apps/opencv-3.2.0/samples/gpu<br>
linked by target "example_gpu_stereo_match" in directory /home/shravankumar/apps/opencv-3.2.0/samples/gpu<br>
linked by target "example_gpu_stereo_multi" in directory /home/shravankumar/apps/opencv-3.2.0/samples/gpu<br>
linked by target "example_gpu_super_resolution" in directory /home/shravankumar/apps/opencv-3.2.0/samples/gpu<br>
linked by target "example_gpu_surf_keypoint_matcher" in directory /home/shravankumar/apps/opencv-3.2.0/samples/gpu<br>
linked by target "example_gpu_video_reader" in directory /home/shravankumar/apps/opencv-3.2.0/samples/gpu<br>
linked by target "example_gpu_video_writer" in directory /home/shravankumar/apps/opencv-3.2.0/samples/gpu</p>
<p dir="auto">-- Configuring incomplete, errors occurred!</p>