Skip to content

Commit

Permalink
prov/cxi: Define FI_CXI_FORCE_DEV_REG_COPY
Browse files Browse the repository at this point in the history
FI_CXI_FORCE_DEV_REG_COPY will force the CXI provider to use the HMEM
device register copy routines. If not supported, RDMA operations or
memory registration will fail.

Signed-off-by: Ian Ziemba <[email protected]>
  • Loading branch information
iziemba committed Nov 20, 2024
1 parent 3372122 commit 7943a1b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
4 changes: 4 additions & 0 deletions man/fi_cxi.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -1301,6 +1301,10 @@ The CXI provider checks for the following environment variables:
: Max amount of time to poll when LE invalidate disabling an MR configured with MR
match events.

*FI_CXI_FORCE_DEV_REG_COPY*
: Force the CXI provider to use the HMEM device register copy routines. If not
supported, RDMA operations or memory registration will fail.

Note: Use the fi_info utility to query provider environment variables:
<code>fi_info -p cxi -e</code>

Expand Down
1 change: 1 addition & 0 deletions prov/cxi/include/cxip.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ struct cxip_environment {
int hybrid_unexpected_msg_preemptive;
size_t mr_cache_events_disable_poll_nsecs;
size_t mr_cache_events_disable_le_poll_nsecs;
int force_dev_reg_copy;
};

extern struct cxip_environment cxip_env;
Expand Down
8 changes: 5 additions & 3 deletions prov/cxi/src/cxip_ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -1187,8 +1187,10 @@ int cxip_ep_setopt_priv(struct cxip_ep *ep, int level, int optname,
if (!cuda_api_permitted && !cuda_is_gdrcopy_enabled())
return -FI_EOPNOTSUPP;

ep->ep_obj->require_dev_reg_copy[FI_HMEM_CUDA] =
!cuda_api_permitted;
if (!cxip_env.force_dev_reg_copy) {
ep->ep_obj->require_dev_reg_copy[FI_HMEM_CUDA] =
!cuda_api_permitted;
}
break;

default:
Expand Down Expand Up @@ -1296,7 +1298,7 @@ int cxip_alloc_endpoint(struct cxip_domain *cxip_dom, struct fi_info *hints,
* disables it.
*/
for (i = 0; i < OFI_HMEM_MAX; i++)
ep_obj->require_dev_reg_copy[i] = false;
ep_obj->require_dev_reg_copy[i] = cxip_env.force_dev_reg_copy;

ofi_atomic_initialize32(&ep_obj->txq_ref, 0);
ofi_atomic_initialize32(&ep_obj->tgq_ref, 0);
Expand Down
7 changes: 7 additions & 0 deletions prov/cxi/src/cxip_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,7 @@ struct cxip_environment cxip_env = {
CXIP_MR_CACHE_EVENTS_DISABLE_POLL_NSECS,
.mr_cache_events_disable_le_poll_nsecs =
CXIP_MR_CACHE_EVENTS_DISABLE_LE_POLL_NSECS,
.force_dev_reg_copy = false,
};

static void cxip_env_init(void)
Expand Down Expand Up @@ -1288,6 +1289,12 @@ static void cxip_env_init(void)
fi_param_get_size_t(&cxip_prov, "mr_cache_events_disable_le_poll_nsecs",
&cxip_env.mr_cache_events_disable_le_poll_nsecs);

fi_param_define(&cxip_prov, "force_dev_reg_copy", FI_PARAM_BOOL,
"Force device register copy operations. Default: %d",
cxip_env.force_dev_reg_copy);
fi_param_get_bool(&cxip_prov, "force_dev_reg_copy",
&cxip_env.force_dev_reg_copy);

set_system_page_size();
}

Expand Down

0 comments on commit 7943a1b

Please sign in to comment.