Repository navigation
Conversation
torch.distributed.distributed_c10d._set_pg_timeout had device-conditional
branches for cpu (gloo) and cuda (nccl/gloo/torchcomms) but no
torch.device("xpu") branch. On an xccl-backed process group, the loop
adds no backends, emits the warning "Set timeout is now only supported
for either nccl or gloo.", and _set_default_timeout is never called.
The per-PG timeout silently no-ops on every Intel XPU run.
ProcessGroupXCCL exposes the public Backend API method set_timeout
(rather than the private _set_default_timeout alias NCCL uses), so it
cannot share the existing `backends` set, which is drained via
_set_default_timeout. This change adds an xpu/xccl-aware branch that
mirrors the cuda branch and dispatches to backend.set_timeout(timeout)
directly.
Adds test/distributed/test_c10d_xccl.py with
test_xccl_set_pg_timeout_api, modeled on the existing
test_gloo_set_pg_timeout_api. It verifies that calling
_set_pg_timeout on an xccl PG:
- does NOT emit the "only supported for nccl or gloo" warning;
- updates backend.options._timeout to the new value.
Whether xccl's C++ runtime then *enforces* the new timeout via a
watchdog + abort is out of scope for this PR (the value reaches the
backend; enforcement is a separate fix in ProcessGroupXCCL.{hpp,cpp}).
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/184767
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: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
|
|
The following ciflow label(s) have been added but CI has not been triggered yet because the workflows are awaiting approval:
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. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR updates distributed process-group timeout handling to support the XCCL backend on XPU devices, and adds a regression test to ensure the timeout is propagated without emitting the “unsupported” warning.
Changes:
- Add XCCL/XPU handling to
_set_pg_timeoutby callingProcessGroupXCCL.set_timeout(...). - Update the “no supported backend found” condition to account for XCCL backends.
- Add a new distributed test validating
_set_pg_timeoutbehavior for XCCL.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| torch/distributed/distributed_c10d.py | Routes XCCL/XPU process groups through set_timeout and avoids the unsupported-backend warning for XCCL. |
| test/distributed/test_c10d_xccl.py | Adds a regression test ensuring _set_pg_timeout reaches ProcessGroupXCCL.set_timeout and emits no unsupported warning. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 37af153700
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Per copilot + codex review on pytorch#184767: - xccl_backends: set[Backend] -> xccl_backend: ProcessGroupXCCL | None Backend in this module is the str-backed backend-name wrapper, not a ProcessGroup, so set[Backend] was a type error. Also: an xpu PG resolves to exactly one xccl backend, so a single optional binding is cleaner than a set + for-loop. - Updated the "Set timeout is now only supported..." warning to include xccl; the previous text was outdated once xccl was routed. - Test now uses torch.testing._internal.common_utils.find_free_port + the @retry_on_connect_failures decorator instead of a bespoke bind-and-release helper. Removes the documented race between closing the probe socket and init_process_group binding the port. Verified locally (Sunspot, 1N, torch 2.13.0.dev xpu, alloc 12467231) that the simplified single-binding form still passes the same contract: warning suppressed, ProcessGroupXCCL.set_timeout reached, backend.options._timeout updates.
|
All 7 inline review threads from copilot and codex are addressed and resolved as of 8ceedc7:
Locally re-verified against the in-repo Could I get a review from a c10d maintainer? Tagging @kwen2501 as CODEOWNER for |
Adds docs/summaries/2026-05-08_to_2026-05-22.md (51 commits over ~2 weeks, organized by theme): - Upstream PyTorch PR for xccl _set_pg_timeout dispatch (pytorch/pytorch#184767, under review) - 4 upstream torchtitan syncs (34th–37th), two with non-trivial replays (PR pytorch#3159 Full DTensor signature change, PR pytorch#3386 MoE refactor) - 80B bad-node failover wrapper for production training; the e216a25 silent-hang detection fix closes the 8479579 incident class where the wrapper saw shell exit 0 while the inner trainer had died - agpt_{2b,20b,80b}_real configs with cos_sin RoPE for v1 lm-eval alignment - Sunspot 2N smoke campaigns post-resync - MoE EP=2 step-41 hang investigation (reclassified transient on retry; surfaced the xccl-timeout-never-fires gap that kicked off the upstream PR thread) - TPC26 MAPE talk prep (outline + §9 engineer-hours data) - Docs hygiene (TREE.md, Date columns on production tables, unstaled "Last updated" markers, lychee link fixes) Adds the corresponding row to docs/summaries/README.md and a journal entry for today summarizing the PR filing + this writeup.
|
oh wow, even better then! thanks |
~80 commits across 8 days. Organized by 7 themes: - 2 upstream PRs filed: pytorch/pytorch#184767 (xccl _set_pg_timeout dispatch, closed in deference to #183625) and pytorch#3436 (histc -> bincount/scatter, open and likely superseded by draft pytorch#3450). - 5 upstream syncs absorbed (39th-42nd plus a 41st-sync catch-up the 42nd-sync smoke surfaced). Lesson logged: always smoke moe_2b_ep after a sync that touches GroupedExperts. - Production v2 training: 20B 512N HSn 0.579 -> 0.635 in 1100 steps; 2B 256N + 512N stepping through 28K-54K with the keep_latest_k=10 ckpt-purge root cause closed. - Failover wrapper hardening: ANSI exit-code parsing fix, silent-hang watchdog via --timeout, preflight smoke + env overrides, fixture- based test harness. - Scaling sweep infrastructure: 2B {4..4096}N sweep, walltime right- sized, venv pinned to project .venv. - Chart/plotting hardening across 6+ scripts (palette consistency, ambivalent style fixes, dual SVG+PNG output). - Docs hygiene: production READMEs refreshed across 4 stale pages, TREE.md unstaled. Includes the corresponding row in docs/summaries/README.md.
[distributed] Route
_set_pg_timeouttoProcessGroupXCCLon xpu PGsSummary
torch.distributed.distributed_c10d._set_pg_timeoutcurrently hasdevice-conditional branches for cpu (gloo) and cuda
(nccl/gloo/torchcomms) — but no
torch.device("xpu")branch. Onan xccl-backed process group the existing loop adds no backends,
emits the warning
and
_set_default_timeoutis never called. The per-PG timeout(e.g.
CommConfig.train_timeout_secondsin torchtitan, or any userwho later wants to call
_set_pg_timeoutdirectly) silently no-ops onevery Intel XPU run.
ProcessGroupXCCLalready exposes the publicBackend.set_timeoutmethod; the only gap is the Python dispatch. This PR adds an
xpubranch that mirrors the existing
cudabranch and routes xccl PGsthrough
backend.set_timeout(timeout). (XCCL doesn't expose_set_default_timeoutthe wayProcessGroupNCCLdoes, so it can'tshare the existing
backendsset, which is drained via_set_default_timeoutat the end of the function.)After this patch, calling
_set_pg_timeouton an xccl PG:ProcessGroupXCCL.set_timeout(timeout);backend.options._timeout(the same fieldtest_gloo_set_pg_timeout_apiasserts on for gloo).
Diff
Test plan
Adds
test/distributed/test_c10d_xccl.py::ProcessGroupXCCLTest::test_xccl_set_pg_timeout_api,modeled on the existing
test_gloo_set_pg_timeout_api. The new test:timeout=timedelta(seconds=50).backend.options._timeout == timedelta(seconds=50).c10d.distributed_c10d._set_pg_timeout(timedelta(milliseconds=1), pg)inside
warnings.catch_warnings(record=True).backend.options._timeout == timedelta(milliseconds=1).The test gates on
@requires_accelerator_dist_backend(["xccl"])andskips when XPU is not available, matching the convention used by
other xccl tests under
test/distributed/.Empirical verification (out-of-tree)
Verified on 12 ranks of an Intel XPU (Sunspot, 1 node × 12 tiles) with
torch
2.13.0.devfrom the samedistributed_c10d.py, patched andunpatched:
ProcessGroupXCCL.set_timeoutcalledoptions._timeoutafterSide observation: xccl's C++
set_timeoutdoes propagate thevalue into
options._timeout. Whether that timeout is thenenforced by a watchdog (and
ccl_abort-equivalent fires whencollectives exceed the deadline) is a separate question and is out
of scope for this PR. This PR only fixes the Python dispatch gap so
the value actually reaches the backend; an enforcement PR — which
needs to land changes in
ProcessGroupXCCL.{hpp,cpp}and likely awatchdog thread analogous to NCCL's — would follow.
Risk
Minimal. Behavior for cpu / cuda / torchcomms users is unchanged. For
xccl users, the previous behavior was a no-op + warning; the new
behavior calls
backend.set_timeoutand suppresses the warning. Theonly failure mode is if
ProcessGroupXCCL.set_timeoutitself raises —in which case the user would have been getting the warning today and
the timeout would have been silently ignored, so this surfaces an
otherwise-hidden error.
Related
This is a prerequisite for proper per-collective timeout handling on
Intel XPU. Downstream context (a hung MoE training run that consumed
its full PBS walltime instead of aborting at the configured 100s
deadline, because
_set_pg_timeouthad silently no-op'd) is describedin this writeup.
The downstream torchtitan workaround in
saforem2/torchtitan@22847fcbwalks each PG and calls
ProcessGroupXCCL.set_timeoutdirectly; thisPR makes that workaround unnecessary.
cc @gujinghui @fengyuan14 @jbschlosser