Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove support for not creating local MRs #796

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
5 changes: 1 addition & 4 deletions include/nccl_ofi.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ extern int nic_dup_conns;
read in the polling loop without protection of a lock. */
extern size_t cq_read_count;

/* Indicates if memory registration of local buffers is required */
extern bool local_mr;

/* Indicates if endpoint memory registration is required */
extern bool endpoint_mr;

Expand Down Expand Up @@ -745,7 +742,7 @@ int nccl_net_ofi_dealloc_mr_buffer(void *ptr, size_t size);
* @return 0 (Success)
*
* Set required behavior flags (and print debugging information) for
* local_mr, virt_addr_mr, and endpoint_mr.
* virt_addr_mr, and endpoint_mr.
*/
int nccl_net_ofi_query_provider_capabilities(const struct fi_info *selected_provider,
unsigned int num_providers);
Expand Down
13 changes: 0 additions & 13 deletions src/nccl_ofi_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ int nic_dup_conns = 0;
read in the polling loop without protection of a lock. */
size_t cq_read_count = 1;

/* Indicates if memory registration of local buffers is required */
bool local_mr = false;
/* Indicates if endpoint memory registration is required */
bool endpoint_mr = false;

Expand Down Expand Up @@ -613,17 +611,6 @@ int nccl_net_ofi_query_provider_capabilities(const struct fi_info *selected_prov
}
}

/* Check if provider requires local memory registration */
if (selected_provider->domain_attr->mr_mode & FI_MR_LOCAL) {
NCCL_OFI_TRACE(NCCL_INIT | NCCL_NET, "Provider %s requires registration of local memory buffers",
selected_provider->fabric_attr->prov_name);
local_mr = true;
} else {
NCCL_OFI_TRACE(NCCL_INIT | NCCL_NET, "Provider %s does not require registration of local memory buffers",
selected_provider->fabric_attr->prov_name);
local_mr = false;
}

/* Check if provider uses remote virtual addressing */
if (selected_provider->domain_attr->mr_mode & FI_MR_VIRT_ADDR) {
NCCL_OFI_TRACE(NCCL_INIT | NCCL_NET, "Provider %s uses remote virtual addressing",
Expand Down
30 changes: 12 additions & 18 deletions src/nccl_ofi_rdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -3832,25 +3832,19 @@ static int alloc_and_reg_flush_buff(nccl_net_ofi_rdma_recv_comm_t *r_comm, int d
/* make sure flush destination address does not overflow beyond host buffer */
assert(((cpu_cache_line_size * ep->num_rails) + flush_buff->size) <= system_page_size);

/* Check if provider requires registration of local buffers */
if (local_mr == true) {
/* Register flush dummy buffer for provider access */
ret = reg_internal_mr_ep(ep, flush_buff->host_buffer, system_page_size,
NCCL_PTR_HOST, &mr_handle);
if (OFI_UNLIKELY(ret != 0)) {
NCCL_OFI_WARN("Could not register dummy buffer for flush, dev: %d",
dev_id);
rc = nccl_net_ofi_dealloc_mr_buffer(flush_buff->host_buffer,
system_page_size);
if (rc != 0) {
NCCL_OFI_WARN("Unable to deallocate flush buffer (%d)",
rc);
}
flush_buff->host_buffer = MAP_FAILED;
/* Register flush dummy buffer for provider access */
ret = reg_internal_mr_ep(ep, flush_buff->host_buffer, system_page_size,
NCCL_PTR_HOST, &mr_handle);
if (OFI_UNLIKELY(ret != 0)) {
NCCL_OFI_WARN("Could not register dummy buffer for flush, dev: %d",
dev_id);
rc = nccl_net_ofi_dealloc_mr_buffer(flush_buff->host_buffer,
system_page_size);
if (rc != 0) {
NCCL_OFI_WARN("Unable to deallocate flush buffer (%d)",
rc);
}
} else {
NCCL_OFI_TRACE(NCCL_NET,
"Skip registering host buffer. local_mr: %d", local_mr);
flush_buff->host_buffer = MAP_FAILED;
}

flush_buff->mr_handle = mr_handle;
Expand Down
30 changes: 1 addition & 29 deletions src/nccl_ofi_sendrecv.c
Original file line number Diff line number Diff line change
Expand Up @@ -538,17 +538,6 @@ static inline struct fid_domain* sendrecv_endpoint_get_ofi_domain(nccl_net_ofi_s
return domain->domain;
}

/*
* @brief Returns whether the registration of local buffers is not required by
* the provider.
*
* @return true if registration is not required; otherwise, false
*/

static bool sendrecv_mr_buffer_skip_local_registration(int type) {
return (local_mr != true) && (type == NCCL_PTR_HOST);
}

/*
* @brief Registers memory region (both HOST and CUDA)
*
Expand All @@ -568,18 +557,6 @@ static int sendrecv_mr_buffers_register(struct fid_domain *domain,
struct fi_mr_attr mr_attr = {};
uint64_t regattr_flags = 0;

/* Check if provider requires registration of local buffers */
if (sendrecv_mr_buffer_skip_local_registration(type)) {
NCCL_OFI_TRACE(NCCL_NET,
"Skip registering host buffer. local_mr: %d", local_mr);
/* the mr handle will still be threaded through NCCL,
* so we still need some sentinal to tell us not to try
* and use the registration. NULL is as good as any.
*/
*mr_handle = NULL;
goto exit;
}

mr_attr.access = FI_SEND | FI_RECV;
nccl_ofi_mr_ckey_fill_mr_attrs(ckey, &mr_attr, &regattr_flags);
switch (type) {
Expand Down Expand Up @@ -822,11 +799,6 @@ static int sendrecv_comm_mr_base_reg(nccl_net_ofi_comm_t *base_comm,
nccl_ofi_mr_cache_t *mr_cache = domain->base.mr_cache;
void *ret_handle = NULL;

if (sendrecv_mr_buffer_skip_local_registration(type)) {
/* Registraton and caching are unnecessary */
goto exit;
}

if (mr_cache) {
/*
* MR cache is locked between lookup and insert, to be sure we
Expand Down Expand Up @@ -870,7 +842,7 @@ static int sendrecv_comm_mr_base_reg(nccl_net_ofi_comm_t *base_comm,
if (mr_cache) {
nccl_net_ofi_mutex_unlock(&mr_cache->lock);
}
exit:

*mhandle = ret_handle;
return ret;
}
Expand Down
Loading