Skip to content

Commit

Permalink
prov/efa: Only support HMEM in efa-direct if p2p support is available
Browse files Browse the repository at this point in the history
efa-direct provider does not support copy based protocols, so it cannot
support HMEM transfers if the HMEM device does not have p2p support.

Signed-off-by: Sai Sunku <[email protected]>
  • Loading branch information
sunkuamzn committed Jan 28, 2025
1 parent 864f64a commit 2437ba1
Showing 1 changed file with 32 additions and 5 deletions.
37 changes: 32 additions & 5 deletions prov/efa/src/efa_prov_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,20 +442,47 @@ static int efa_prov_info_set_nic_attr(struct fi_info *prov_info, struct efa_devi
}

#if HAVE_CUDA || HAVE_NEURON || HAVE_SYNAPSEAI
void efa_prov_info_set_hmem_flags(struct fi_info *prov_info)
void efa_prov_info_set_hmem_flags(struct fi_info *prov_info, enum efa_info_type info_type)
{
if (prov_info->ep_attr->type == FI_EP_RDM &&
(ofi_hmem_is_initialized(FI_HMEM_CUDA) ||
int i;
enum fi_hmem_iface iface;
struct efa_hmem_info *hmem_info;
bool enable_hmem = false;

if ((ofi_hmem_is_initialized(FI_HMEM_CUDA) ||
ofi_hmem_is_initialized(FI_HMEM_NEURON) ||
ofi_hmem_is_initialized(FI_HMEM_SYNAPSEAI))) {
if (info_type == EFA_INFO_RDM)
enable_hmem = true;

if (info_type == EFA_INFO_DIRECT) {
/* EFA direct only supports HMEM when p2p support is available */
EFA_HMEM_IFACE_FOREACH(i) {
iface = efa_hmem_ifaces[i];
hmem_info = &g_efa_hmem_info[iface];
if (hmem_info->initialized && !hmem_info->p2p_supported_by_device) {
EFA_WARN(FI_LOG_CORE,
"EFA direct provider was compiled with support for %s HMEM interface "
"but the interface does not support p2p transfers. "
"EFA direct provider does not support HMEM transfers without p2p support. "
"HMEM support will be disabled.\n", fi_tostr(&iface, FI_TYPE_HMEM_IFACE));
break;
}
}
enable_hmem = true;
}
}

if (enable_hmem) {
prov_info->caps |= FI_HMEM;
prov_info->tx_attr->caps |= FI_HMEM;
prov_info->rx_attr->caps |= FI_HMEM;
prov_info->domain_attr->mr_mode |= FI_MR_HMEM;
}

}
#else
void efa_prov_info_set_hmem_flags(struct fi_info *prov_info)
void efa_prov_info_set_hmem_flags(struct fi_info *prov_info, enum efa_info_type info_type)
{
}
#endif
Expand Down Expand Up @@ -533,7 +560,7 @@ int efa_prov_info_alloc(struct fi_info **prov_info_ptr,
goto err_free;
}

efa_prov_info_set_hmem_flags(prov_info);
efa_prov_info_set_hmem_flags(prov_info, info_type);

*prov_info_ptr = prov_info;
return 0;
Expand Down

0 comments on commit 2437ba1

Please sign in to comment.