Skip to content

Handle rank-changing views in RemovePermutesAroundElementwiseOps#19538

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

Handle rank-changing views in RemovePermutesAroundElementwiseOps#19538
mcremon-meta wants to merge 1 commit into
mainfrom
export-D104775244

Conversation

@mcremon-meta
Copy link
Copy Markdown
Contributor

@mcremon-meta mcremon-meta commented May 13, 2026

Summary:
Extend RemovePermutesAroundElementwiseOps to cancel permute pairs across rank-changing squeeze/unsqueeze view boundaries. When a permute's sole user is a view_copy that adds or removes a single size-1 dimension, the pass adapts the expected permutation to the new rank and continues traversal. This enables removing permutes that sit on opposite sides of an unsqueeze→elementwise→squeeze chain (e.g. the NHWC↔NTC layout conversion around convolutions in the cascade detector model).

Key changes:

  • Accept extra_permutable_ops constructor parameter for backend-specific ops
  • Track per-node expected permutations across view boundaries
  • Run dimension updates before edges_in bypass to preserve original metadata
  • Handle view_copy, unsqueeze_copy, squeeze_copy rank changes
  • Treat aten.full.default as a compile-time constant

Differential Revision: D104775244

cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani

Summary:
Extend RemovePermutesAroundElementwiseOps to cancel permute pairs across rank-changing squeeze/unsqueeze view boundaries. When a permute's sole user is a view_copy that adds or removes a single size-1 dimension, the pass adapts the expected permutation to the new rank and continues traversal. This enables removing permutes that sit on opposite sides of an unsqueeze→elementwise→squeeze chain (e.g. the NHWC↔NTC layout conversion around convolutions in the cascade detector model).

Key changes:
- Accept extra_permutable_ops constructor parameter for backend-specific ops
- Track per-node expected permutations across view boundaries
- Run dimension updates before edges_in bypass to preserve original metadata
- Handle view_copy, unsqueeze_copy, squeeze_copy rank changes
- Treat aten.full.default as a compile-time constant

Differential Revision: D104775244
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented May 13, 2026

🔗 Helpful Links

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

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:

❌ 5 New Failures, 3 Unrelated Failures, 1 Unclassified Failure

As of commit 981fc88 with merge base b04cc65 (image):

NEW FAILURES - The following jobs have failed:

UNCLASSIFIED FAILURE - DrCI could not classify the following job because the workflow did not run on the merge base. The failure may be pre-existing on trunk or introduced by this PR:

  • periodic (gh) (this job did not run on the merge base, so DrCI cannot tell whether the failure is pre-existing)

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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 May 13, 2026
@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync Bot commented May 13, 2026

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

@github-actions
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: arm Issues related to arm backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant