Skip to content

Interface for swapping inputs and outputs based on cost model + working permute example#18929

Open
DrJessop wants to merge 2 commits intopytorch:mainfrom
DrJessop:export-D100917820
Open

Interface for swapping inputs and outputs based on cost model + working permute example#18929
DrJessop wants to merge 2 commits intopytorch:mainfrom
DrJessop:export-D100917820

Conversation

@DrJessop
Copy link
Copy Markdown
Contributor

Summary:
I have seen the following pattern quite a bit so far where we have

wrapper(x0), wrapper(x1), x2 -> op -> wrapper(o0), o1

for example, and it is semantically equivalent to instead run
x0, x1, wrapper(x2) -> op -> o0, wrapper(o1)

In case 1, we had 3 wrapper ops, and in case 2, we have 2, so it's better to run 2. This interface formalizes this idea. I also implemented the pass which uses this interface for the permute case.

What is really nice about this interface is that in a single pass, we can do a LOT of cleanup. See the docs in the diff for a case for adds.

Differential Revision: D100917820

Andrew Grebenisan added 2 commits April 15, 2026 17:21
Summary:

- Adds support to run to run passes on ExportedPrograms and EdgeProgramManager
- EdgeProgramManager transform behaves basically like a pass manager

Reviewed By: larryliu0820, ethansfng

Differential Revision: D91725222
…ng permute example

Summary:
I have seen the following pattern quite a bit so far where we have

wrapper(x0), wrapper(x1), x2 -> op -> wrapper(o0), o1

for example, and it is semantically equivalent to instead run
x0, x1, wrapper(x2) -> op -> o0, wrapper(o1)

In case 1, we had 3 wrapper ops, and in case 2, we have 2, so it's better to run 2. This interface formalizes this idea. I also implemented the pass which uses this interface for the permute case.

What is really nice about this interface is that in a single pass, we can do a LOT of cleanup. See the docs in the diff for a case for adds.

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

pytorch-bot bot commented Apr 16, 2026

🔗 Helpful Links

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

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

❌ 2 New Failures, 1 Cancelled Job, 2 Unrelated Failures

As of commit c5916b3 with merge base 2f339f0 (image):

NEW FAILURES - The following jobs have failed:

CANCELLED JOB - The following job was cancelled. Please retry:

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

meta-codesync bot commented Apr 16, 2026

@DrJessop has exported this pull request. If you are a Meta employee, you can view the originating Diff in D100917820.

@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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant