Skip to content

Commit 9a0bef0

Browse files
UCT/CUDA_IPC: address feedback
1 parent c488a4d commit 9a0bef0

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

src/uct/cuda/cuda_ipc/cuda_ipc_cache.c

+14-12
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ static ucs_status_t uct_cuda_ipc_close_memhandle(uct_cuda_ipc_cache_region_t *re
124124
(CUdeviceptr)region->mapped_addr, region->key.b_len));
125125
}
126126
} else if (region->key.ph.handle_type == UCT_CUDA_IPC_KEY_HANDLE_TYPE_MEMPOOL) {
127-
return UCT_CUDADRV_FUNC_LOG_WARN(cuMemFree((CUdeviceptr)region->mapped_addr));
127+
return UCT_CUDADRV_FUNC_LOG_WARN(
128+
cuMemFree((CUdeviceptr)region->mapped_addr));
128129
} else
129130
#endif
130131
{
@@ -335,20 +336,21 @@ static ucs_status_t uct_cuda_ipc_open_memhandle(uct_cuda_ipc_rkey_t *key,
335336
CUdeviceptr *mapped_addr)
336337
{
337338

338-
#if HAVE_CUDA_FABRIC
339339
ucs_trace("key handle type %u", key->ph.handle_type);
340340

341-
if (key->ph.handle_type == UCT_CUDA_IPC_KEY_HANDLE_TYPE_VMM) {
342-
return uct_cuda_ipc_open_memhandle_vmm(key, mapped_addr);
343-
} else if (key->ph.handle_type == UCT_CUDA_IPC_KEY_HANDLE_TYPE_MEMPOOL) {
344-
return uct_cuda_ipc_open_memhandle_mempool(key, mapped_addr);
345-
} else
341+
switch(key->ph.handle_type) {
342+
case UCT_CUDA_IPC_KEY_HANDLE_TYPE_LEGACY:
343+
return uct_cuda_ipc_open_memhandle_legacy(key->ph.handle.legacy,
344+
mapped_addr);
345+
#if HAVE_CUDA_FABRIC
346+
case UCT_CUDA_IPC_KEY_HANDLE_TYPE_VMM:
347+
return uct_cuda_ipc_open_memhandle_vmm(key, mapped_addr);
348+
case UCT_CUDA_IPC_KEY_HANDLE_TYPE_MEMPOOL:
349+
return uct_cuda_ipc_open_memhandle_mempool(key, mapped_addr);
346350
#endif
347-
if (key->ph.handle_type == UCT_CUDA_IPC_KEY_HANDLE_TYPE_LEGACY) {
348-
return uct_cuda_ipc_open_memhandle_legacy(key->ph.handle.legacy,
349-
mapped_addr);
350-
} else {
351-
return UCS_ERR_INVALID_PARAM;
351+
default:
352+
ucs_error("unsupported key handle type");
353+
return UCS_ERR_INVALID_PARAM;
352354
}
353355
}
354356

src/uct/cuda/cuda_ipc/cuda_ipc_md.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ uct_cuda_ipc_mem_add_reg(void *addr, uct_cuda_ipc_memh_t *memh,
219219
#endif
220220
legacy_path:
221221
key->ph.handle_type = UCT_CUDA_IPC_KEY_HANDLE_TYPE_LEGACY;
222-
status = UCT_CUDADRV_FUNC_LOG_ERR(cuIpcGetMemHandle(&key->ph.handle.legacy,
223-
(CUdeviceptr)addr));
222+
status = UCT_CUDADRV_FUNC_LOG_ERR(
223+
cuIpcGetMemHandle(&key->ph.handle.legacy, (CUdeviceptr)addr));
224224
if (status != UCS_OK) {
225225
goto err;
226226
}

0 commit comments

Comments
 (0)