From f5521cf2f970c758b8acf5b5fea72bd21e265cbc Mon Sep 17 00:00:00 2001 From: duanyanhui Date: Thu, 27 Apr 2023 13:44:39 +0800 Subject: [PATCH] fix custom_device copy sync --- paddle/fluid/inference/api/details/zero_copy_tensor.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paddle/fluid/inference/api/details/zero_copy_tensor.cc b/paddle/fluid/inference/api/details/zero_copy_tensor.cc index 52204ff3658..2edc3cb4d3e 100644 --- a/paddle/fluid/inference/api/details/zero_copy_tensor.cc +++ b/paddle/fluid/inference/api/details/zero_copy_tensor.cc @@ -457,13 +457,13 @@ void Tensor::CopyToCpuImpl(T *data, auto custom_place = t_place; auto *dev_ctx = static_cast( pool.Get(custom_place)); + dev_ctx->Wait(); paddle::memory::Copy(paddle::platform::CPUPlace(), static_cast(data), custom_place, t_data, ele_num * sizeof(T), dev_ctx->stream()); -// TODO(wangran16): sync_stream #else PADDLE_THROW(paddle::platform::errors::InvalidArgument( "The analysis predictor supports CPU, GPU, NPU and XPU now.")); -- GitLab