Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/uct/cuda/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ noinst_HEADERS = \
cuda_copy/cuda_copy_iface.h \
cuda_copy/cuda_copy_ep.h \
cuda_ipc/cuda_ipc_md.h \
cuda_ipc/cuda_ipc_vmm_multi.h \
cuda_ipc/cuda_ipc_iface_address.h \
cuda_ipc/cuda_ipc_iface.h \
cuda_ipc/cuda_ipc_ep.h \
Expand All @@ -47,6 +48,7 @@ libuct_cuda_la_SOURCES = \
cuda_copy/cuda_copy_iface.c \
cuda_copy/cuda_copy_ep.c \
cuda_ipc/cuda_ipc_md.c \
cuda_ipc/cuda_ipc_vmm_multi.c \
cuda_ipc/cuda_ipc_iface_address.c \
cuda_ipc/cuda_ipc_iface.c \
cuda_ipc/cuda_ipc_ep.c \
Expand Down
10 changes: 10 additions & 0 deletions src/uct/cuda/cuda_ipc/cuda_ipc.inl
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ uct_cuda_ipc_check_and_pop_ctx(int is_ctx_pushed)
}
}

#if HAVE_CUDA_FABRIC || HAVE_DECL_SYS_PIDFD_GETFD
static UCS_F_ALWAYS_INLINE void
uct_cuda_ipc_init_access_desc(CUmemAccessDesc *access_desc, CUdevice cu_dev)
{
access_desc->location.type = CU_MEM_LOCATION_TYPE_DEVICE;
access_desc->flags = CU_MEM_ACCESS_FLAGS_PROT_READWRITE;
access_desc->location.id = cu_dev;
}
#endif

static UCS_F_ALWAYS_INLINE int
uct_cuda_ipc_is_rkey_local(pid_t rkey_pid, ucs_sys_ns_t rkey_pid_ns)
{
Expand Down
8 changes: 0 additions & 8 deletions src/uct/cuda/cuda_ipc/cuda_ipc_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,14 +300,6 @@ uct_cuda_ipc_open_memhandle_legacy(CUipcMemHandle memh, CUdevice cu_dev,
}

#if HAVE_CUDA_FABRIC || HAVE_DECL_SYS_PIDFD_GETFD
static void
uct_cuda_ipc_init_access_desc(CUmemAccessDesc *access_desc, CUdevice cu_dev)
{
access_desc->location.type = CU_MEM_LOCATION_TYPE_DEVICE;
access_desc->flags = CU_MEM_ACCESS_FLAGS_PROT_READWRITE;
access_desc->location.id = cu_dev;
}

static ucs_status_t
uct_cuda_ipc_open_memhandle_vmm(const uct_cuda_ipc_rkey_t *key, CUdevice cu_dev,
CUdeviceptr *mapped_addr,
Expand Down
8 changes: 8 additions & 0 deletions src/uct/cuda/cuda_ipc/cuda_ipc_md.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "cuda_ipc.inl"
#include "cuda_ipc_cache.h"
#include "cuda_ipc_md.h"
#include "cuda_ipc_vmm_multi.h"

#include <ucs/debug/log.h>
#include <ucs/debug/memtrack_int.h>
Expand Down Expand Up @@ -333,6 +334,10 @@ uct_cuda_ipc_mem_add_reg(void *addr, uct_cuda_ipc_memh_t *memh,
return UCS_ERR_NO_MEMORY;
}

#if HAVE_CUDA_FABRIC
ucs_list_head_init(&key->vmm_multi_list);
#endif

status = uct_cuda_ipc_check_and_push_ctx((CUdeviceptr)addr, &cuda_device,
&is_ctx_pushed);
if (status != UCS_OK) {
Expand Down Expand Up @@ -687,6 +692,9 @@ uct_cuda_ipc_mem_dereg(uct_md_h md, const uct_md_mem_dereg_params_t *params)
UCT_MD_MEM_DEREG_CHECK_PARAMS(params, 0);

ucs_list_for_each_safe(key, tmp, &memh->list, link) {
#if HAVE_CUDA_FABRIC
uct_cuda_ipc_vmm_multi_meta_cleanup(key);
#endif
if (key->ph.handle_type == UCT_CUDA_IPC_KEY_HANDLE_TYPE_POSIX_FD) {
close(key->ph.handle.posix_fd.fd);
}
Expand Down
18 changes: 18 additions & 0 deletions src/uct/cuda/cuda_ipc/cuda_ipc_md.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@ typedef enum {
} uct_cuda_ipc_key_handle_t;


#if HAVE_CUDA_FABRIC
/**
* @brief Inline description of VMM multi-chunk metadata
*/
typedef struct {
uint8_t version;
uint8_t reserved;
uint16_t num_chunks;
uint16_t info_size;
uint16_t chunk_desc_size;
size_t alloc_size;
Comment thread
tomerg-nvidia marked this conversation as resolved.
} uct_cuda_ipc_vmm_multi_info_t;
Comment thread
tomerg-nvidia marked this conversation as resolved.
#endif


typedef struct uct_cuda_ipc_md_handle {
uct_cuda_ipc_key_handle_t handle_type;
union {
Expand Down Expand Up @@ -138,6 +153,9 @@ typedef struct {
CUdeviceptr d_bptr; /* Allocation base address */
size_t b_len; /* Allocation size */
ucs_list_link_t link;
#if HAVE_CUDA_FABRIC
ucs_list_link_t vmm_multi_list; /* Published VMM metadata */
#endif
} uct_cuda_ipc_lkey_t;


Expand Down
Loading
Loading