Fixes NCCLComm::abort() to use correct deregister API for window-registered handles - #181626
Fixes NCCLComm::abort() to use correct deregister API for window-registered handles#181626syed-ahmed wants to merge 1 commit into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/181626
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ✅ No FailuresAs of commit 2dc9e57 with merge base fc69434 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
|
08625fc to
7fa73cf
Compare
kwen2501
left a comment
There was a problem hiding this comment.
The code change looks better than making the wrong dereg call.
One thing I am unsure is whether we can guarantee successful wind dereg when we are about to abort a communicator (most likely the communicator is already corrupted).
| for (auto& it : registeredSegmentHandles_) { | ||
| void* handle = it.second; | ||
| void* handle = it.second.first; | ||
| bool window = it.second.second; |
There was a problem hiding this comment.
nit: use is_window so that it is less ambiguous?
There was a problem hiding this comment.
Thank you! Addressed.
| void* handle = it.second.first; | ||
| bool window = it.second.second; | ||
| #ifdef NCCL_HAS_COMM_WINDOW_REGISTER | ||
| if (window) { |
There was a problem hiding this comment.
nit: use if (window) as outer condition and #ifdef NCCL_HAS_COMM_WINDOW_REGISTER as inner condition, so that we can avoid duplicated code of the non-window call.
There was a problem hiding this comment.
Also addressed.
7fa73cf to
284031d
Compare
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: 8 mandatory check(s) failed. The first few are:
Dig deeper by viewing the failures on hud |
| std::unordered_map<void*, void*> registeredSegmentHandles_; | ||
| // Stores handlers for tensors registered by NCCL. | ||
| // Maps ptr -> (handle, is_window_registered). | ||
| std::unordered_map<void*, std::pair<void*, bool>> registeredSegmentHandles_; |
There was a problem hiding this comment.
May want update to ska_flat_hashmap at some point. Seems like this could be perf sensitive.
|
@pytorchbot merge |
|
@pytorchbot merge -r |
|
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
…ered handles NCCLComm::abort() unconditionally called ncclCommDeregister() on all entries in registeredSegmentHandles_. However, handles registered via ncclCommWindowRegister() (symmetric registration) require ncclCommWindowDeregister() instead. Using the wrong API causes NCCL to fail with "Deregister: Could not find handle" followed by a SIGABRT crash during ProcessGroupNCCL destruction. The fix tracks whether each handle was window-registered by changing registeredSegmentHandles_ from map<void*, void*> to map<void*, pair<void*, bool>>, and dispatches to the correct deregister call in abort(), matching the existing logic in deregisterSegment(). Fixes: pytorch#181610
|
Successfully rebased |
284031d to
2dc9e57
Compare
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: Commit 284031d was HEAD when comment 4334824401 was posted but now the latest commit on the PR is 2dc9e57. Please re-issue the merge command to merge the latest commit. Details for Dev Infra teamRaised by workflow job |
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
|
Thanks @Skylion007 for merging! |
…stered handles (pytorch#181626) `NCCLComm::abort()` unconditionally called `ncclCommDeregister()` on all entries in `registeredSegmentHandles_`. However, handles registered via `ncclCommWindowRegister()` (symmetric registration) require `ncclCommWindowDeregister()` instead. Using the wrong API causes NCCL to fail with "Deregister: Could not find handle" followed by a SIGABRT crash during ProcessGroupNCCL destruction. The fix tracks whether each handle was window-registered by changing `registeredSegmentHandles_` from `map<void*, void*>` to `map<void*, pair<void*, bool>>`, and dispatches to the correct deregister call in `abort()`, matching the existing logic in `deregisterSegment()`. Fixes: pytorch#181610 Assistant used: Claude Opus 4.7 (1M) Pull Request resolved: pytorch#181626 Approved by: https://github.com/kwen2501, https://github.com/Skylion007
…stered handles (pytorch#181626) `NCCLComm::abort()` unconditionally called `ncclCommDeregister()` on all entries in `registeredSegmentHandles_`. However, handles registered via `ncclCommWindowRegister()` (symmetric registration) require `ncclCommWindowDeregister()` instead. Using the wrong API causes NCCL to fail with "Deregister: Could not find handle" followed by a SIGABRT crash during ProcessGroupNCCL destruction. The fix tracks whether each handle was window-registered by changing `registeredSegmentHandles_` from `map<void*, void*>` to `map<void*, pair<void*, bool>>`, and dispatches to the correct deregister call in `abort()`, matching the existing logic in `deregisterSegment()`. Fixes: pytorch#181610 Assistant used: Claude Opus 4.7 (1M) Pull Request resolved: pytorch#181626 Approved by: https://github.com/kwen2501, https://github.com/Skylion007
…stered handles (pytorch#181626) `NCCLComm::abort()` unconditionally called `ncclCommDeregister()` on all entries in `registeredSegmentHandles_`. However, handles registered via `ncclCommWindowRegister()` (symmetric registration) require `ncclCommWindowDeregister()` instead. Using the wrong API causes NCCL to fail with "Deregister: Could not find handle" followed by a SIGABRT crash during ProcessGroupNCCL destruction. The fix tracks whether each handle was window-registered by changing `registeredSegmentHandles_` from `map<void*, void*>` to `map<void*, pair<void*, bool>>`, and dispatches to the correct deregister call in `abort()`, matching the existing logic in `deregisterSegment()`. Fixes: pytorch#181610 Assistant used: Claude Opus 4.7 (1M) Pull Request resolved: pytorch#181626 Approved by: https://github.com/kwen2501, https://github.com/Skylion007
NCCLComm::abort()unconditionally calledncclCommDeregister()on all entries inregisteredSegmentHandles_. However, handles registered viancclCommWindowRegister()(symmetric registration) requirencclCommWindowDeregister()instead. Using the wrong API causes NCCL to fail with "Deregister: Could not find handle" followed by a SIGABRT crash during ProcessGroupNCCL destruction.The fix tracks whether each handle was window-registered by changing
registeredSegmentHandles_frommap<void*, void*>tomap<void*, pair<void*, bool>>, and dispatches to the correct deregister call inabort(), matching the existing logic inderegisterSegment().Fixes: #181610
Assistant used: Claude Opus 4.7 (1M)