Skip to content

[distributed] Reuse workers for HSDP checkpoint tests - #197667

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

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

Conversation

@d4l3k

@d4l3k d4l3k commented Sep 19, 2026 •

Copy link
Copy Markdown
Member

Stack from ghstack (oldest at bottom):

Reuse workers across the four checkpoint cases while preserving rank counts, per-test directories, and the combined CPU/accelerator backend. Use Gloo for CPU fallback when GPU-gated cases skip.

Test plan: CUDA build and lint; four cases in normal and reverse order, expected skips with two and zero visible GPUs, and four cases after rebuilding. Runtime fell from 28.4s to 12.2s.

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

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

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

  • Scope
    • Single test file test/distributed/checkpoint/test_hsdp_checkpoint.py; only the base class, world_size, and the backend hook change, test bodies untouched
    • Follows the established migration already used by test/distributed/fsdp/test_hsdp_dtensor_state_dict.py:51 and test/distributed/tensor/test_redistribute.py:72
  • Rank count preserved
    • world_size = NUM_DEVICES matches the old DTensorTestBase.world_size property at common_dtensor.py:791, so the 4-rank init_device_mesh(.., (2, world_size // 2)) meshes are unchanged
    • MultiProcContinuousTest._ensure_processes_spawned reads the class-level world_size via _get_world_size (common_distributed.py:2107), so it is not reset to the -2 default
  • Backend hook correctness
    • backend_str rebuilds the same composite f"cpu:gloo,{device_type}:{curr_backend}" the removed backend property produced, and the new cpu branch avoids the invalid cpu:gloo,cpu:gloo that get_default_backend_for_device("cpu") would have yielded
    • is_backend_available at distributed_c10d.py:2020 handles the composite form, so the pre-spawn availability check in common_distributed.py:2112 still passes
  • GPU-gated skips still work
    • @skip_if_lt_x_gpu(4) exits with a TEST_SKIPS code that _worker_loop maps back to unittest.SkipTest (common_distributed.py:1978-1992), so the four cases skip cleanly rather than failing
    • with_temp_dir is unchanged and still broadcasts a fresh per-test directory from rank 0 (checkpoint_utils.py:134-164)

reason: clean
Reviewed commit: b7cf9ac

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 marked this pull request as ready for review September 19, 2026 04:37
d4l3k added a commit that referenced this pull request Sep 19, 2026
Reuse workers across the four checkpoint cases while preserving rank counts, per-test directories, and the combined CPU/accelerator backend. Use Gloo for CPU fallback when GPU-gated cases skip.

Test plan: CUDA build and lint; four cases in normal and reverse order, expected skips with two and zero visible GPUs, and four cases after rebuilding. Runtime fell from 28.4s to 12.2s.

ghstack-source-id: d109c48
Pull-Request: #197667
@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/160/head branch November 23, 2026 01:46
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