Skip to content

[distributed] Reuse workers across LocalMap tests - #197675

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

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

Conversation

@d4l3k

@d4l3k d4l3k commented Sep 19, 2026 •

Copy link
Copy Markdown
Member

Stack from ghstack (oldest at bottom):

LocalMap correctness tests repeatedly spawn identical two-rank workers. Reuse the continuous DTensor fixture while preserving rank count and leaving SPMD/fake-process-group tests unchanged.

Test plan:
CUDA build and lint pass. Six LocalMap tests: 27.365s before, 5.274s after; reversed order 4.997s. CPU fallback and two-GPU postbuild runs pass with one existing four-GPU-gated skip each.

@pytorch-bot pytorch-bot Bot added ciflow/dtensor Run DTensor specific tests topic: not user facing topic category labels Sep 19, 2026
@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/197675

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

✅ No Failures

As of commit 54349ce 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/experimental/test_local_map.py: TestLocalMap rebased onto DTensorContinuousTestBase plus the new import; no product code touched.
    • TestLocalMapSpmdTypes, TestLocalMapSpmdTypesMultiGPU and TestLocalMapSpmdTypesMesh are untouched, so the retained DTensorTestBase import is still used at line 760.
  • Correctness
    • world_size = 2 as a class attribute is required, not incidental: MultiProcContinuousTest._ensure_processes_spawned calls DTensorTestMixin.device_type.fget(cls), which would compare DEVICE_COUNT against a property object if world_size stayed a property.
    • Rank count is preserved at 2 — _get_world_size returns the class attribute verbatim since it is not the -2 unset sentinel, so init_device_mesh(mesh_shape=(self.world_size,)) in each test is unchanged.
    • Grepping the file for self.rank, self.init_pg, self.destroy_pg, self.backend and self.file_name returns no hits, so no DTensorTestBase-only member is dropped; with_comms in common_dtensor.py:894 passes through when init_pg is absent, which is how the shared fixture is meant to be used.
  • Consistency with existing fixture
    • Same DTensorContinuousTestBase + class-level world_size shape already used by test_embedding_ops.py:35, test_tensor_ops.py:40 and test_redistribute.py:72.
    • The @skip_if_lt_x_gpu(4) on test_multi_mesh_inputs still works: it sys.exits the worker, and _worker_loop maps that exit code through TEST_SKIPS into a unittest.SkipTest at common_distributed.py:1978.
    • DTensorContinuousTestBase itself is covered by test/distributed/tensor/test_dtensor_testbase.py, including the CPU-fallback and accelerator-binding paths.

reason: clean
Reviewed commit: 54349ce

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 #197676

pytorchmergebot pushed a commit that referenced this pull request Sep 19, 2026
Reuse the continuous FSDP fixture for two replicate gradient accumulation tests. Preserve world size, test bodies, and all other classes.

Test plan: CUDA build and lint pass; two four-GPU tests improve from 12.912s to 6.645s, reverse order 6.647s, two GPUs 5.373s, postbuild 6.384s. Zero-GPU run preserves two skips.
Pull Request resolved: #197676
Approved by: https://github.com/pytorchgreenlight
ghstack dependencies: #197647, #197648, #197675
@github-actions
github-actions Bot deleted the gh/d4l3k/167/head branch November 23, 2026 01:48
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.

2 participants