ocl4dnnGEMV in case of row_size < 4

pull/10754/head
Dmitry Kurtaev 7 years ago
parent a75840d19c
commit 65a6674c6e
  1. 38
      modules/dnn/src/ocl4dnn/src/math_functions.cpp

@ -451,23 +451,27 @@ bool ocl4dnnGEMV<float>(const CBLAS_TRANSPOSE TransA,
uint row_size = M; uint row_size = M;
uint col_size = N; uint col_size = N;
size_t localsize[] = { 128 };
size_t globalsize[] = { row_size / 4 * localsize[0] }; if (row_size >= 4)
{
uint argId = 0; size_t localsize[] = { 128 };
k.set(argId++, ocl::KernelArg::PtrReadOnly(A)); size_t globalsize[] = { row_size / 4 * localsize[0] };
k.set(argId++, offA);
k.set(argId++, cl_uint(col_size)); uint argId = 0;
k.set(argId++, cl_uint(col_size%4)); k.set(argId++, ocl::KernelArg::PtrReadOnly(A));
k.set(argId++, ocl::KernelArg::PtrReadOnly(x)); k.set(argId++, offA);
k.set(argId++, offx); k.set(argId++, cl_uint(col_size));
k.set(argId++, alpha); k.set(argId++, cl_uint(col_size%4));
k.set(argId++, beta); k.set(argId++, ocl::KernelArg::PtrReadOnly(x));
k.set(argId++, ocl::KernelArg::PtrWriteOnly(y)); k.set(argId++, offx);
k.set(argId++, offy); k.set(argId++, alpha);
k.set(argId++, NULL, localsize[0] * sizeof(cl_float4)); k.set(argId++, beta);
k.set(argId++, ocl::KernelArg::PtrWriteOnly(y));
ret = k.run(1, globalsize, localsize, false); k.set(argId++, offy);
k.set(argId++, NULL, localsize[0] * sizeof(cl_float4));
ret = k.run(1, globalsize, localsize, false);
}
if ((row_size % 4) != 0 && ret) if ((row_size % 4) != 0 && ret)
{ {

Loading…
Cancel
Save