Skip to content

[distributed] Reuse safetensors resharding workers - #197677

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

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

Conversation

@d4l3k

@d4l3k d4l3k commented Sep 19, 2026 •

Copy link
Copy Markdown
Member

Stack from ghstack (oldest at bottom):

Reuse continuous DTensor workers across placement-change and mesh-change checkpoint tests. Preserve rank counts, temporary-directory cleanup, assertions, and the single-test consolidation fixture.

Test plan: CUDA build and lint pass; five four-GPU cases improve from 73.563s to 57.569s, reversed order 54.946s, postbuild 57.005s. Two-GPU and CPU-fallback runs preserve two and five expected 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/197677

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

✅ You can merge normally! (3 Unrelated Failures)

As of commit 6408324 with merge base b7954b2 (image):

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

  • Scope
    • Test-only diff: two classes in test/distributed/checkpoint/test_hf_safetensor_e2e.py swap DTensorTestBase for DTensorContinuousTestBase plus a world_size assignment
    • TestDistributedHFSafetensorsConsolidation stays on DTensorTestBase, and no test body, assertion, or dist_cp call site changes
  • Rank count preserved
    • DTensorTestBase.world_size was a property returning NUM_DEVICES (common_dtensor.py:791), so world_size = NUM_DEVICES keeps the same value
    • MultiProcContinuousTest._get_world_size (common_distributed.py:2051) reads the class var directly, so the explicit set is needed to avoid the -2 device-count default
  • Established pattern
    • test/distributed/checkpoint/test_state_dict_utils.py:32 already uses DTensorContinuousTestBase with world_size, @with_comms, and @skip_if_lt_x_gpu together
    • with_comms passthroughs when the harness lacks init_pg (common_dtensor.py:894), which the continuous base does — the worker's _init_pg owns the process group
  • Skip and cleanup paths intact
    • DTensorContinuousTestBase._init_pg (common_dtensor.py:707) exits with the multi-device skip code, which _worker_loop maps to SkipTest (common_distributed.py:1978)
    • with_temp_dir keys on dist.is_initialized() and barriers before rank-0 rmtree (checkpoint_utils.py:135), which still holds with a persistent group

reason: clean
Reviewed commit: 6408324

Inference job

🐛 Report a wrong verdict

NEW FAILURES SUPPRESSED BY AI (non-blocking) - The following job failed, but the AI CI Advisor judged the failure not to be evidence against this change:

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

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge failed

Reason: 1 jobs have failed, first few of them are: trunk / macos-py3-arm64 / test (default, 3, 3, macos-m1-stable)

Details for Dev Infra team Raised by workflow job

@d4l3k

d4l3k commented Sep 21, 2026

Copy link
Copy Markdown
Member Author

@pytorchbot merge -i

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged while ignoring the following 1 checks: trunk / macos-py3-arm64 / test (default, 3, 3, macos-m1-stable)

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

pytorchmergebot pushed a commit that referenced this pull request Sep 21, 2026
Reuse the continuous FSDP fixture for five mixed precision training tests, preserving rank counts, scoped collective patches, and all test bodies. Leave single-test JVP and threaded cast fixtures unchanged.

Test plan: CUDA build and lint pass; five four-GPU tests improve from 62.716s to 34.871s, reversed order 34.825s, postbuild 33.498s. Two GPUs pass in 12.796s; one and zero GPUs preserve five skips.
Pull Request resolved: #197678
Approved by: https://github.com/pytorchgreenlight, https://github.com/Skylion007
ghstack dependencies: #197647, #197648, #197677
danieldale2026 added a commit to danieldale2026/pytorch that referenced this pull request Oct 28, 2026
Mark the single-rank save/load tests as GENERIC and the multi-rank
consolidation and resharding tests as ACCELERATOR, and instantiate the latter
with instantiate_device_type_tests(except_for=("cpu",), allow_xpu=True) so any
registered accelerator collects them.

The resharding classes keep DTensorContinuousTestBase from pytorch#197677; its process
pool is spawned lazily to support device-type instantiation, as in
test_fsdp_dtensor_state_dict.py. Test bodies keep using self.device_type; the
`device` argument is only accepted to satisfy device-type instantiation.
TestCompressedTensorsMXFP4ShardedLoad (added in pytorch#201291) is left unchanged.

This replaces the earlier version of this PR, which targeted the file before
pytorch#197677.

Test Plan:

```bash
spin quicklint test/distributed/checkpoint/test_hf_safetensor_e2e.py
```

No runtime available locally: the file depends on DCP helpers newer than the
available NPU nightly, and there is no local CUDA build. Relying on CI.

Prepared with AI assistance and reviewed by the contributor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018dErhVMhZwJQXMUAkGfe9X
@github-actions
github-actions Bot deleted the gh/d4l3k/169/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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants