From d850e26895fabeb36bc6bda0c40b818cb813f351 Mon Sep 17 00:00:00 2001 From: Yuan Shuai Date: Wed, 22 Apr 2020 07:00:38 -0500 Subject: [PATCH] [LITE][OPENCL] Fix Places of CXX Config for OpenCL. test=develop (#3462) * Fix Places of CXX Config for OpenCL. test=develop * fix shared ptr as unqiue ptr. test=develop --- lite/api/cxx_api.cc | 1 + lite/kernels/opencl/slice_image_compute_test.cc | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lite/api/cxx_api.cc b/lite/api/cxx_api.cc index f4dcac519a..f123c2a9c7 100644 --- a/lite/api/cxx_api.cc +++ b/lite/api/cxx_api.cc @@ -293,6 +293,7 @@ void Predictor::Build(const cpp::ProgramDesc &desc, // `inner_places` is used to optimize passes std::vector inner_places = valid_places; for (auto &valid_place : valid_places) { + if (valid_place.target == TARGET(kOpenCL)) continue; inner_places.emplace_back( Place(TARGET(kHost), valid_place.precision, valid_place.layout)); } diff --git a/lite/kernels/opencl/slice_image_compute_test.cc b/lite/kernels/opencl/slice_image_compute_test.cc index 1c22a81238..b8e8e18af1 100644 --- a/lite/kernels/opencl/slice_image_compute_test.cc +++ b/lite/kernels/opencl/slice_image_compute_test.cc @@ -84,7 +84,7 @@ TEST(slice_image2d_fp16, compute) { } LOG(INFO) << "prepare input"; - std::shared_ptr default_converter( + std::unique_ptr default_converter( new CLImageConverterDefault()); DDim image_shape = default_converter->InitImageDimInfoWith(in_dim); LOG(INFO) << "image_shape = " << image_shape[0] << " " << image_shape[1]; -- GitLab