Repository navigation
Conversation
[ghstack-poisoned]
PR Status: Approved 🚀Please fix all CI failures and trigger merge by commenting "@pytorchbot merge". 🟡 AUTOMATED REVIEW - Changes requested:
Findings (8): Reviewed commit: 🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/201436
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 Cancelled Job, 8 Unrelated FailuresAs of commit 3e1f2b4 with merge base ff4f371 ( CANCELLED JOB - The following job was cancelled. Please retry:
UNSTABLE - The following jobs are marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
…stable opts defaults [ghstack-poisoned]
ProcessGroup pre/post/abort hooks, their argument types, and the built-in FlightRecorderHook/NanCheckHook/HealthCheckHook had one-line or no docstrings and no docs page. This adds docstrings to the pybind bindings (semantics: issue-time vs completion, op_id pairing, hook_id ordering/replacement, abort hook idempotence, auto-attach env vars), re-exports HookOpName/PreHookArgs/PostHookArgs from torch.distributed.distributed_c10d like the window types, and adds a "Hooks" section to distributed.md. Test plan: ``` pip install -e . -v --no-build-isolation python test/test_public_bindings.py cd docs && sphinx-build -M html source build -j 24 -T --keep-going -D katex_prerender=0 ``` Also ran the docs example on a single-rank gloo group and checked the rendered docstrings. This PR was authored with an AI assistant (Claude). ghstack-source-id: 7955f1e Pull-Request: #201436
… support [ghstack-poisoned]
ProcessGroup pre/post/abort hooks, their argument types, and the built-in FlightRecorderHook/NanCheckHook/HealthCheckHook had one-line or no docstrings and no docs page. This adds docstrings to the pybind bindings (semantics: issue-time vs completion, op_id pairing, hook_id ordering/replacement, abort hook idempotence, auto-attach env vars), re-exports HookOpName/PreHookArgs/PostHookArgs from torch.distributed.distributed_c10d like the window types, and adds a "Hooks" section to distributed.md. Test plan: ``` pip install -e . -v --no-build-isolation python test/test_public_bindings.py cd docs && sphinx-build -M html source build -j 24 -T --keep-going -D katex_prerender=0 ``` Also ran the docs example on a single-rank gloo group and checked the rendered docstrings. This PR was authored with an AI assistant (Claude). ghstack-source-id: 41b6c7d Pull-Request: #201436
[ghstack-poisoned]
ProcessGroup pre/post/abort hooks, their argument types, and the built-in FlightRecorderHook/NanCheckHook/HealthCheckHook had one-line or no docstrings and no docs page. This adds docstrings to the pybind bindings (semantics: issue-time vs completion, op_id pairing, hook_id ordering/replacement, abort hook idempotence, auto-attach env vars), re-exports HookOpName/PreHookArgs/PostHookArgs from torch.distributed.distributed_c10d like the window types, and adds a "Hooks" section to distributed.md. Test plan: ``` pip install -e . -v --no-build-isolation python test/test_public_bindings.py cd docs && sphinx-build -M html source build -j 24 -T --keep-going -D katex_prerender=0 ``` Also ran the docs example on a single-rank gloo group and checked the rendered docstrings. This PR was authored with an AI assistant (Claude). ghstack-source-id: cdb0eb5 Pull-Request: #201436
…eardown [ghstack-poisoned]
ProcessGroup pre/post/abort hooks, their argument types, and the built-in FlightRecorderHook/NanCheckHook/HealthCheckHook had one-line or no docstrings and no docs page. This adds docstrings to the pybind bindings (semantics: issue-time vs completion, op_id pairing, hook_id ordering/replacement, abort hook idempotence, auto-attach env vars), re-exports HookOpName/PreHookArgs/PostHookArgs from torch.distributed.distributed_c10d like the window types, and adds a "Hooks" section to distributed.md. Test plan: ``` pip install -e . -v --no-build-isolation python test/test_public_bindings.py cd docs && sphinx-build -M html source build -j 24 -T --keep-going -D katex_prerender=0 ``` Also ran the docs example on a single-rank gloo group and checked the rendered docstrings. This PR was authored with an AI assistant (Claude). ghstack-source-id: 9c115e7 Pull-Request: #201436
…eardown [ghstack-poisoned]
ProcessGroup pre/post/abort hooks, their argument types, and the built-in FlightRecorderHook/NanCheckHook/HealthCheckHook had one-line or no docstrings and no docs page. This adds docstrings to the pybind bindings (semantics: issue-time vs completion, op_id pairing, hook_id ordering/replacement, abort hook idempotence, auto-attach env vars), re-exports HookOpName/PreHookArgs/PostHookArgs from torch.distributed.distributed_c10d like the window types, and adds a "Hooks" section to distributed.md. Test plan: ``` pip install -e . -v --no-build-isolation python test/test_public_bindings.py cd docs && sphinx-build -M html source build -j 24 -T --keep-going -D katex_prerender=0 ``` Also ran the docs example on a single-rank gloo group and checked the rendered docstrings. This PR was authored with an AI assistant (Claude). ghstack-source-id: dc37d5e Pull-Request: #201436
[ghstack-poisoned]
ProcessGroup pre/post/abort hooks, their argument types, and the built-in FlightRecorderHook/NanCheckHook/HealthCheckHook had one-line or no docstrings and no docs page. This adds docstrings to the pybind bindings (semantics: issue-time vs completion, op_id pairing, hook_id ordering/replacement, abort hook idempotence, auto-attach env vars), re-exports HookOpName/PreHookArgs/PostHookArgs from torch.distributed.distributed_c10d like the window types, and adds a "Hooks" section to distributed.md. Test plan: ``` pip install -e . -v --no-build-isolation python test/test_public_bindings.py cd docs && sphinx-build -M html source build -j 24 -T --keep-going -D katex_prerender=0 ``` Also ran the docs example on a single-rank gloo group and checked the rendered docstrings. This PR was authored with an AI assistant (Claude). ghstack-source-id: 070bd89 Pull-Request: #201436
… exclude stale elastic stubs [ghstack-poisoned]
ProcessGroup pre/post/abort hooks, their argument types, and the built-in FlightRecorderHook/NanCheckHook/HealthCheckHook had one-line or no docstrings and no docs page. This adds docstrings to the pybind bindings (semantics: issue-time vs completion, op_id pairing, hook_id ordering/replacement, abort hook idempotence, auto-attach env vars), re-exports HookOpName/PreHookArgs/PostHookArgs from torch.distributed.distributed_c10d like the window types, and adds a "Hooks" section to distributed.md. Test plan: ``` pip install -e . -v --no-build-isolation python test/test_public_bindings.py cd docs && sphinx-build -M html source build -j 24 -T --keep-going -D katex_prerender=0 ``` Also ran the docs example on a single-rank gloo group and checked the rendered docstrings. This PR was authored with an AI assistant (Claude). ghstack-source-id: d2bc5e4 Pull-Request: #201436
[ghstack-poisoned]
ProcessGroup pre/post/abort hooks, their argument types, and the built-in FlightRecorderHook/NanCheckHook/HealthCheckHook had one-line or no docstrings and no docs page. This adds docstrings to the pybind bindings (semantics: issue-time vs completion, op_id pairing, hook_id ordering/replacement, abort hook idempotence, auto-attach env vars), re-exports HookOpName/PreHookArgs/PostHookArgs from torch.distributed.distributed_c10d like the window types, and adds a "Hooks" section to distributed.md. Test plan: ``` pip install -e . -v --no-build-isolation python test/test_public_bindings.py cd docs && sphinx-build -M html source build -j 24 -T --keep-going -D katex_prerender=0 ``` Also ran the docs example on a single-rank gloo group and checked the rendered docstrings. This PR was authored with an AI assistant (Claude). ghstack-source-id: 0519a12 Pull-Request: #201436
[ghstack-poisoned]
ProcessGroup pre/post/abort hooks, their argument types, and the built-in FlightRecorderHook/NanCheckHook/HealthCheckHook had one-line or no docstrings and no docs page. This adds docstrings to the pybind bindings (semantics: issue-time vs completion, op_id pairing, hook_id ordering/replacement, abort hook idempotence, auto-attach env vars), re-exports HookOpName/PreHookArgs/PostHookArgs from torch.distributed.distributed_c10d like the window types, and adds a "Hooks" section to distributed.md. Test plan: ``` pip install -e . -v --no-build-isolation python test/test_public_bindings.py cd docs && sphinx-build -M html source build -j 24 -T --keep-going -D katex_prerender=0 ``` Also ran the docs example on a single-rank gloo group and checked the rendered docstrings. This PR was authored with an AI assistant (Claude). ghstack-source-id: f061475 Pull-Request: #201436
…ing=False; tests for SEPARATE and shared signals [ghstack-poisoned]
ProcessGroup pre/post/abort hooks, their argument types, and the built-in FlightRecorderHook/NanCheckHook/HealthCheckHook had one-line or no docstrings and no docs page. This adds docstrings to the pybind bindings (semantics: issue-time vs completion, op_id pairing, hook_id ordering/replacement, abort hook idempotence, auto-attach env vars), re-exports HookOpName/PreHookArgs/PostHookArgs from torch.distributed.distributed_c10d like the window types, and adds a "Hooks" section to distributed.md. Test plan: ``` pip install -e . -v --no-build-isolation python test/test_public_bindings.py cd docs && sphinx-build -M html source build -j 24 -T --keep-going -D katex_prerender=0 ``` Also ran the docs example on a single-rank gloo group and checked the rendered docstrings. This PR was authored with an AI assistant (Claude). ghstack-source-id: 364aa0a Pull-Request: #201436
[ghstack-poisoned]
ProcessGroup pre/post/abort hooks, their argument types, and the built-in FlightRecorderHook/NanCheckHook/HealthCheckHook had one-line or no docstrings and no docs page. This adds docstrings to the pybind bindings (semantics: issue-time vs completion, op_id pairing, hook_id ordering/replacement, abort hook idempotence, auto-attach env vars), re-exports HookOpName/PreHookArgs/PostHookArgs from torch.distributed.distributed_c10d like the window types, and adds a "Hooks" section to distributed.md. Test plan: ``` pip install -e . -v --no-build-isolation python test/test_public_bindings.py cd docs && sphinx-build -M html source build -j 24 -T --keep-going -D katex_prerender=0 ``` Also ran the docs example on a single-rank gloo group and checked the rendered docstrings. This PR was authored with an AI assistant (Claude). ghstack-source-id: e177e44 Pull-Request: #201436
|
@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 |
…place tensors, exception semantics [ghstack-poisoned]
ProcessGroup pre/post/abort hooks, their argument types, and the built-in FlightRecorderHook/NanCheckHook/HealthCheckHook had one-line or no docstrings and no docs page. This adds docstrings to the pybind bindings (semantics: issue-time vs completion, op_id pairing, hook_id ordering/replacement, exception behavior, abort hook idempotence, auto-attach env vars), re-exports HookOpName/PreHookArgs/PostHookArgs from torch.distributed.distributed_c10d like the window types, and adds a "Hooks" section to distributed.md. Review points intentionally not addressed: exhaustive per-op hook coverage and HookOpName mapping exceptions (monitored_barrier, coalesced Work, sparse allreduce, gather_into_tensor, barrier tensor lists), split_group not attaching NanCheckHook, and TORCH_NCCL_NAN_CHECK; docs are kept to common cases. Test plan: ``` pip install -e . -v --no-build-isolation python test/test_public_bindings.py cd docs && sphinx-build -M html source build -j 24 -T --keep-going -D katex_prerender=0 ``` Also ran the docs example on a single-rank gloo group and checked the rendered docstrings. This PR was authored with an AI assistant (Claude). ghstack-source-id: a77d89c Pull-Request: #201436
|
@pytorchbot merge |
|
This PR has pending changes requested. Please address the comments and update the PR before merging. |
Merge failedReason: New commits were pushed while merging. Please rerun the merge command. Details for Dev Infra teamRaised by workflow job |
There was a problem hiding this comment.
Automated review of 3e1f2b4: changes requested before human review.
The PR adds docstrings to the ProcessGroup/Backend pre-, post- and abort-hook bindings and to the built-in FlightRecorder, NaN-check and health-check hooks, re-exports HookOpName/PreHookArgs/PostHookArgs, and adds a "Hooks" section to distributed.md. Recommendation: Request Changes. The async_op description is wrong for point-to-point ops, the docs make abort-hook ID handling a public contract with no warning and give users no way to pick safe hook IDs, and none of the newly documented behavior is tested.
🔴 4 blocking findings are attached to the code below.
⚪ 4 non-blocking findings
pytorch/torch/csrc/distributed/c10d/init.cpp
Line 3321 in 3e1f2b4
ProcessGroup.register_abort_hook only covers the default backend, but its docstring doesn't say so. The text is copied verbatim from the Backend binding. ProcessGroup::registerAbortHook forwards only to getDefaultBackend() (ProcessGroup.hpp:1160), and FlightRecorderHook.cpp:567-571 relies on that. On a mixed group like "cpu:gloo,cuda:nccl", a failure in the non-default backend never runs the hook. Only the supports_abort_hooks docstring mentions the default backend. State this in the register_abort_hook docstring and in the distributed.md paragraph, and point to registering on the specific b
pytorch/docs/source/distributed.md
Line 986 in 3e1f2b4
The distributed.md abort-hook paragraph doesn't say that ProcessGroup.register_abort_hook only covers the default backend; on a mixed group like "cpu:gloo,cuda:nccl" a failure in the non-default backend never runs the hook. State this and point to registering on the specific backend for full coverage.
pytorch/torch/csrc/distributed/c10d/init.cpp
Line 3320 in 3e1f2b4
The abort-hook docstring is duplicated (init.cpp:3320-3335 and :3556-3571). The two 15-line raw strings are identical. Define one shared string and use it in both bindings, so a fix to one (such as the default-backend note) can't miss the other.
pytorch/docs/source/distributed.md
Line 982 in 3e1f2b4
The docs example fails on NCCL (see also :968). The text only says "assumes the default process group is initialized", but dist.all_reduce(torch.ones(4)) uses a CPU tensor, which fails on an NCCL default group. Either say the example needs a gloo or CPU-capable group, or put the tensor on the current accelerator.
Please address the findings and push; a new commit normally gets a fresh automated review.
This review is AI-generated and advisory. Each new automated review replaces the previous one.
| &::c10d::PreHookArgs::name, | ||
| "The ``HookOpName`` of the operation.") | ||
| .def_readwrite( | ||
| "async_op", |
There was a problem hiding this comment.
🔴 async_op is wrong for send/recv (also the PostHookArgs binding at :1608). The docstring says "Whether the operation is asynchronous." But IMPL_SEND, IMPL_RECV and IMPL_RECV_ANY_SOURCE in Ops.cpp:84,107,132 always pass /*async_op=*/true. The blocking dist.send (distributed_c10d.py:3675, which calls isend(...) and then .wait()) also reports async_op=True, so a hook can't tell send from isend even though the docstring says it can. Either say that point-to-point ops always report True, or describe the field as the flag the collective was dispatched with.
| logged and ignored. | ||
|
|
||
| Args: | ||
| hook_id (int): Identifier for ``unregister_abort_hook``. Registering an |
There was a problem hiding this comment.
🔴 The abort-hook "keeps existing" rule becomes a public contract with no warning (repeated in the Backend binding at :3569). "Registering an existing id keeps the existing hook" accurately describes abortHooks_.emplace in nccl2/ProcessGroupNCCLBackend.cpp:290 and LazyBackend.hpp:316. It is the opposite of the pre/post-hook rule (operator[], which replaces), and the second registration is silently dropped. That rule now becomes a commitment for every backend, including Python backends via PyBackend.hpp:526. Either make abort-hook registration replace (or raise on a duplicate id), or say expli
| Register hooks during setup, not concurrently with operations. | ||
|
|
||
| Args: | ||
| hook_id (int): Identifier for ``unregister_pre_hook``. Registering an |
There was a problem hiding this comment.
🔴 Hook IDs and ordering aren't usable without knowing the built-in IDs (register_pre_hook/register_post_hook docstrings and the example at docs/source/distributed.md:981). The docs say hooks run in hook_id order and that re-registering an id silently replaces the old hook, but never say built-in hooks share this ID space. FlightRecorderHook uses IDs counting up from 0x46524543 (hooks/FlightRecorderHook.cpp:22); NanCheckHook counts up from 0x4e414e43 (hooks/NanCheckHook.cpp:15). A user who wants their hook to run before or after the recorder or NaN check can't pick a correct ID, and a colliding I
| R"( | ||
| Register ``hook`` to be called with a ``PreHookArgs`` before each operation | ||
| issued through this process group, on the issuing thread, for every backend. | ||
| Hooks run in ``hook_id`` order. If a hook raises, the exception propagates to |
There was a problem hiding this comment.
🔴 The documented behavior has no tests. The new docstrings promise: pre/post hooks run in hook_id order; re-registering an id replaces the hook; a pre-hook that raises skips the remaining hooks and prevents the op from being issued; a post-hook that raises drops the Work after the op was issued; output_tensors is empty for in-place ops like allreduce/broadcast; root is -1 for recv from any source. test/distributed/test_c10d_hooks.py only checks that hooks fire, op_id pairing, and unregistering (test_hooks_fire_for_all_collectives, lines 40-126). Add gloo-based assertions for each promise next to
bypassing to land just docs changes
|
@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 |
|
The merge job was canceled or timed out. This most often happen if two merge requests were issued for the same PR, or if merge job was waiting for more than 6 hours for tests to finish. In later case, please do not hesitate to reissue the merge command |
|
@pytorchbot merge -i |
Stack from ghstack (oldest at bottom):
ProcessGroup pre/post/abort hooks, their argument types, and the built-in FlightRecorderHook/NanCheckHook/HealthCheckHook had one-line or no docstrings and no docs page. This adds docstrings to the pybind bindings (semantics: issue-time vs completion, op_id pairing, hook_id ordering/replacement, exception behavior, abort hook idempotence, auto-attach env vars), re-exports HookOpName/PreHookArgs/PostHookArgs from torch.distributed.distributed_c10d like the window types, and adds a "Hooks" section to distributed.md.
Review points intentionally not addressed: exhaustive per-op hook coverage and HookOpName mapping exceptions (monitored_barrier, coalesced Work, sparse allreduce, gather_into_tensor, barrier tensor lists), split_group not attaching NanCheckHook, and TORCH_NCCL_NAN_CHECK; docs are kept to common cases.
Test plan:
Also ran the docs example on a single-rank gloo group and checked the rendered docstrings.
This PR was authored with an AI assistant (Claude).