Skip to content

[DTensor] no-op redistribution shouldn't create _TransformInfo#172924

Closed
wconstab wants to merge 7 commits intogh/wconstab/505/basefrom
gh/wconstab/505/head
Closed

[DTensor] no-op redistribution shouldn't create _TransformInfo#172924
wconstab wants to merge 7 commits intogh/wconstab/505/basefrom
gh/wconstab/505/head

Conversation

@wconstab
Copy link
Copy Markdown
Contributor

@wconstab wconstab commented Jan 21, 2026

Stack from ghstack (oldest at bottom):

Previously, generate_greedy_transform_infos was happy to generate a
TransformInfo with src placements == dst placements, which was
pointless. Graph-based algo was safe, avoiding this.

Previously, generate_greedy_transform_infos was happy to generate a
TransformInfo with src placements == dst placements, which was
pointless.  Graph-based algo was safe, avoiding this.

[ghstack-poisoned]
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Jan 21, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/172924

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

✅ No Failures

As of commit 1b71100 with merge base 4ac0624 (image):
💚 Looks good so far! There are no failures yet. 💚

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

wconstab added a commit that referenced this pull request Jan 21, 2026
Previously, generate_greedy_transform_infos was happy to generate a
TransformInfo with src placements == dst placements, which was
pointless.  Graph-based algo was safe, avoiding this.

ghstack-source-id: 11571e8
Pull Request resolved: #172924
@wconstab wconstab requested a review from zpcore January 21, 2026 04:36
…Info"

Previously, generate_greedy_transform_infos was happy to generate a
TransformInfo with src placements == dst placements, which was
pointless.  Graph-based algo was safe, avoiding this.

[ghstack-poisoned]
wconstab added a commit that referenced this pull request Jan 22, 2026
Previously, generate_greedy_transform_infos was happy to generate a
TransformInfo with src placements == dst placements, which was
pointless.  Graph-based algo was safe, avoiding this.

ghstack-source-id: cba013e
Pull Request resolved: #172924
…Info"

Previously, generate_greedy_transform_infos was happy to generate a
TransformInfo with src placements == dst placements, which was
pointless.  Graph-based algo was safe, avoiding this.

[ghstack-poisoned]
wconstab added a commit that referenced this pull request Jan 22, 2026
Previously, generate_greedy_transform_infos was happy to generate a
TransformInfo with src placements == dst placements, which was
pointless.  Graph-based algo was safe, avoiding this.

ghstack-source-id: 17c2f1e
Pull Request resolved: #172924
return local_tensor

# Short-circuit if placements are already equal (no-op redistribution)
if current_spec.placements == target_spec.placements:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zpcore I confirmed that if I comment out these 2 lines, the tests all pass. With this short circuit, I get a hang in python test/distributed/tensor/test_redistribute.py DistributeWithDeviceOrderTest.test_ordered_redistribute, and I didn't debug it yet but I wonder if you can think of any reason why this could happen.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because even though current_spec.placements == target_spec.placements, current_spec.shard_order and target_spec.shard_order can still be different, which requires a redistribution. We can update this line to:

if current_spec.placements == target_spec.placements and current_spec.shard_order == target_spec.shard_order:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, that makes sense!!

…Info"

Previously, generate_greedy_transform_infos was happy to generate a
TransformInfo with src placements == dst placements, which was
pointless.  Graph-based algo was safe, avoiding this.

[ghstack-poisoned]
wconstab added a commit that referenced this pull request Jan 22, 2026
Previously, generate_greedy_transform_infos was happy to generate a
TransformInfo with src placements == dst placements, which was
pointless.  Graph-based algo was safe, avoiding this.

ghstack-source-id: 29496ac
Pull Request resolved: #172924
Copy link
Copy Markdown
Member

@zpcore zpcore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

…Info"

Previously, generate_greedy_transform_infos was happy to generate a
TransformInfo with src placements == dst placements, which was
pointless.  Graph-based algo was safe, avoiding this.

[ghstack-poisoned]
wconstab added a commit that referenced this pull request Jan 24, 2026
Previously, generate_greedy_transform_infos was happy to generate a
TransformInfo with src placements == dst placements, which was
pointless.  Graph-based algo was safe, avoiding this.

ghstack-source-id: 92675f2
Pull Request resolved: #172924
…Info"

Previously, generate_greedy_transform_infos was happy to generate a
TransformInfo with src placements == dst placements, which was
pointless.  Graph-based algo was safe, avoiding this.

[ghstack-poisoned]
wconstab added a commit that referenced this pull request Jan 24, 2026
Previously, generate_greedy_transform_infos was happy to generate a
TransformInfo with src placements == dst placements, which was
pointless.  Graph-based algo was safe, avoiding this.

ghstack-source-id: 38eef46
Pull Request resolved: #172924
…Info"

Previously, generate_greedy_transform_infos was happy to generate a
TransformInfo with src placements == dst placements, which was
pointless.  Graph-based algo was safe, avoiding this.

[ghstack-poisoned]
@wconstab
Copy link
Copy Markdown
Contributor Author

@pytorchbot merge

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Jan 24, 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

suncapitalllc007-star pushed a commit to suncapitalllc007-star/pytorch that referenced this pull request Jan 25, 2026
Previously, generate_greedy_transform_infos was happy to generate a
TransformInfo with src placements == dst placements, which was
pointless.  Graph-based algo was safe, avoiding this.

ghstack-source-id: b83774e
Pull Request resolved: pytorch/pytorch#172924
pytorchmergebot pushed a commit that referenced this pull request Jan 26, 2026
riccardofelluga pushed a commit to riccardofelluga/pytorch that referenced this pull request Jan 27, 2026
…ch#172924)

Previously, generate_greedy_transform_infos was happy to generate a
TransformInfo with src placements == dst placements, which was
pointless.  Graph-based algo was safe, avoiding this.
Pull Request resolved: pytorch#172924
Approved by: https://github.com/zpcore
riccardofelluga pushed a commit to riccardofelluga/pytorch that referenced this pull request Jan 27, 2026
@github-actions github-actions Bot deleted the gh/wconstab/505/head branch February 24, 2026 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/inductor ciflow/trunk Trigger trunk jobs on your pull request Merged release notes: distributed (dtensor) release notes category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants