Skip to content

[distributed] Reuse workers for checkpoint collective wrapper tests - #197654

Closed
d4l3k wants to merge 3 commits into
gh/d4l3k/149/basefrom
gh/d4l3k/149/head
Closed

d4l3k wants to merge 3 commits into
gh/d4l3k/149/basefrom
gh/d4l3k/149/head

Conversation

@d4l3k

@d4l3k d4l3k commented Sep 19, 2026 •

Copy link
Copy Markdown
Member

Stack from ghstack (oldest at bottom):

Reuse workers for the distributed checkpoint wrapper cases instead of recreating the process group per test. Preserve the device-count rank cap and object-collective assertions; leave local utility tests unchanged.

Test plan: CUDA build and lint; five distributed cases in normal/reverse order, full file with two visible GPUs (three expected skips), and full-file postbuild. Distributed cases improve from 32.5s to 11.9s.

@pytorch-bot

pytorch-bot Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ You can merge normally! (2 Unrelated Failures)

As of commit d785733 with merge base b7954b2 (image):

🟢 GREEN LIGHT - PR approved to be merged without human review:

  • Migration correctness
    • with_comms passes through when the harness lacks init_pg (common_dtensor.py:892-894); no class in DTensorContinuousTestBase's MRO defines init_pg, so the worker's persistent PG is not re-created
    • _get_world_size handles world_size as a plain class attribute as well as a property (common_distributed.py:2051-2058), so the property-to-attribute switch is supported
    • DTensorTestMixin.device_type stays resolvable: _ensure_processes_spawned has a dedicated property branch for it (common_distributed.py:2096-2100)
  • Preserved behavior
    • The rank cap min(4, torch.accelerator.device_count()) and every object-collective assertion in TestDistWrapper carry over unchanged in the diff
    • The @skip_if_lt_x_gpu cases still skip: the worker's sys.exit is converted to unittest.SkipTest at common_distributed.py:1978-1992
  • Established pattern
    • Sibling test/distributed/checkpoint/test_state_dict_utils.py:32-33 already pairs DTensorContinuousTestBase with the identical world_size line and the same decorator stacking
  • Scope
    • Two hunks in one test file; no product code, public API, docs, or CI workflow touched, and the local TestCase classes in the file are untouched

reason: clean
Reviewed commit: d785733

Inference job

🐛 Report a wrong verdict

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.

This was referenced Sep 19, 2026
@d4l3k
d4l3k marked this pull request as ready for review September 19, 2026 04:20
d4l3k added a commit that referenced this pull request Sep 19, 2026
Reuse workers for the distributed checkpoint wrapper cases instead of recreating the process group per test. Preserve the device-count rank cap and object-collective assertions; leave local utility tests unchanged.

Test plan: CUDA build and lint; five distributed cases in normal/reverse order, full file with two visible GPUs (three expected skips), and full-file postbuild. Distributed cases improve from 32.5s to 11.9s.


ghstack-source-id: da93bb0
Pull-Request: #197654
d4l3k added a commit that referenced this pull request Sep 19, 2026
Reuse workers for the distributed checkpoint wrapper cases instead of recreating the process group per test. Preserve the device-count rank cap and object-collective assertions; leave local utility tests unchanged.

Test plan: CUDA build and lint; five distributed cases in normal/reverse order, full file with two visible GPUs (three expected skips), and full-file postbuild. Distributed cases improve from 32.5s to 11.9s.


ghstack-source-id: da93bb0
Pull-Request: #197654
@d4l3k

d4l3k commented Sep 19, 2026

Copy link
Copy Markdown
Member Author

@pytorchbot merge

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Sep 19, 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

pytorchmergebot pushed a commit that referenced this pull request Sep 21, 2026
Avoid spawning workers and initializing process groups for each state-dict test. Keep rank counts, model-local state checks and the threaded test class unchanged.

Test plan: CUDA build and lint; six four-GPU cases in normal and reverse order (48.0s to 16.2s), two-GPU coverage with the expected skip, and the full file after rebuilding.
Pull Request resolved: #197660
Approved by: https://github.com/pytorchgreenlight
ghstack dependencies: #197647, #197650, #197651, #197654
xjbanana258 added a commit to xjbanana258/pytorch that referenced this pull request Oct 23, 2026
Keep hw_classification labels and instantiate_device_type_tests from this
branch; adopt upstream changes from pytorch#197654 (DTensorContinuousTestBase and
world_size as a class attribute) for TestDistWrapper.
@github-actions
github-actions Bot deleted the gh/d4l3k/149/head branch November 23, 2026 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants