From 0ae3aea0733d2e3ccb44e9088c5529b339ee9965 Mon Sep 17 00:00:00 2001 From: ysh329 Date: Mon, 24 Aug 2020 21:53:14 +0800 Subject: [PATCH] revert opencl backend for mallocImage. test=develop (#4191) --- lite/backends/opencl/target_wrapper.cc | 60 +++++++++++++------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/lite/backends/opencl/target_wrapper.cc b/lite/backends/opencl/target_wrapper.cc index e39e64245aa..950f2fc442b 100644 --- a/lite/backends/opencl/target_wrapper.cc +++ b/lite/backends/opencl/target_wrapper.cc @@ -64,16 +64,16 @@ void *TargetWrapperCL::MallocImage(const size_t cl_image2d_width, void *host_ptr) { cl::ImageFormat img_format(CL_RGBA, GetCLChannelType(PRECISION(kFloat))); cl_int status; - cl::Image2D *cl_image = new cl::Image2D( - CLRuntime::Global()->context(), - (host_ptr ? CL_MEM_READ_ONLY : CL_MEM_READ_WRITE) | - (host_ptr ? CL_MEM_COPY_HOST_PTR : CL_MEM_ALLOC_HOST_PTR), - img_format, - cl_image2d_width, - cl_image2d_height, - 0, - host_ptr, - &status); + cl::Image2D *cl_image = + new cl::Image2D(CLRuntime::Global()->context(), + CL_MEM_READ_WRITE | (host_ptr ? CL_MEM_COPY_HOST_PTR + : CL_MEM_ALLOC_HOST_PTR), + img_format, + cl_image2d_width, + cl_image2d_height, + 0, + host_ptr, + &status); if (status != CL_SUCCESS) { delete cl_image; cl_image = nullptr; @@ -88,16 +88,16 @@ void *TargetWrapperCL::MallocImage(const size_t cl_image2d_width, void *host_ptr) { cl::ImageFormat img_format(CL_RGBA, GetCLChannelType(PRECISION(kFP16))); cl_int status; - cl::Image2D *cl_image = new cl::Image2D( - CLRuntime::Global()->context(), - (host_ptr ? CL_MEM_READ_ONLY : CL_MEM_READ_WRITE) | - (host_ptr ? CL_MEM_COPY_HOST_PTR : CL_MEM_ALLOC_HOST_PTR), - img_format, - cl_image2d_width, - cl_image2d_height, - 0, - host_ptr, - &status); + cl::Image2D *cl_image = + new cl::Image2D(CLRuntime::Global()->context(), + CL_MEM_READ_WRITE | (host_ptr ? CL_MEM_COPY_HOST_PTR + : CL_MEM_ALLOC_HOST_PTR), + img_format, + cl_image2d_width, + cl_image2d_height, + 0, + host_ptr, + &status); if (status != CL_SUCCESS) { delete cl_image; cl_image = nullptr; @@ -112,16 +112,16 @@ void *TargetWrapperCL::MallocImage(const size_t cl_image2d_width, void *host_ptr) { cl::ImageFormat img_format(CL_RGBA, GetCLChannelType(PRECISION(kInt32))); cl_int status; - cl::Image2D *cl_image = new cl::Image2D( - CLRuntime::Global()->context(), - (host_ptr ? CL_MEM_READ_ONLY : CL_MEM_READ_WRITE) | - (host_ptr ? CL_MEM_COPY_HOST_PTR : CL_MEM_ALLOC_HOST_PTR), - img_format, - cl_image2d_width, - cl_image2d_height, - 0, - host_ptr, - &status); + cl::Image2D *cl_image = + new cl::Image2D(CLRuntime::Global()->context(), + CL_MEM_READ_WRITE | (host_ptr ? CL_MEM_COPY_HOST_PTR + : CL_MEM_ALLOC_HOST_PTR), + img_format, + cl_image2d_width, + cl_image2d_height, + 0, + host_ptr, + &status); if (status != CL_SUCCESS) { delete cl_image; cl_image = nullptr;