Skip to content

[distributed] Reuse workers for FSDP2 state-dict tests - #197660

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

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

Conversation

@d4l3k

@d4l3k d4l3k commented Sep 19, 2026 •

Copy link
Copy Markdown
Member

Stack from ghstack (oldest at bottom):

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.

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

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

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

  • Scope
    • Diff is two lines in test/distributed/_composable/fsdp/test_fully_shard_state_dict.py: the import at line 19 and the base of TestFullyShardStateDictMultiProcess at line 35
    • No production code touched, and TestFullyShardStateDictMultiThread stays on FSDPTestMultiThread as the body claims
  • Base class compatibility
    • The class keeps world_size as a @property, which MultiProcContinuousTest._get_world_size handles explicitly via inspect.getattr_static in common_distributed.py
    • _worker_loop and _ensure_processes_spawned set cls.world_size to an int before _run_test_given_id assigns it, so the read-only property is not written to
  • Preserved behavior
    • FSDPTestContinuous.setUp/tearDown in common_fsdp.py keep the pre/post dist.barrier(), torch._dynamo.reset(), set_rng_seed(), and TORCH_NCCL_DESYNC_DEBUG=0 that FSDPTest._run provided
    • skip_if_lt_x_gpu's sys.exit path is mapped back to unittest.SkipTest in _worker_loop, so the @skip_if_lt_x_gpu(2)/(4) guards still skip rather than fail
  • Precedent
    • FSDPTestContinuous already backs ~35 test classes, including TestFullyShard2DTraining in the same _composable tree and property-form overrides in test_fsdp_misc.py and test_fsdp_grad_acc.py

reason: clean
Reviewed commit: f1120c3

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 added a commit that referenced this pull request Sep 19, 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.


ghstack-source-id: a92a373
Pull-Request: #197660
@d4l3k

d4l3k commented Sep 21, 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 21, 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/154/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

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