Skip to content

Move verification to after to_backend #12630

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2025

Conversation

lucylq
Copy link
Contributor

@lucylq lucylq commented Jul 18, 2025

Summary:
Some operators require preservation because they are intended to be consumed by a backend. These operators can contain view and mutation, as they won't be part of the graph after to_backend.

If there are still view and mutation ops after to_backend, verification should throw an error.

Differential Revision: D78535519

Copy link

pytorch-bot bot commented Jul 18, 2025

🔗 Helpful Links

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

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

❌ 1 New Failure

As of commit dbf5b20 with merge base 413dee4 (image):

NEW FAILURE - The following job has failed:

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 Jul 18, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D78535519

Copy link

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.

@lucylq lucylq force-pushed the export-D78535519 branch from aa4be11 to 7c0782d Compare July 18, 2025 18:02
lucylq added a commit to lucylq/executorch-1 that referenced this pull request Jul 18, 2025
Summary:

Some operators require preservation because they are intended to be consumed by a backend. These operators can contain view and mutation, as they won't be part of the graph after to_backend.

If there are still view and mutation ops after to_backend, verification should throw an error.

This diff:
1. Removes verification check from _generated_edge_program, which is called by to_edge and to_edge_transform_and_lower
2. Add verification check in to_edge
3. to_edge_transform_and_lower already has a verification check after to_backend; add config.preserve ops there.

Reviewed By: metascroy

Differential Revision: D78535519
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D78535519

lucylq added a commit to lucylq/executorch-1 that referenced this pull request Jul 18, 2025
Summary:

Some operators require preservation because they are intended to be consumed by a backend. These operators can contain view and mutation, as they won't be part of the graph after to_backend.

If there are still view and mutation ops after to_backend, verification should throw an error.

This diff:
1. Removes verification check from _generated_edge_program, which is called by to_edge and to_edge_transform_and_lower
2. Add verification check in to_edge
3. to_edge_transform_and_lower already has a verification check after to_backend; add config.preserve ops there.

Remove preserve_ops_view test; after to_edge, there should be no view ops.

https://www.internalfb.com/code/fbsource/[f677b61422b9927eabc36d3b15857b06186cf7ef]/fbcode/executorch/exir/program/_program.py?lines=835

Reviewed By: metascroy

Differential Revision: D78535519
@lucylq lucylq force-pushed the export-D78535519 branch from 7c0782d to 607abbc Compare July 18, 2025 20:59
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D78535519

lucylq added a commit to lucylq/executorch-1 that referenced this pull request Jul 18, 2025
Summary:

Some operators require preservation because they are intended to be consumed by a backend. These operators can contain view and mutation, as they won't be part of the graph after to_backend.

If there are still view and mutation ops after to_backend, verification should throw an error.

This diff:
1. Removes verification check from _generated_edge_program, which is called by to_edge and to_edge_transform_and_lower
2. Add verification check in to_edge
3. to_edge_transform_and_lower already has a verification check after to_backend; add config.preserve ops there.

Remove preserve_ops_view test; after to_edge, there should be no view ops.

https://www.internalfb.com/code/fbsource/[f677b61422b9927eabc36d3b15857b06186cf7ef]/fbcode/executorch/exir/program/_program.py?lines=835

Reviewed By: metascroy

Differential Revision: D78535519
@lucylq lucylq force-pushed the export-D78535519 branch from 607abbc to f5c9c6a Compare July 18, 2025 23:32
lucylq added a commit to lucylq/executorch-1 that referenced this pull request Jul 18, 2025
Summary:
Pull Request resolved: pytorch#12630

Some operators require preservation because they are intended to be consumed by a backend. These operators can contain view and mutation, as they won't be part of the graph after to_backend.

If there are still view and mutation ops after to_backend, verification should throw an error.

This diff:
1. Removes verification check from _generated_edge_program, which is called by to_edge and to_edge_transform_and_lower.
2. to_edge: run verification for aten dialect (before to_edge) and edge dialect (after to_edge).
3. to_edge_transform_and_lower: only run the edge verification.

Reviewed By: metascroy

Differential Revision: D78535519
@lucylq lucylq force-pushed the export-D78535519 branch from f5c9c6a to fbb56fc Compare July 18, 2025 23:36
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D78535519

lucylq added a commit to lucylq/executorch-1 that referenced this pull request Jul 18, 2025
Summary:

Some operators require preservation because they are intended to be consumed by a backend. These operators can contain view and mutation, as they won't be part of the graph after to_backend.

If there are still view and mutation ops after to_backend, verification should throw an error.

This diff:
1. Removes verification check from _generated_edge_program, which is called by to_edge and to_edge_transform_and_lower.
2. to_edge: run verification for aten dialect (before to_edge) and edge dialect (after to_edge).
3. to_edge_transform_and_lower: only run the edge verification.

Reviewed By: metascroy

Differential Revision: D78535519
@lucylq lucylq force-pushed the export-D78535519 branch from fbb56fc to 3979a74 Compare July 18, 2025 23:49
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D78535519

@lucylq lucylq force-pushed the export-D78535519 branch from 3979a74 to 180a4fc Compare July 21, 2025 18:33
lucylq added a commit to lucylq/executorch-1 that referenced this pull request Jul 21, 2025
…pytorch#12630)

Summary:

Some operators require preservation because they are intended to be consumed by a backend. These operators can contain view and mutation, as they won't be part of the graph after to_backend.

If there are still view and mutation ops after to_backend, verification should throw an error.

This diff:
1. Removes verification check from _generated_edge_program, which is called by to_edge and to_edge_transform_and_lower on the aten dialect.
2. to_edge: run verification for aten dialect (before to_edge) and edge dialect (after to_edge).
3. to_edge_transform_and_lower: only run the edge verification.

Reviewed By: metascroy

Differential Revision: D78535519
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D78535519

lucylq added a commit to lucylq/executorch-1 that referenced this pull request Jul 21, 2025
…pytorch#12630)

Summary:

Some operators require preservation because they are intended to be consumed by a backend. These operators can contain view and mutation, as they won't be part of the graph after to_backend.

If there are still view and mutation ops after to_backend, verification should throw an error.

This diff:
1. Removes verification check from _generated_edge_program, which is called by to_edge and to_edge_transform_and_lower on the aten dialect.
2. to_edge: run verification for aten dialect (before to_edge) and edge dialect (after to_edge).
3. to_edge_transform_and_lower: only run the edge verification.

Reviewed By: metascroy

Differential Revision: D78535519
@lucylq lucylq force-pushed the export-D78535519 branch from 180a4fc to 1f77863 Compare July 21, 2025 19:23
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D78535519

lucylq added a commit to lucylq/executorch-1 that referenced this pull request Jul 21, 2025
…pytorch#12630)

Summary:
Pull Request resolved: pytorch#12630

Some operators require preservation because they are intended to be consumed by a backend. These operators can contain view and mutation, as they won't be part of the graph after to_backend.

If there are still view and mutation ops after to_backend, verification should throw an error.

This diff:
1. Removes verification check from _generated_edge_program, which is called by to_edge and to_edge_transform_and_lower on the aten dialect.
2. to_edge: run verification for aten dialect (before to_edge) and edge dialect (after to_edge).
3. to_edge_transform_and_lower: only run the edge verification.

Reviewed By: metascroy

Differential Revision: D78535519
@lucylq lucylq force-pushed the export-D78535519 branch from 1f77863 to 2221a7a Compare July 21, 2025 19:27
lucylq added a commit to lucylq/executorch-1 that referenced this pull request Jul 21, 2025
…pytorch#12630)

Summary:

Some operators require preservation because they are intended to be consumed by a backend. These operators can contain view and mutation, as they won't be part of the graph after to_backend.

