Skip to content

Reuse workers across DTensor experimental-op tests - #197687

Closed
d4l3k wants to merge 1 commit into
gh/d4l3k/178/basefrom
gh/d4l3k/178/head
Closed

d4l3k wants to merge 1 commit into
gh/d4l3k/178/basefrom
gh/d4l3k/178/head

Conversation

@d4l3k

@d4l3k d4l3k commented Sep 19, 2026 •

Copy link
Copy Markdown
Member

Stack from ghstack (oldest at bottom):

Keep the two distributed workers alive across slice, Bernoulli, and loss tests. Preserve the rank count and LocalTensor variant, including its existing send/recv skip.

Test plan: CUDA build and lint; all six cases in normal and reversed order, CPU fallback, and two GPUs after build. Runtime falls from 13.95s to 5.68s with one unchanged skip.

@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/197687

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

✅ No Failures

As of commit 0b84e3c with merge base b7954b2 (image):
💚 Looks good so far! There are no failures yet. 💚

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

  • Scope
    • Sole change is test/distributed/tensor/test_experimental_ops.py swapping DTensorTestBase for DTensorContinuousTestBase; no product code or CI workflow touched.
    • Matches the migration already landed in test_tensor_ops.py, test_embedding_ops.py, and test_redistribute.py, which use the same class-attribute plus base_class= pattern.
  • Correctness
    • world_size = 2 as a class attribute is required, not cosmetic: _ensure_processes_spawned calls device_type_attr.fget(cls) in common_distributed.py:2096-2100, so a world_size property would leak the descriptor into _get_device_type.
    • base_class=LocalDTensorContinuousTestBase keeps the generated class's MRO consistent, since create_local_tensor_test_class prepends it to orig_cls.__bases__ at common_dtensor.py:1264-1268.
    • @with_comms becomes a passthrough because the continuous base exposes only classmethod _init_pg, which common_dtensor.py:894 handles via its hasattr(self, "init_pg") guard.
  • Preservation
    • The insufficient-accelerator skip survives: DTensorContinuousTestBase._init_pg exits with the multi-device-2 code at common_dtensor.py:710-712, and _worker_loop converts it to SkipTest at common_distributed.py:1943-1952.
    • Rank count stays 2 for test_bernoulli's isend/irecv pairing, and its LocalTensor skip is unchanged at test_experimental_ops.py:194.
  • Testing
    • The diff is itself test infrastructure; all three tests (test_slice, test_bernoulli, test_nll) are retained verbatim with no assertion weakened.

reason: clean
Reviewed commit: 0b84e3c

Inference job

🐛 Report a wrong verdict

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

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Starting merge as part of PR stack under #197690

pytorchmergebot pushed a commit that referenced this pull request Sep 19, 2026
Reuse distributed workers across model-state checkpoint tests, preserving the rank count and combined Gloo/accelerator backend. Release each rank’s resharding subgroup after its last use.

Test plan: CUDA build and lint; both four-GPU cases in normal and reversed order, two-GPU and CPU skip paths, and both cases after build. Runtime falls from 11.74s to 6.57s.
Pull Request resolved: #197688
Approved by: https://github.com/pytorchgreenlight, https://github.com/Skylion007
ghstack dependencies: #197647, #197648, #197687
pytorchmergebot pushed a commit that referenced this pull request Sep 19, 2026
Reuse distributed workers across the four uneven-stride allocation tests while preserving the existing rank count and assertions.

Test plan: CUDA build and lint; four cases in normal and reversed order, CPU fallback and two-GPU runs. Four-GPU runtime drops from 22.39s to 5.53s after build.
Pull Request resolved: #197690
Approved by: https://github.com/pytorchgreenlight, https://github.com/Skylion007
ghstack dependencies: #197647, #197648, #197687, #197688
@github-actions
github-actions Bot deleted the gh/d4l3k/178/head branch November 23, 2026 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/dtensor Run DTensor specific tests Merged topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants