Skip to content

Centralize use_strided_shard_as_shard_order propagation for all ops - #179208

Closed
zpcore wants to merge 1 commit into
mainfrom
piz/ss_seperate
Closed

zpcore wants to merge 1 commit into
mainfrom
piz/ss_seperate

Conversation

@zpcore

@zpcore zpcore commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

View ops (flatten) produce literal _StridedShard placements with use_strided_shard_as_shard_order=False. Previously, downstream ops could auto-detect this flag incorrectly due to use_strided_shard_as_shard_order not getting correctly propagate into downstream DTensorSpec.

This change:

  • Adds _propagate_use_strided_shard_flag in the sharding propagator as a centralized post-processing step for all OpStrategy results, ensuring use_strided_shard_as_shard_order is always inherited from input specs.
  • Adds a guard in view ops to error on inputs with use_strided_shard_as_shard_order=True (shard-order-encoded _StridedShard would be misinterpreted by dimension mapping).
  • Improves post_init auto-detection to actually attempt shard order decoding before setting the flag to True.
  • Revert temporary fix in [DTensor] support _StridedShard redistribution for arbitrary split_factor #178735.

Authored with Claude.

@pytorch-bot

pytorch-bot Bot commented Apr 3, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

⏳ No Failures, 1 Pending

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

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

@pytorch-bot pytorch-bot Bot added ciflow/dtensor Run DTensor specific tests ciflow/inductor ciflow/torchtitan Run TorchTitan integration tests release notes: distributed (dtensor) release notes category labels Apr 3, 2026
@zpcore
zpcore requested a review from weifengpy April 3, 2026 00:07
@zpcore
zpcore marked this pull request as ready for review April 3, 2026 00:07
@zpcore zpcore added the topic: not user facing topic category label Apr 3, 2026

@weifengpy weifengpy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

see comment above

@zpcore
zpcore force-pushed the piz/ss_seperate branch 2 times, most recently from cef8ff4 to 492fdfb Compare April 6, 2026 22:06

@weifengpy weifengpy left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

see comments above

@zpcore
zpcore force-pushed the piz/ss_seperate branch from 492fdfb to a5734e2 Compare April 7, 2026 20:46
@zpcore

zpcore commented Apr 7, 2026

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 Apr 7, 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: 3 mandatory check(s) failed. The first few are:

Dig deeper by viewing the failures on hud

Details for Dev Infra team Raised by workflow job

Failing merge rule: Core Maintainers

@zpcore

zpcore commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge

@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 / linux-jammy-cuda13.0-py3.10-gcc11 / test (distributed, 3, 3, lf.linux.g4dn.12xlarge.nvidia.gpu)

Details for Dev Infra team Raised by workflow job

@zpcore
zpcore force-pushed the piz/ss_seperate branch 2 times, most recently from 24e3c1d to ba41a02 Compare April 8, 2026 00:52
@zpcore
zpcore force-pushed the piz/ss_seperate branch 2 times, most recently from d7ff08c to 6d3fc9e Compare April 9, 2026 07:06
@zpcore

zpcore commented Apr 9, 2026

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

This PR updates submodules third_party/kineto

If those updates are intentional, please add "submodule" keyword to PR title/description.

View ops (flatten) produce literal _StridedShard placements with
use_strided_shard_as_shard_order=False. Previously, downstream ops
could auto-detect this flag incorrectly (e.g., when split_factor
happened to match mesh dim size). The propagation logic was also
scattered across expand_to_full_mesh_op_strategy and try_propagate,
leaving custom strategy functions unprotected.

This change:
- Adds _propagate_use_strided_shard_flag in the sharding propagator
  as a centralized post-processing step for all OpStrategy results,
  ensuring use_strided_shard_as_shard_order is always inherited from
  input specs.
- Adds a guard in view ops to error on inputs with
  use_strided_shard_as_shard_order=True (shard-order-encoded
  _StridedShard would be misinterpreted by dimension mapping).
- Improves __post_init__ auto-detection to actually attempt shard
  order decoding before setting the flag to True.
- Removes the now-redundant propagation logic from
  expand_to_full_mesh_op_strategy and try_propagate.

Authored with Claude.
@zpcore
zpcore force-pushed the piz/ss_seperate branch from 6d3fc9e to e1299a2 Compare April 9, 2026 16:46
@zpcore

zpcore commented Apr 9, 2026

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge

@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 piz/ss_seperate branch May 10, 2026 02:27
gplutop7 pushed a commit to gplutop7/pytorch that referenced this pull request Jul 15, 2026
…ytorch#179208)

View ops (flatten) produce literal _StridedShard placements with use_strided_shard_as_shard_order=False. Previously, downstream ops could auto-detect this flag incorrectly due to `use_strided_shard_as_shard_order` not getting correctly propagate into downstream DTensorSpec.

This change:
- Adds _propagate_use_strided_shard_flag in the sharding propagator as a centralized post-processing step for all OpStrategy results, ensuring use_strided_shard_as_shard_order is always inherited from input specs.
- Adds a guard in view ops to error on inputs with use_strided_shard_as_shard_order=True (shard-order-encoded _StridedShard would be misinterpreted by dimension mapping).
- Improves __post_init__ auto-detection to actually attempt shard order decoding before setting the flag to True.
- Revert temporary fix in pytorch#178735.

Authored with Claude.
Pull Request resolved: pytorch#179208
Approved by: https://github.com/weifengpy
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
…ytorch#179208)

View ops (flatten) produce literal _StridedShard placements with use_strided_shard_as_shard_order=False. Previously, downstream ops could auto-detect this flag incorrectly due to `use_strided_shard_as_shard_order` not getting correctly propagate into downstream DTensorSpec.

This change:
- Adds _propagate_use_strided_shard_flag in the sharding propagator as a centralized post-processing step for all OpStrategy results, ensuring use_strided_shard_as_shard_order is always inherited from input specs.
- Adds a guard in view ops to error on inputs with use_strided_shard_as_shard_order=True (shard-order-encoded _StridedShard would be misinterpreted by dimension mapping).
- Improves __post_init__ auto-detection to actually attempt shard order decoding before setting the flag to True.
- Revert temporary fix in pytorch#178735.

Authored with Claude.
Pull Request resolved: pytorch#179208
Approved by: https://github.com/weifengpy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/dtensor Run DTensor specific tests ciflow/inductor ciflow/torchtitan Run TorchTitan integration tests ciflow/trunk Trigger trunk jobs on your pull request Merged release notes: distributed (dtensor) release notes category topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants