Skip to content

Commit 53c3142

Browse files
authored
UCT/CUDA/CUDA_IPC: Handle cuMemRelease error status. (#10827)
1 parent f0ca6f3 commit 53c3142

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

src/uct/cuda/cuda_ipc/cuda_ipc_cache.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -261,18 +261,14 @@ uct_cuda_ipc_open_memhandle_vmm(uct_cuda_ipc_rkey_t *key, CUdevice cu_dev,
261261
}
262262

263263
*mapped_addr = dptr;
264-
265-
status = UCT_CUDADRV_FUNC_LOG_ERR(cuMemRelease(handle));
266-
if (status == UCS_OK) {
267-
goto out;
268-
}
264+
goto release_handle;
269265

270266
unmap_range:
271-
cuMemUnmap(dptr, key->b_len);
267+
UCT_CUDADRV_FUNC_LOG_WARN(cuMemUnmap(dptr, key->b_len));
272268
release_va_range:
273-
cuMemAddressFree(dptr, key->b_len);
269+
UCT_CUDADRV_FUNC_LOG_WARN(cuMemAddressFree(dptr, key->b_len));
274270
release_handle:
275-
cuMemRelease(handle);
271+
UCT_CUDADRV_FUNC_LOG_WARN(cuMemRelease(handle));
276272
out:
277273
return status;
278274
}

src/uct/cuda/cuda_ipc/cuda_ipc_md.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,17 +184,12 @@ uct_cuda_ipc_mem_add_reg(void *addr, uct_cuda_ipc_memh_t *memh,
184184
UCT_CUDADRV_FUNC_LOG_ERR(cuMemExportToShareableHandle(
185185
&key->ph.handle.fabric_handle, handle,
186186
CU_MEM_HANDLE_TYPE_FABRIC, 0));
187+
UCT_CUDADRV_FUNC_LOG_WARN(cuMemRelease(handle));
187188
if (status != UCS_OK) {
188-
cuMemRelease(handle);
189189
ucs_debug("unable to export handle for VMM ptr: %p", addr);
190190
goto non_ipc;
191191
}
192192

193-
status = UCT_CUDADRV_FUNC_LOG_ERR(cuMemRelease(handle));
194-
if (status != UCS_OK) {
195-
goto out_pop_ctx;
196-
}
197-
198193
key->ph.handle_type = UCT_CUDA_IPC_KEY_HANDLE_TYPE_VMM;
199194
ucs_trace("packed vmm fabric handle for %p", addr);
200195
goto common_path;

0 commit comments

Comments
 (0)