From 93c23de75e1f521be21449ab85ba7d19dc07adf2 Mon Sep 17 00:00:00 2001 From: yangfei Date: Fri, 19 Oct 2018 20:52:05 +0800 Subject: [PATCH] add wait_event --- src/operators/kernel/cl/elementwise_add_kernel.cpp | 4 +++- src/operators/kernel/cl/feed_kernel.cpp | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/operators/kernel/cl/elementwise_add_kernel.cpp b/src/operators/kernel/cl/elementwise_add_kernel.cpp index a2a20ec090..0bc3700350 100644 --- a/src/operators/kernel/cl/elementwise_add_kernel.cpp +++ b/src/operators/kernel/cl/elementwise_add_kernel.cpp @@ -78,9 +78,11 @@ void ElementwiseAddKernel::Compute( int width = input->ImageWidth(); int height = input->ImageHeight(); size_t global_work_size[2] = {width, height}; + cl_event out_event = param.Out()->GetClEvent(); + cl_event wait_event = param.InputX()->GetClEvent(); status = clEnqueueNDRangeKernel(this->cl_helper_.CLCommandQueue(), kernel, 2, - NULL, global_work_size, NULL, 0, NULL, NULL); + NULL, global_work_size, NULL, 1,&wait_event, &out_event); CL_CHECK_ERRORS(status); } else { DLOG << "error:bias dims is error"; diff --git a/src/operators/kernel/cl/feed_kernel.cpp b/src/operators/kernel/cl/feed_kernel.cpp index 0edb1f2bee..e79e0ed15d 100644 --- a/src/operators/kernel/cl/feed_kernel.cpp +++ b/src/operators/kernel/cl/feed_kernel.cpp @@ -51,8 +51,11 @@ void FeedKernel::Compute(const FeedParam ¶m) { CL_CHECK_ERRORS(status); size_t global_work_size[2] = {width, height}; + + cl_event out_event = param.Out()->GetClEvent(); + status = clEnqueueNDRangeKernel(this->cl_helper_.CLCommandQueue(), kernel, 2, - NULL, global_work_size, NULL, 0, NULL, NULL); + NULL, global_work_size, NULL, 0, NULL, &out_event); CL_CHECK_ERRORS(status); } -- GitLab