Skip to content

[distributed] Reuse workers for FSDP submodule precision tests - #197651

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

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

Conversation

@d4l3k

@d4l3k d4l3k commented Sep 19, 2026 •

Copy link
Copy Markdown
Member

Stack from ghstack (oldest at bottom):

Avoid process and process-group startup for each submodule-precision case by using the continuous FSDP harness. Keep two ranks and all six cases unchanged; leave other mixed-precision classes isolated.

Test plan: CUDA build and lint; six cases in normal and reverse order and postbuild with two visible GPUs. Runtime drops from 32.1s to 4.4s.

@pytorch-bot pytorch-bot Bot added the topic: not user facing topic category label 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/197651

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

✅ No Failures

As of commit a5d4999 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
    • Diff is two lines: add FSDPTestContinuous to the common_fsdp import and reparent TestFSDPDifferentSubmodulePrecision at test/distributed/fsdp/test_fsdp_mixed_precision.py:1138
    • No test bodies, assertions, or cases change; the sibling classes TestFSDPMixedPrecisionSharded and TestFSDPTrainEval stay on FSDPTest
  • Harness compatibility
    • The six tests in lines 1143-1290 only use self.assertEqual/self.assertRaisesRegex, never self.process_group, self.rank, or run_subtests, all of which FSDPTestContinuous provides via FSDPTestMixin anyway (torch/testing/_internal/common_fsdp.py:1605)
    • The world_size property returning 2 is handled by MultiProcContinuousTest._get_world_size (common_distributed.py:2051), which reads properties via inspect.getattr_static
    • @skip_if_lt_x_gpu(2) still works: the worker's sys.exit is mapped back to unittest.SkipTest in _worker_loop (common_distributed.py:1978-1992)
  • Cross-test state reuse
    • Each test builds a fresh SaveForwardInputsModel/ToyModel and FSDP wrapper, and FSDPTestContinuous.setUp/tearDown reset dynamo and reseed RNG per test
    • The three assertRaisesRegex cases fail on a rank-symmetric mat1 and mat2 must have the same dtype matmul error in forward, so no rank issues a collective the other does not
    • Same pattern already in use for error-raising tests under this harness, e.g. test/distributed/fsdp/test_fsdp_misc.py:81 with assertRaisesRegex at line 428

reason: clean
Reviewed commit: a5d4999

Inference job

🐛 Report a wrong verdict

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:21
d4l3k added a commit that referenced this pull request Sep 19, 2026
Avoid process and process-group startup for each submodule-precision case by using the continuous FSDP harness. Keep two ranks and all six cases unchanged; leave other mixed-precision classes isolated.

Test plan: CUDA build and lint; six cases in normal and reverse order and postbuild with two visible GPUs. Runtime drops from 32.1s to 4.4s.


ghstack-source-id: 7c5865d
Pull-Request: #197651
d4l3k added a commit that referenced this pull request Sep 19, 2026
Avoid process and process-group startup for each submodule-precision case by using the continuous FSDP harness. Keep two ranks and all six cases unchanged; leave other mixed-precision classes isolated.

Test plan: CUDA build and lint; six cases in normal and reverse order and postbuild with two visible GPUs. Runtime drops from 32.1s to 4.4s.


ghstack-source-id: 7c5865d
Pull-Request: #197651
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Starting merge as part of PR stack under #197654

pytorchmergebot pushed a commit that referenced this pull request Sep 19, 2026
…197654)

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.
Pull Request resolved: #197654
Approved by: https://github.com/pytorchgreenlight
ghstack dependencies: #197647, #197650, #197651
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
@github-actions
github-actions Bot deleted the gh/d4l3k/146/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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants