Skip to content

Wire symmetric memory operations to the distributed watchdog - #193834

Open
thisisatharva-rh wants to merge 8 commits into
pytorch:mainfrom
thisisatharva-rh:watchdog-symm-mem-integration
Open

thisisatharva-rh wants to merge 8 commits into
pytorch:mainfrom
thisisatharva-rh:watchdog-symm-mem-integration

Conversation

@thisisatharva-rh

@thisisatharva-rh thisisatharva-rh commented Aug 17, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Integrates the torch.distributed._watchdog timeout machinery into symmetric memory's blocking and stream-based operations so that hangs in multi-process rendezvous or one-sided NCCL ops are detected and surfaced instead of blocking silently.

Test Plan

python test/distributed/test_symmetric_memory.py -k SymmMemWatchdogUnitTest
torchrun --nproc_per_node=2 test/distributed/test_nccl.py -k NCCLSymmMemWatchdogTest

Authored with AI assistance

@pytorch-bot

pytorch-bot Bot commented Aug 17, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/193834

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure, 5 Unrelated Failures

As of commit cb0cafa with merge base ed7b350 (image):

NEW FAILURE - The following job has failed:

  • pull / linux-noble-xpu-n-py3.10 / build (gh)
    Could not load credentials from any providers

    AI verdict: AI verdict: infra issue

    The failure is an AWS credentials loading error ("Could not load credentials from any providers") during CI job setup, completely unrelated to the commit which only changes a Python variable default value in symmetric memory code.

    Full reasoning on HUD →

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

CRCR (non-blocking) - The following CRCR downstream CI jobs failed but are non-blocking:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot Bot added ciflow/h100-symm-mem ciflow/torchtitan Run TorchTitan integration tests labels Aug 17, 2026
@pytorch-bot

pytorch-bot Bot commented Aug 17, 2026 •

Copy link
Copy Markdown

Workflows were awaiting approval. CI has now been triggered for the ciflow labels on this PR.

@pytorch-bot

pytorch-bot Bot commented Aug 17, 2026

Copy link
Copy Markdown

The following ciflow label(s) have been added but CI has not been triggered yet because the workflows are awaiting approval:

  • ciflow/h100-symm-mem
  • ciflow/torchtitan

Once a maintainer approves the workflows (scroll to the bottom of the PR page), the corresponding CI jobs will be triggered automatically. Please ping one of the reviewers if you do not have access to approve and run workflows.

@thisisatharva-rh
thisisatharva-rh force-pushed the watchdog-symm-mem-integration branch from fd10ee7 to 1613bca Compare August 19, 2026 13:27
@thisisatharva-rh
thisisatharva-rh marked this pull request as ready for review August 19, 2026 15:24
@janeyx99
janeyx99 requested a review from d4l3k August 21, 2026 06:53
@janeyx99 janeyx99 added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Aug 21, 2026
@thisisatharva-rh
thisisatharva-rh requested a review from a team as a code owner August 21, 2026 17:27

@d4l3k d4l3k left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks good to me but want to be a little cautious about rollout. There's some perf impact with graphs with events on the main thread that @dolpm mentioned

cc @kwen2501, @fduwjj from nvidia

stream_timeout(_watchdog_timeout)


def wait_signal(hdl: _SymmetricMemory, peer: int) -> None:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

would be good to add explicit per op timeout fields as well

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

still relevant

group_name,
)
_group_name_to_workspace_tensor[group_name] = tensor
if _watchdog_timeout is not None:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can we gate these to not run if we're capturing for cudagraphs right now? cc @dolpm

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

idt you even need to gate it - it'd just be a no-op for replay anyway

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i'm having a hard time understanding why we don't use external events here, which would work for both cases tho.

@thisisatharva-rh thisisatharva-rh Aug 25, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

i'm fairly new to cudagraphs, not using external events was a bad choice. i'll switch that

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@dolpm could you clarify a couple of things to me (and sorry if they are n00b questions)

  1. when you say external events would work for both cases, do you mean watchdog should catch a hang in the replayed graph or it shouldn't misbehave during capture. what's got me confused is that the cpu-side deadline is when stream_timeout runs and under capture that's at capture time. under replay, when the op runs, the timer's clock and the ops lifetime would be at different points in time.
  2. according to what i understand, external events need to stay valid for the graphs lifetime. the watchdog currently destroys the event once the monitor retires. so i would assume cleanup be tied to the graphs lifetime, or is there a simpler pattern here?

@d4l3k
d4l3k requested review from fduwjj, kapilsh and kwen2501 August 21, 2026 19:02
@dolpm
dolpm self-requested a review August 24, 2026 15:10
d4l3k
d4l3k previously approved these changes Aug 26, 2026

@d4l3k d4l3k left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM with a few comments

stream_timeout(_watchdog_timeout)


def wait_signal(hdl: _SymmetricMemory, peer: int) -> None:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

still relevant

Signed-off-by: thisisatharva-rh <[email protected]>
Signed-off-by: thisisatharva-rh <[email protected]>
Signed-off-by: thisisatharva-rh <[email protected]>
Signed-off-by: thisisatharva-rh <[email protected]>
@thisisatharva-rh
thisisatharva-rh force-pushed the watchdog-symm-mem-integration branch from 0e59775 to d62f7da Compare August 26, 2026 20:23
Signed-off-by: thisisatharva-rh <[email protected]>
Signed-off-by: thisisatharva-rh <[email protected]>
@thisisatharva-rh

