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

prov/efa: always use p2p for system memory #10392

Merged
merged 2 commits into from
Sep 18, 2024
Merged

Conversation

jiaxiyan
Copy link
Contributor

@jiaxiyan jiaxiyan commented Sep 17, 2024

For system memory, it should use p2p even with unregistered buffer. Otherwise it will affect performance.

@jiaxiyan jiaxiyan requested a review from a team September 17, 2024 22:59
@shijin-aws
Copy link
Contributor

I am concerned that deaa841 may also be impacted by this issue. You checked

efa_rdm_ep_use_p2p(ep, rxe->desc[0]);

to determine if we can do p2p for the receive buffer. If receive buffer is unregistered and on host, we should allow rdma read as well.

I think instead of adding such iface check everywhere, we should investigate whether we can just make efa_rdm_ep_use_p2p return true for unregistered buffer. You need to audit whether that change can cause any behavior change. My most concern is here https://github.com/ofiwg/libfabric/blob/main/prov/efa/src/rdm/efa_rdm_pke_utils.c#L69. But it looks it is called when we have a valid iov_mr, so it shouldn't cause a problem if we make efa_rdm_ep_use_p2p return true for NULL mr.

@jiaxiyan jiaxiyan changed the title prov/efa: try using rdma read when system memory is not registered prov/efa: always use p2p for system memory Sep 17, 2024
@@ -250,15 +250,15 @@ int efa_rdm_pke_get_available_copy_methods(struct efa_rdm_ep *ep,
bool *restrict gdrcopy_available)
{
int ret;
bool p2p_available;
bool mr_p2p_available;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to add a assert(efa_mr) here

/*
* always send from host buffers if we have a descriptor
* always send from host buffers no matter efa_mr is registered or not
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is not correct. We are not always sending from host buffers if efa_mr is NULL. For eager send, we will do a copy from host buffer to registered bounce buffer.

We can just change it to

P2p is always available for host memory (Unregistered buffer will be regarded as host memory as EFA provider requires FI_MR_HMEM)

P2P is always available for host memory. Unregistered buffer will be
regarded as host memory as EFA provider requires FI_MR_HMEM.

Signed-off-by: Jessie Yang <[email protected]>
Rename to mr_p2p_available to indicate that we check the mr is not NULL.

Signed-off-by: Jessie Yang <[email protected]>
@shijin-aws
Copy link
Contributor

Need to backport

@darrylabbate
Copy link
Member

I'm a little dubious of this change and can see it easily becoming a future bug. If the null txe->desc[0] being passed here was netting an undesired result, wouldn't it limit the blast radius to simply pass true for use_p2p in efa_rdm_msg_select_rtm() when txe->desc[0] is null?

I see that we've walked through every caller of efa_rdm_ep_use_p2p(), but changing the logic for the null parameter just strikes me as something that will surprise (and not delight) us later.

@shijin-aws
Copy link
Contributor

shijin-aws commented Sep 18, 2024

I'm a little dubious of this change and can see it easily becoming a future bug. If the null txe->desc[0] being passed here was netting an undesired result, wouldn't it limit the blast radius to simply pass true for use_p2p in efa_rdm_msg_select_rtm() when txe->desc[0] is null?

I see that we've walked through every caller of efa_rdm_ep_use_p2p(), but changing the logic for the null parameter just strikes me as something that will surprise (and not delight) us later.

I don't think it can become a bug, efa_rdm_ep_use_p2p should be interpreted as whether p2p can be used for a given MR. It is a valid deduction that NULL desc should be host memory, and we should always support p2p for host memory, I don't think it is wrong to make this function return true for NULL desc. It also saves changes everywhere to check desc[0] explicitly before calling efa_rdm_ep_use_p2p()

@shijin-aws shijin-aws merged commit 677bdeb into ofiwg:main Sep 18, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants