Skip to content

Commit 69dc3de

Browse files
author
tianyuzhou668
authored
[Iluvatar GPU] Add synchronize in record event (PaddlePaddle#2280)
1 parent 27aec4a commit 69dc3de

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

backends/iluvatar_gpu/runtime/runtime.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,14 @@ C_Status RecordEvent(const C_Device device, C_Stream stream, C_Event event) {
675675

676676
cudaError_t cuda_status;
677677

678+
cudaError_t query_status = cudaEventQuery(cudaEvent_t(event));
679+
if (query_status == cudaErrorNotReady) {
680+
cuda_status = cudaEventSynchronize(cudaEvent_t(event));
681+
if (cuda_status != cudaSuccess) {
682+
return C_ERROR;
683+
}
684+
}
685+
678686
cuda_status = cudaEventRecord(cudaEvent_t(event), cudaStream_t(stream));
679687
if (cuda_status != cudaSuccess) {
680688
return C_ERROR;

0 commit comments

Comments
 (0)