Skip to content

[distributed] Reuse replicate gradient accumulation workers - #197676

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

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

Conversation

@d4l3k

@d4l3k d4l3k commented Sep 19, 2026 •

Copy link
Copy Markdown
Member

Stack from ghstack (oldest at bottom):

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.

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

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 617363a with merge base b7954b2 (image):

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

  • Scope
    • Diff is two lines in test/distributed/_composable/test_replicate_training.py: adds the FSDPTestContinuous import and reparents TestReplicateGradientAccumulation
    • No source, config, or CI-workflow file is touched, so no public API, docs policy, or blocking-workflow job changes
  • Fixture compatibility
    • FSDPTestContinuous (torch/testing/_internal/common_fsdp.py:1605) shares FSDPTestMixin with FSDPTest, so run_subtests, self.rank, and self.world_size used by both tests keep working
    • The retained @property world_size is handled by MultiProcContinuousTest._get_world_size (common_distributed.py:2051), which evaluates properties, so min(4, device_count()) is preserved
    • Grep of the test file finds no use of FSDPTest-only members (file_name, init_method, process_group, destroy_pg_upon_exit)
  • Skip and isolation behavior
    • skip_if_lt_x_gpu(2) still yields skips: its sys.exit is caught in _worker_loop (common_distributed.py:1978) and mapped through TEST_SKIPS to a SkipTest returned to the dispatcher
    • Per-test isolation is kept by FSDPTestContinuous.setUp/tearDown barriers plus torch._dynamo.reset() and set_rng_seed() (common_fsdp.py:1638)
    • Same migration already applied to TestReplicateMixedPrecisionTraining and ~25 test/distributed/fsdp classes, including property-based world_size in test_fsdp_misc.py:81
  • Correctness of test bodies
    • test_gradient_accumulation and test_1f1b_microbatching bodies and assertions are unchanged in the diff; only the base class line 837 differs
    • Other classes in the file (TestReplicateCustomForwardMethod, TestReplicateTPTraining) still derive from FSDPTest, matching the stated intent

reason: clean
Reviewed commit: 617363a

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.

@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

@github-actions
github-actions Bot deleted the gh/d4l3k/168/head branch November 23, 2026 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants