Skip to content

Reuse workers for sharded optimizer tests - #197696

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

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

Conversation

@d4l3k

@d4l3k d4l3k commented Sep 19, 2026 •

Copy link
Copy Markdown
Member

Stack from ghstack (oldest at bottom):

Reuse four distributed workers across optimizer tests that already disable RPC. Preserve the backend selection and per-rank device binding without changing the shared RPC harness.

Test plan: CUDA build and lint; both tests normally, in reverse order and after build; two expected skips on two GPUs and CPU. Baseline 11.18s; reused workers 5.77s before rebuild.

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

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

✅ No Failures

As of commit ca377d6 with merge base b7954b2 (image):
💚 Looks good so far! There are no failures yet. 💚

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

  • Harness swap is correct
    • DTensorContinuousTestBase defines no init_pg, so bare @with_comms takes the passthrough branch at common_dtensor.py:894 and reuses the class-scoped group from _worker_loop
    • world_size = 4 matches the TEST_GPU_NUM = 4 the old ShardedTensorTestBase.world_size returned
  • Preservation
    • Backend selection survives in DTensorContinuousTestBase.backend_str(), which resolves the same get_default_backend_for_device the deleted module-level backend computed
    • Per-rank binding survives in DTensorContinuousTestBase._init_pg, which calls torch.accelerator.set_device_index(rank)
    • Dropping init_rpc=False loses nothing: neither test passes init_rrefs, so _post_init in sharded_tensor/api.py:300 never touches RPC
  • Skip paths still resolve
    • skip_if_lt_x_gpu(4) exits with a TEST_SKIPS code that _worker_loop converts to unittest.SkipTest, and _init_pg oversubscription exits the same way
  • Scope
    • One test file, two decorator sites plus the base class; ShardedTensorTestBase and its with_comms stay intact for the other files importing them

reason: clean
Reviewed commit: ca377d6

Inference job

🐛 Report a wrong verdict

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Starting merge as part of PR stack under #197697

1 similar comment
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Starting merge as part of PR stack under #197697

pytorchmergebot pushed a commit that referenced this pull request Sep 21, 2026
Reuse four workers across rowwise and columnwise embedding tests that already disable RPC. Preserve the complete sharding, padding and renormalization matrix.

Test plan: CUDA build and lint; both tests normally, in reverse order and after build; two expected skips on two GPUs and CPU. Baseline 13.28s; reused workers 6.91s before rebuild.
Pull Request resolved: #197697
Approved by: https://github.com/pytorchgreenlight
ghstack dependencies: #197647, #197648, #197696
@github-actions
github-actions Bot deleted the gh/d4l3k/185/head branch November 24, 2026 01:44
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