diff --git a/lite/kernels/opencl/activation_image_compute.cc b/lite/kernels/opencl/activation_image_compute.cc index de552fe935a18daa0a141e2b89b5adfb77619c2a..6fe7e95ba2dd4faa51b891be6b98311618349714 100644 --- a/lite/kernels/opencl/activation_image_compute.cc +++ b/lite/kernels/opencl/activation_image_compute.cc @@ -81,10 +81,6 @@ class ActivationComputeImageDefault "image/activation_kernel.cl", build_options_, time_stamp_); - - STL::stringstream kernel_key; - kernel_key << kernel_func_name_ << build_options_ << time_stamp_; - auto kernel = context.cl_context()->GetKernel(kernel_key.str()); } void ReInitWhenNeeded() override { @@ -119,10 +115,11 @@ class ActivationComputeImageDefault out_img_shape_[0], out_img_shape_[1]); auto& context = ctx_->As(); CHECK(context.cl_context() != nullptr); + std::stringstream kernel_key; kernel_key << kernel_func_name_ << build_options_ << time_stamp_; auto kernel = context.cl_context()->GetKernel(kernel_key.str()); - ; + cl_int status; status = kernel->setArg(0, *x_img); CL_CHECK_FATAL(status); @@ -170,7 +167,6 @@ class ActivationComputeImageDefault std::string kernel_func_name_{}; float threshold_{6.f}; float scale_{1.f}; - cl::Kernel kernel; bool first_epoch_for_reinit_{true}; cl::NDRange global_work_size_ = cl::NDRange{ static_cast(1), static_cast(1), static_cast(1)}; diff --git a/lite/kernels/opencl/fc_buffer_compute.cc b/lite/kernels/opencl/fc_buffer_compute.cc index 3934994619825938ceaa2aeaa05efbc3696a2214..87d3f34be5772495a3fc19053507f32d04e3f361 100644 --- a/lite/kernels/opencl/fc_buffer_compute.cc +++ b/lite/kernels/opencl/fc_buffer_compute.cc @@ -108,7 +108,6 @@ class FcCompute std::stringstream kernel_key; kernel_key << kernel_func_name_ << build_options_ << time_stamp_; auto kernel = context.cl_context()->GetKernel(kernel_key.str()); - ; cl_int status; status = kernel->setArg(0, *x_buf); CL_CHECK_FATAL(status); @@ -145,7 +144,7 @@ class FcCompute bool first_epoch_for_reinit_{true}; DDim last_x_dims_; cl::NDRange global_work_size_; - cl::Kernel kernel; + std::shared_ptr event_{new cl::Event}; }; diff --git a/lite/kernels/opencl/scale_image_compute.cc b/lite/kernels/opencl/scale_image_compute.cc index 4ca741755a027fa642c17563d5cb5b3a7eb09c52..56c8373f17f8023426ff4f8bf1304af86f493662 100644 --- a/lite/kernels/opencl/scale_image_compute.cc +++ b/lite/kernels/opencl/scale_image_compute.cc @@ -85,7 +85,6 @@ class ScaleComputeImage2D : public KernelLiteGetKernel(kernel_key.str()); - ; cl_int status; status = kernel->setArg(0, *x_img); CL_CHECK_FATAL(status); @@ -114,7 +113,7 @@ class ScaleComputeImage2D : public KernelLite event_{new cl::Event}; param_t* scale_param_{nullptr}; - cl::Kernel kernel; + bool first_epoch_for_reinit_{true}; DDim last_x_dims_; DDim out_img_shape_ = DDim(std::vector(