Repository navigation
Conversation
Problem: commDestroySync() blocks until every CUDA graph that captured an operation on the communicator is destroyed. If a graph stays alive, ncclCommFinalize never returns and prints nothing, so nothing points the user at the graph. Solution: poll without blocking for the first 5 s, because graph destructors run asynchronously and a short wait is normal. If captured operations are still referenced after that, print one WARN and return to the blocking wait. Signed-off-by: 0z5a <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
|
/mirror dev |
Contributor
|
Thanks @0z5a! moving to internal review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
ncclCommFinalizewaits incommDestroySync()until every CUDA graph that captured an operation on the communicator is destroyed. If such a graph stays alive, finalize blocks and prints nothing. #2568 hit this through PyTorch'sdestroy_process_group, with graphs kept bytorch.compile(mode="reduce-overhead").With this change, each waiting rank prints one WARN after 5 s:
The wait itself does not change: finalize still returns once the graphs are destroyed.
Related Issues
Implements the logging part of #2568. It does not add periodic messages, or the optional timeout or env var.
Changes & Impact
src/init.cc,commDestroySync():comm->localPersistentRefs, the number of captured plans, not the number of graphs.NCCL_DEBUG=WARNdoes not print ATTN.ncclCommDestroywithoutncclCommFinalizereaches this wait underNOWARN(..., NCCL_DESTROY), so there the message is logged as INFO under theDESTROYsubsystem.dev.masterhas the same loop, but this diff does not apply there directly because the surrounding lines differ.Validation
devb00866bvs this change. One aarch64 host with a GH200 GPU, two processes on that GPU (NCCL_MULTI_RANK_GPU_ENABLE=1), bootstrap throughNCCL_COMM_ID,NCCL_DEBUG=WARN. The probe captures anncclAllReducein a CUDA graph, replays it, then callsncclCommFinalize. One run per row.The "never captured" row for this PR ran on a revision with the same logic and different message text. The other two rows for this PR ran on the final commit.
Not exercised: a graph destroyed during the first 5 s of the wait, the
ncclCommDestroy-only path, and nonblocking communicators.Performance Impact
None on collectives. Only the finalize path changes.