If there are still view and mutation ops after to_backend, verification should throw an error.

This diff:
1. Removes verification check from _generated_edge_program, which is called by to_edge and to_edge_transform_and_lower on the aten dialect.
2. to_edge: run verification for aten dialect (before to_edge) and edge dialect (after to_edge).
3. to_edge_transform_and_lower: only run the edge verification.

Reviewed By: metascroy

Differential Revision: D78535519
@lucylq lucylq force-pushed the export-D78535519 branch from 2221a7a to cbfba38 Compare July 21, 2025 20:55
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D78535519

lucylq added a commit to lucylq/executorch-1 that referenced this pull request Jul 21, 2025
…pytorch#12630)

Summary:

Some operators require preservation because they are intended to be consumed by a backend. These operators can contain view and mutation, as they won't be part of the graph after to_backend.

If there are still view and mutation ops after to_backend, verification should throw an error.

This diff:
1. Removes verification check from _generated_edge_program, which is called by to_edge and to_edge_transform_and_lower on the aten dialect.
2. to_edge: run verification for aten dialect (before to_edge) and edge dialect (after to_edge).
3. to_edge_transform_and_lower: only run the edge verification.

Reviewed By: metascroy

Differential Revision: D78535519
@lucylq lucylq force-pushed the export-D78535519 branch from cbfba38 to 9838977 Compare July 21, 2025 21:05
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D78535519

lucylq added a commit to lucylq/executorch-1 that referenced this pull request Jul 21, 2025
…pytorch#12630)

Summary:
Pull Request resolved: pytorch#12630

Some operators require preservation because they are intended to be consumed by a backend. These operators can contain view and mutation, as they won't be part of the graph after to_backend.

If there are still view and mutation ops after to_backend, verification should throw an error.

This diff:
1. Removes verification check from _generated_edge_program, which is called by to_edge and to_edge_transform_and_lower on the aten dialect.
2. to_edge: run verification for aten dialect (before to_edge) and edge dialect (after to_edge).
3. to_edge_transform_and_lower: only run the edge verification.

Reviewed By: metascroy

Differential Revision: D78535519
@lucylq lucylq force-pushed the export-D78535519 branch from 9838977 to 4242981 Compare July 21, 2025 21:10
lucylq added a commit to lucylq/executorch-1 that referenced this pull request Jul 21, 2025
…pytorch#12630)

Summary:

Some operators require preservation because they are intended to be consumed by a backend. These operators can contain view and mutation, as they won't be part of the graph after to_backend.

If there are still view and mutation ops after to_backend, verification should throw an error.

This diff:
1. Removes verification check from _generated_edge_program, which is called by to_edge and to_edge_transform_and_lower on the aten dialect.
2. to_edge: run verification for aten dialect (before to_edge) and edge dialect (after to_edge).
3. to_edge_transform_and_lower: only run the edge verification.

Reviewed By: metascroy

Differential Revision: D78535519
@lucylq lucylq force-pushed the export-D78535519 branch from 4242981 to a44e2a9 Compare July 21, 2025 21:43
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D78535519

…pytorch#12630)

Summary:

Some operators require preservation because they are intended to be consumed by a backend. These operators can contain view and mutation, as they won't be part of the graph after to_backend.

If there are still view and mutation ops after to_backend, verification should throw an error.

This diff:
1. Removes verification check from _generated_edge_program, which is called by to_edge and to_edge_transform_and_lower on the aten dialect.
2. to_edge: run verification for aten dialect (before to_edge) and edge dialect (after to_edge).
3. to_edge_transform_and_lower: only run the edge verification.

Reviewed By: metascroy

Differential Revision: D78535519
@lucylq lucylq force-pushed the export-D78535519 branch from a44e2a9 to dbf5b20 Compare July 21, 2025 22:54
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D78535519

@facebook-github-bot facebook-github-bot merged commit 0e5e342 into pytorch:main Jul 22, 2025
100 of 102 checks passed
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants