@@ -124,7 +124,8 @@ static ucs_status_t uct_cuda_ipc_close_memhandle(uct_cuda_ipc_cache_region_t *re
124
124
(CUdeviceptr )region -> mapped_addr , region -> key .b_len ));
125
125
}
126
126
} 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 ));
128
129
} else
129
130
#endif
130
131
{
@@ -335,20 +336,21 @@ static ucs_status_t uct_cuda_ipc_open_memhandle(uct_cuda_ipc_rkey_t *key,
335
336
CUdeviceptr * mapped_addr )
336
337
{
337
338
338
- #if HAVE_CUDA_FABRIC
339
339
ucs_trace ("key handle type %u" , key -> ph .handle_type );
340
340
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 );
346
350
#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 ;
352
354
}
353
355
}
354
356
0 commit comments