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

rdma: defer connect completion after sending connect message #353

Closed
wants to merge 1 commit into from

Conversation

rauteric
Copy link
Contributor

In the current implementation of connect/accept, it is possible for accept to complete (i.e., return a non-NULL communicator) after the corresponding connect returned a NULL communicator (while waiting for a completion for the connection message). This is a strange semantic, and evidently causes NCCL to be unhappy, particularly in the multi-recv case (which is being added in a future commit).

So, after sending the connect message, defer waiting for completion; block when closing the send comm if necessary.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@rauteric rauteric requested a review from a team as a code owner February 23, 2024 00:36
src/nccl_ofi_rdma.c Outdated Show resolved Hide resolved
src/nccl_ofi_rdma.c Outdated Show resolved Hide resolved
src/nccl_ofi_rdma.c Show resolved Hide resolved
src/nccl_ofi_rdma.c Outdated Show resolved Hide resolved
src/nccl_ofi_rdma.c Outdated Show resolved Hide resolved
src/nccl_ofi_rdma.c Outdated Show resolved Hide resolved
include/nccl_ofi_rdma.h Outdated Show resolved Hide resolved
src/nccl_ofi_rdma.c Show resolved Hide resolved
src/nccl_ofi_rdma.c Outdated Show resolved Hide resolved
@rauteric rauteric force-pushed the connect_defer_completion branch from 4889515 to 6faa202 Compare February 23, 2024 19:21
src/nccl_ofi_rdma.c Outdated Show resolved Hide resolved
src/nccl_ofi_rdma.c Outdated Show resolved Hide resolved
@rauteric rauteric force-pushed the connect_defer_completion branch from 6faa202 to e87194a Compare February 23, 2024 21:37
include/nccl_ofi_rdma.h Outdated Show resolved Hide resolved
src/nccl_ofi_rdma.c Show resolved Hide resolved
src/nccl_ofi_rdma.c Show resolved Hide resolved
@rauteric rauteric force-pushed the connect_defer_completion branch 2 times, most recently from 0b7b8a0 to 2b5729b Compare February 26, 2024 19:56
@rauteric
Copy link
Contributor Author

Force-push to 0b7b8a0 is a rebase on master. Force-push to 2b5729b addresses feedback.

include/nccl_ofi_rdma.h Outdated Show resolved Hide resolved
src/nccl_ofi_rdma.c Show resolved Hide resolved
include/nccl_ofi_rdma.h Outdated Show resolved Hide resolved
src/nccl_ofi_rdma.c Outdated Show resolved Hide resolved
In the current implementation of connect/accept, it is possible for
`accept` to complete (i.e., return a non-NULL communicator) after the
corresponding `connect` returned a NULL communicator (while waiting for
a completion for the connection message). This is a strange semantic,
and evidently causes NCCL to be unhappy, particularly in the multi-recv
case (which is being added in a future commit).

So, after sending the connect message, defer waiting for completion;
block when closing the send comm if necessary.

Signed-off-by: Eric Raut <[email protected]>
@rauteric rauteric force-pushed the connect_defer_completion branch from 2b5729b to ae106d2 Compare February 26, 2024 22:40
include/nccl_ofi_rdma.h Show resolved Hide resolved
@rauteric rauteric added the BuildTriggerRequest CI build will be triggered when this label is set label Feb 27, 2024
@rauteric
Copy link
Contributor Author

I am seeing very occasional hangs in A2A during connection establishment in the multi-recv branch (not in this PR's branch, which does not have multi-recv). Yesterday it only happened a couple times, this morning it's been every 3-4 runs. So I'm not convinced this PR completely solves the multi-recv connection establishment issues. The lack of easy reproducibility makes it hard to debug.

@rauteric
Copy link
Contributor Author

I happened to notice that for some reason, with LTTNG tracing enabled, the aforementioned hang happens every time, even in this PR's branch that doesn't have multi-recv. Which makes the problem easier to debug. If I make connect blocking (block until we get a completion for the send connect message, as PR #348 originally did), the hang does not occur.

Working theory (needs verification): by returning a communicator to NCCL before the send connect message is sent, we no longer have a way to process the sender side's completion queue to ensure the message gets sent, leading to occasional deadlock.

But this needs more investigation, and can't be merged in its current state, so marking as Draft.

@rauteric rauteric marked this pull request as draft February 28, 2024 00:55
@AvivBenchorin AvivBenchorin added BuildTriggerRequest CI build will be triggered when this label is set and removed BuildTriggerRequest CI build will be triggered when this label is set labels Mar 3, 2024
@rauteric
Copy link
Contributor Author

The approach in this PR won't work (see explanation in previous comment), so closing. We'll need a different solution.

@rauteric rauteric closed this Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BuildTriggerRequest CI build will be triggered when this label is set
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants