Skip to content

Commit 9e1c034

Browse files
authored
Merge pull request #10773 from rakhmets/topic/cuda-copy-err-put-mpool
UCT/CUDA/CUDA_COPY: Return object to the mpool in case of failure.
2 parents 03ccf73 + ab3d32f commit 9e1c034

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/uct/cuda/cuda_copy/cuda_copy_ep.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,13 +296,13 @@ uct_cuda_copy_post_cuda_async_copy(uct_ep_h tl_ep, void *dst, void *src,
296296
status = UCT_CUDADRV_FUNC_LOG_ERR(
297297
cuMemcpyAsync((CUdeviceptr)dst, (CUdeviceptr)src, length, *stream));
298298
if (ucs_unlikely(UCS_OK != status)) {
299-
goto out_pop_and_release;
299+
goto err_mpool_put;
300300
}
301301

302302
status = UCT_CUDADRV_FUNC_LOG_ERR(
303303
cuEventRecord(cuda_event->event, *stream));
304304
if (ucs_unlikely(UCS_OK != status)) {
305-
goto out_pop_and_release;
305+
goto err_mpool_put;
306306
}
307307

308308
if (ucs_queue_is_empty(event_q)) {
@@ -324,6 +324,9 @@ uct_cuda_copy_post_cuda_async_copy(uct_ep_h tl_ep, void *dst, void *src,
324324
uct_cuda_primary_ctx_pop_and_release(cuda_device);
325325
out:
326326
return status;
327+
err_mpool_put:
328+
ucs_mpool_put(cuda_event);
329+
goto out_pop_and_release;
327330
}
328331

329332
UCS_PROFILE_FUNC(ucs_status_t, uct_cuda_copy_ep_get_zcopy,

0 commit comments

Comments
 (0)