From 7943a1b895fe9aefa852a71ac77ead83bb58543c Mon Sep 17 00:00:00 2001 From: Ian Ziemba Date: Tue, 19 Nov 2024 12:04:26 -0600 Subject: [PATCH] prov/cxi: Define FI_CXI_FORCE_DEV_REG_COPY 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 --- man/fi_cxi.7.md | 4 ++++ prov/cxi/include/cxip.h | 1 + prov/cxi/src/cxip_ep.c | 8 +++++--- prov/cxi/src/cxip_info.c | 7 +++++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/man/fi_cxi.7.md b/man/fi_cxi.7.md index 384026f0192..4c6e46d14cc 100644 --- a/man/fi_cxi.7.md +++ b/man/fi_cxi.7.md @@ -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: fi_info -p cxi -e diff --git a/prov/cxi/include/cxip.h b/prov/cxi/include/cxip.h index 4494b9b703a..68ea4c0ce7e 100644 --- a/prov/cxi/include/cxip.h +++ b/prov/cxi/include/cxip.h @@ -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; diff --git a/prov/cxi/src/cxip_ep.c b/prov/cxi/src/cxip_ep.c index bc5cc9ead2e..aebec245ef7 100644 --- a/prov/cxi/src/cxip_ep.c +++ b/prov/cxi/src/cxip_ep.c @@ -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: @@ -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); diff --git a/prov/cxi/src/cxip_info.c b/prov/cxi/src/cxip_info.c index af94964ab5f..f0da25e315e 100644 --- a/prov/cxi/src/cxip_info.c +++ b/prov/cxi/src/cxip_info.c @@ -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) @@ -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(); }