Skip to content

Commit ffd9d7f

Browse files
committed
UCT/IB/MLX5/GDAKI: Fixed retaining inactive primary context.
1 parent 93d3c2a commit ffd9d7f

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/uct/ib/mlx5/gdaki/gdaki.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -763,17 +763,11 @@ static UCS_CLASS_INIT_FUNC(uct_rc_gdaki_iface_t, uct_md_h tl_md,
763763
return status;
764764
}
765765

766-
status = UCT_CUDADRV_FUNC_LOG_ERR(
767-
cuDevicePrimaryCtxRetain(&self->cuda_ctx, self->cuda_dev));
766+
status = uct_cuda_ctx_primary_push(self->cuda_dev, 0, UCS_LOG_LEVEL_ERROR);
768767
if (status != UCS_OK) {
769768
return status;
770769
}
771770

772-
status = UCT_CUDADRV_FUNC_LOG_ERR(cuCtxPushCurrent(self->cuda_ctx));
773-
if (status != UCS_OK) {
774-
goto err_ctx_release;
775-
}
776-
777771
status = uct_rc_gdaki_alloc(sizeof(uint64_t), sizeof(uint64_t),
778772
(void**)&self->atomic_buff, &self->atomic_raw);
779773
if (status != UCS_OK) {
@@ -797,19 +791,17 @@ static UCS_CLASS_INIT_FUNC(uct_rc_gdaki_iface_t, uct_md_h tl_md,
797791
err_lock:
798792
ibv_dereg_mr(self->atomic_mr);
799793
err_atomic:
800-
cuMemFree(self->atomic_raw);
794+
(void)UCT_CUDADRV_FUNC_LOG_WARN(cuMemFree(self->atomic_raw));
801795
err_ctx:
802-
(void)UCT_CUDADRV_FUNC_LOG_WARN(cuCtxPopCurrent(NULL));
803-
err_ctx_release:
804-
(void)UCT_CUDADRV_FUNC_LOG_WARN(cuDevicePrimaryCtxRelease(self->cuda_dev));
796+
uct_cuda_ctx_primary_pop_and_release(self->cuda_dev);
805797
return status;
806798
}
807799

808800
static UCS_CLASS_CLEANUP_FUNC(uct_rc_gdaki_iface_t)
809801
{
810802
pthread_mutex_destroy(&self->ep_init_lock);
811803
ibv_dereg_mr(self->atomic_mr);
812-
cuMemFree(self->atomic_raw);
804+
(void)UCT_CUDADRV_FUNC_LOG_WARN(cuMemFree(self->atomic_raw));
813805
(void)UCT_CUDADRV_FUNC_LOG_WARN(cuDevicePrimaryCtxRelease(self->cuda_dev));
814806
}
815807

0 commit comments

Comments
 (0)