Conversation
Summary: ## Summary D92104317 added `ncclCommGetAsyncError()` polling in the TorchComms timeout watchdog thread to detect asynchronous NCCL errors. This broke the `DeviceApiTest.DeviceWindowCreationFloat` test when GIN (GPU-Initiated Networking) is enabled with GDAKI (`NCCL_GIN_TYPE=3`). ### Root Cause `ncclCommGetAsyncError()` internally calls `ncclGinQueryLastError()`, which iterates over all GIN contexts and queries GDAKI QP error states via `doca_gpu_verbs_query_last_error()`. The problem is that GIN context creation (`ncclGinConnectOnce` → `ncclGinGdakiCreateContext`) happens lazily — triggered inside any collective call (`ncclAllReduce`, etc.) that needs new transport channels. During this initialization, IB QPs are still transitioning through states (INIT → RTR → RTS) and `doca_gpu_verbs_query_last_error()` reports spurious errors that surface as `ncclRemoteError`. Since the watchdog thread runs concurrently and polls `ncclCommGetAsyncError()` on a timer, it races with GIN context creation happening on the main thread inside NCCL collective calls. The watchdog sees the false-positive `ncclRemoteError` and calls `abort()`, crashing all 8 ranks. ### Fix Gate the GIN error query block in `ncclCommGetAsyncError()` on `ginState->connected`, which is only set to `true` at the end of `ncclGinConnectOnce()` after all GIN contexts are fully created and QPs have completed their IB state transitions. This skips the query entirely during the vulnerable initialization window while still checking for real GIN errors once the subsystem is ready. Differential Revision: D92623789
Contributor
Contributor
|
This pull request has been merged in 8de4962. |
Chao1Han
pushed a commit
to Chao1Han/torchcomms
that referenced
this pull request
Feb 27, 2026
…meta-pytorch#596) Summary: Pull Request resolved: meta-pytorch#596 ## Summary D92104317 added `ncclCommGetAsyncError()` polling in the TorchComms timeout watchdog thread to detect asynchronous NCCL errors. This broke the `DeviceApiTest.DeviceWindowCreationFloat` test when GIN (GPU-Initiated Networking) is enabled with GDAKI (`NCCL_GIN_TYPE=3`). ### Root Cause `ncclCommGetAsyncError()` internally calls `ncclGinQueryLastError()`, which iterates over all GIN contexts and queries GDAKI QP error states via `doca_gpu_verbs_query_last_error()`. The problem is that GIN context creation (`ncclGinConnectOnce` → `ncclGinGdakiCreateContext`) happens lazily — triggered inside any collective call (`ncclAllReduce`, etc.) that needs new transport channels. During this initialization, IB QPs are still transitioning through states (INIT → RTR → RTS) and `doca_gpu_verbs_query_last_error()` reports spurious errors that surface as `ncclRemoteError`. Since the watchdog thread runs concurrently and polls `ncclCommGetAsyncError()` on a timer, it races with GIN context creation happening on the main thread inside NCCL collective calls. The watchdog sees the false-positive `ncclRemoteError` and calls `abort()`, crashing all 8 ranks. ### Fix Gate the GIN error query block in `ncclCommGetAsyncError()` on `ginState->connected`, which is only set to `true` at the end of `ncclGinConnectOnce()` after all GIN contexts are fully created and QPs have completed their IB state transitions. This skips the query entirely during the vulnerable initialization window while still checking for real GIN errors once the subsystem is ready. Reviewed By: d4l3k Differential Revision: D92623789 fbshipit-source-id: 7ace969103c3098a6e97254c91ace40cbc8140d0
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.
Summary:
Summary
D92104317 added
ncclCommGetAsyncError()polling in the TorchComms timeout watchdog thread to detect asynchronous NCCL errors. This broke theDeviceApiTest.DeviceWindowCreationFloattest when GIN (GPU-Initiated Networking) is enabled with GDAKI (NCCL_GIN_TYPE=3).Root Cause
ncclCommGetAsyncError()internally callsncclGinQueryLastError(), which iterates over all GIN contexts and queries GDAKI QP error states viadoca_gpu_verbs_query_last_error(). The problem is that GIN context creation (ncclGinConnectOnce→ncclGinGdakiCreateContext) happens lazily — triggered inside any collective call (ncclAllReduce, etc.) that needs new transport channels. During this initialization, IB QPs are still transitioning through states (INIT → RTR → RTS) anddoca_gpu_verbs_query_last_error()reports spurious errors that surface asncclRemoteError.Since the watchdog thread runs concurrently and polls
ncclCommGetAsyncError()on a timer, it races with GIN context creation happening on the main thread inside NCCL collective calls. The watchdog sees the false-positivencclRemoteErrorand callsabort(), crashing all 8 ranks.Fix
Gate the GIN error query block in
ncclCommGetAsyncError()onginState->connected, which is only set totrueat the end ofncclGinConnectOnce()after all GIN contexts are fully created and QPs have completed their IB state transitions. This skips the query entirely during the vulnerable initialization window while still checking for real GIN errors once the subsystem is ready.Differential Revision: D92623789