Copy link
Copy Markdown
Collaborator Author

@pytorchbot label "topic: not user facing"

@pytorch-bot pytorch-bot Bot added the topic: not user facing topic category label Aug 28, 2026
@thisisatharva-rh

Copy link
Copy Markdown
Collaborator Author

@pytorchmergebot merge

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Aug 28, 2026
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

@huydhn

huydhn commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

@pytorchbot revert -m 'Sorry for reverting your PR but the tests are failing internally' -c ghfirst

The agent analysis:

## Automated CI Failure Analysis

### Diff summary
DiffTrain import of pytorch/pytorch PR #193834, wiring the `torch.distributed._watchdog` timeout machinery into symmetric memory: adds `set_watchdog_timeout`/`get_watchdog_timeout`/`_resolve_watchdog_timeout`/`_stream_is_capturing` and per-op `timeout=` arguments to `rendezvous`/`put_signal`/`wait_signal` in `caffe2/torch/distributed/_symmetric_memory/__init__.py`. Also adds new test classes `SymmMemWatchdogUnitTest` and `NCCLSymmMemWatchdogTest`.

### Failing signals
1. **`fbcode//caffe2/test/distributed:symmetric_memory` — `SymmMemWatchdogUnitTest.test_rendezvous_no_timeout_by_default`, `test_put_signal_no_timeout_by_default`, `test_wait_signal_no_timeout_by_default`** — `AssertionError: Expected 'stream_timeout'/'cpu_timeout' to not have been called. Called 1 times. Calls: [call(datetime.timedelta(seconds=600))]` — **Related** (all three are new tests added by this diff and share the single error cluster `1050110530961943`).

### Root cause
The diff sets the module-level default `_watchdog_timeout: float | timedelta | None = timedelta(minutes=10)`, but the three `*_no_timeout_by_default` tests assert that **no** watchdog call happens when the caller never invoked `set_watchdog_timeout`. With no timeout configured, `_resolve_watchdog_timeout(None)` returns the 10-minute default, so `stream_timeout(timedelta(seconds=600))` / `cpu_timeout(...)` fires — matching the exact 600s value in the assertion message.

These tests only pass when an earlier test in the same process has already run `SymmMemWatchdogUnitTest.tearDown()` (which resets the global to `None`). Under Buck's `--exact` per-test isolation each runs standalone and fails deterministically.

Suggested fix: either make the default `None`, or have the three tests call `symm_mem.set_watchdog_timeout(None)` in `setUp` rather than relying on `tearDown` ordering.

### Conclusion
**Related.** `error-clusters list --status=failed` returns exactly one cluster and it is fully attributable to this diff's own code and tests. Not systemic, not infrastructure — needs a fix before landing.

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@pytorchbot successfully started a revert job. Check the current status here.
Questions? Feedback? Please reach out to the PyTorch DevX Team

pytorchmergebot added a commit that referenced this pull request Sep 2, 2026
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@thisisatharva-rh your PR has been successfully reverted.

@pytorchmergebot pytorchmergebot added Reverted ci-no-td Do not run TD on this PR labels Sep 2, 2026
@pytorch-bot
pytorch-bot Bot dismissed d4l3k’s stale review September 2, 2026 01:10

This PR was reopened (likely due to being reverted), so your approval was removed. Please request another review.

Signed-off-by: thisisatharva-rh <[email protected]>
orrangetabby17 pushed a commit to orrangetabby17/pytorch that referenced this pull request Sep 2, 2026
…#193834)

### Summary
Integrates the `torch.distributed._watchdog` timeout machinery into symmetric  memory's blocking and stream-based operations so that hangs in multi-process rendezvous or one-sided NCCL ops are detected and surfaced instead of blocking silently.

### Test Plan

```
python test/distributed/test_symmetric_memory.py -k SymmMemWatchdogUnitTest
torchrun --nproc_per_node=2 test/distributed/test_nccl.py -k NCCLSymmMemWatchdogTest
```

Authored with AI assistance
Pull Request resolved: pytorch#193834
Approved by: https://github.com/d4l3k
orrangetabby17 pushed a commit to orrangetabby17/pytorch that referenced this pull request Sep 2, 2026
Sanskaaar1 pushed a commit to Sanskaaar1/pytorch that referenced this pull request Sep 8, 2026
…#193834)

### Summary
Integrates the `torch.distributed._watchdog` timeout machinery into symmetric  memory's blocking and stream-based operations so that hangs in multi-process rendezvous or one-sided NCCL ops are detected and surfaced instead of blocking silently.

### Test Plan

```
python test/distributed/test_symmetric_memory.py -k SymmMemWatchdogUnitTest
torchrun --nproc_per_node=2 test/distributed/test_nccl.py -k NCCLSymmMemWatchdogTest
```

Authored with AI assistance
Pull Request resolved: pytorch#193834
Approved by: https://github.com/d4l3k
Sanskaaar1 pushed a commit to Sanskaaar1/pytorch that referenced this pull request Sep 8, 2026
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as Stale.
Feel free to remove the Stale label if you feel this was a mistake.
If you are unable to remove the Stale label please contact a maintainer in order to do so.
If you want the bot to never mark this PR stale again, add the no-stale label.
Stale pull requests will automatically be closed after 30 days of inactivity.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-no-td Do not run TD on this PR ciflow/h100-symm-mem ciflow/torchtitan Run TorchTitan integration tests ciflow/trunk Trigger trunk jobs on your pull request Merged open source Reverted Stale topic: not user facing topic category triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants