From cdf6aee341d524d45e2b74a6ec18369a885f0055 Mon Sep 17 00:00:00 2001 From: liuruilong Date: Mon, 22 Oct 2018 10:57:09 +0800 Subject: [PATCH] add clfinish at fetch kernel --- src/operators/kernel/cl/fetch_kernel.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/operators/kernel/cl/fetch_kernel.cpp b/src/operators/kernel/cl/fetch_kernel.cpp index ca94ae475e..06646debd4 100644 --- a/src/operators/kernel/cl/fetch_kernel.cpp +++ b/src/operators/kernel/cl/fetch_kernel.cpp @@ -14,6 +14,8 @@ limitations under the License. */ #include "operators/kernel/fetch_kernel.h" #include "framework/cl/cl_tensor.h" +//#include "common/common.h" +//#include namespace paddle_mobile { namespace operators { @@ -77,11 +79,19 @@ void FetchKernel::Compute(const FetchParam ¶m) { clEnqueueNDRangeKernel(this->cl_helper_.CLCommandQueue(), kernel, 3, NULL, default_work_size.data(), NULL, 0, NULL, NULL); +// auto time1 = paddle_mobile::time(); + // printf(" before finish \n"); // clFlsh(this->cl_helper_.CLCommandQueue()); -// clFinish(this->cl_helper_.CLCommandQueue()); + clFinish(this->cl_helper_.CLCommandQueue()); // printf(" after finish \n"); +// auto time2 = paddle_mobile::time(); +// +// +// std::cout << " finish cost :" << paddle_mobile::time_diff(time1, time2) +// << "ms" << std::endl; + memcpy(out->data(), out_cl_tensor.Data(), out->memory_size()); } -- GitLab