Skip to content

Propagate layout permutations through split (#22594) - #22594

Open
mcremon-meta wants to merge 1 commit into
mainfrom
export-D118743098
Open

Propagate layout permutations through split (#22594)#22594
mcremon-meta wants to merge 1 commit into
mainfrom
export-D118743098

Conversation

@mcremon-meta

@mcremon-meta mcremon-meta commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Summary:

Treat a split_with_sizes_copy and the getitem nodes that unpack it as one rank-preserving unit in RemovePermutesAroundElementwiseOps, remapping the split's dim under the region's permutation exactly as cat's dim is already remapped. A permutation only reorders axes, so the extent of the split axis is unchanged and split_sizes stays valid.

visit accepts a region only if every node in its transitive closure is permutable, so a single unrecognised node discards the whole subgraph. getitem is a plain operator.getitem: it carries no _op, so it is not tagged pointwise, it is not in the permutable set, and it is not a view. Any region reaching a split therefore failed, even though tuple indexing is layout-invariant and the split itself only needs its dim remapped.

Guard the numel-one input check with an isinstance test. A multi-output op carries a list of fake tensors in meta["val"], and calling numel() on that list raises.

Differential Revision: D118743098

@pytorch-bot

pytorch-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ No Failures

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

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

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 8, 2026
@meta-codesync

meta-codesync Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

@mcremon-meta has exported this pull request. If you are a Meta employee, you can view the originating Diff in D118743098.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Summary:

Treat a `split_with_sizes_copy` and the `getitem` nodes that unpack it as one rank-preserving unit in `RemovePermutesAroundElementwiseOps`, remapping the split's `dim` under the region's permutation exactly as `cat`'s dim is already remapped. A permutation only reorders axes, so the extent of the split axis is unchanged and `split_sizes` stays valid.

`visit` accepts a region only if every node in its transitive closure is permutable, so a single unrecognised node discards the whole subgraph. `getitem` is a plain `operator.getitem`: it carries no `_op`, so it is not tagged pointwise, it is not in the permutable set, and it is not a view. Any region reaching a split therefore failed, even though tuple indexing is layout-invariant and the split itself only needs its dim remapped.

Guard the numel-one input check with an `isinstance` test. A multi-output op carries a list of fake tensors in `meta["val"]`, and calling `numel()` on that list raises.

Differential Revision: D118743098
@meta-codesync meta-codesync Bot changed the title Propagate layout permutations through split Propagate layout permutations through split (#22594) Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant