From 2bfbcd323a69ff101b6f42013838051edddc957e Mon Sep 17 00:00:00 2001 From: Yufeng Li Date: Sat, 22 Jun 2019 11:29:23 -0700 Subject: [PATCH] fix OrtValue Release condition (#1182) CUDAFence::CanRelease should also check wirte_event_ --- onnxruntime/core/providers/cuda/cuda_fence.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/onnxruntime/core/providers/cuda/cuda_fence.cc b/onnxruntime/core/providers/cuda/cuda_fence.cc index e5f7f6de8d..ce368a7daa 100644 --- a/onnxruntime/core/providers/cuda/cuda_fence.cc +++ b/onnxruntime/core/providers/cuda/cuda_fence.cc @@ -43,7 +43,8 @@ void CUDAFence::BeforeUsingAsOutput(onnxruntime::ProviderType provider_type, int } bool CUDAFence::CanRelease() { - return cudaEventQuery(read_event_) == cudaSuccess; + return cudaEventQuery(read_event_) == cudaSuccess && + cudaEventQuery(write_event_) == cudaSuccess; } void CUDAFence::AfterUsedAsInput(int queue_id) {