Skip to content

[to_edge] Allow core aten op exception list #5237

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

Closed
wants to merge 1 commit into from

Conversation

larryliu0820
Copy link
Contributor

Summary: Currently when a non-core ATen operator shows up in the exported graph, to_edge() will fail and the only option is to disable IR validity check by setting _check_ir_validity=False. However this is unsafe to do, instead we should still run the rest of the checks.

This PR adds support to allow users to bypass core ATen ops check, by passing a list of non-core ATen ops into to_edge().

Note that:

  • This is different than ops_set_to_not_decompose in to_edge_transform_and_lower, as the ops in _core_aten_ops_exception_list are not intended to be kept but more likely showing up because of missing decompositions or missing core ATen tag in native_functions.yaml. For this reason, we are combining two lists (ops_set_to_not_decompose and _core_aten_ops_exception_list) and pass to verifier.
  • I updated the error log to encourage people to use _core_aten_ops_exception_list instead of using _check_ir_validity=False.

Test Plan: Added unit test

Reviewers:

Subscribers:

Tasks:

Tags:

Copy link

pytorch-bot bot commented Sep 10, 2024

🔗 Helpful Links

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

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

✅ No Failures

As of commit 96219bc with merge base cac2c05 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@facebook-github-bot facebook-github-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 10, 2024
@larryliu0820 larryliu0820 requested review from tarun292, zhxchen17 and Gasoonjia and removed request for tarun292 September 10, 2024 21:59
@facebook-github-bot
Copy link
Contributor

@larryliu0820 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@JacobSzwejbka
Copy link
Contributor

JacobSzwejbka commented Sep 10, 2024

as the ops in _core_aten_ops_exception_list are not intended to be kept but more likely showing up because of missing decompositions or missing core ATen tag in native_functions.yaml.

Why dont we just fix these when they happen then instead of allowing people to bypass?

Fundamentally Im unsure of the value of a verifier if the recommended course of action when it fails is just to bypass. If bypassing it is fine then why not just always bypass? If its not fine in general why is it fine for this specific user who its failing for?

facebook-github-bot pushed a commit that referenced this pull request Sep 10, 2024
Summary:
Currently when a non-core ATen operator shows up in the exported graph, `to_edge()` will fail and the only option is to disable IR validity check by setting `_check_ir_validity=False`. However this is unsafe to do, instead we should still run the rest of the checks.

This PR adds support to allow users to bypass core ATen ops check, by passing a list of non-core ATen ops into `to_edge()`.

Note that:

* This is different than `ops_set_to_not_decompose` in `to_edge_transform_and_lower`, as the ops in `_core_aten_ops_exception_list` are not intended to be kept but more likely showing up because of missing decompositions or missing core ATen tag in `native_functions.yaml`. For this reason, we are combining two lists (`ops_set_to_not_decompose` and `_core_aten_ops_exception_list`) and pass to verifier.
* I updated the error log to encourage people to use `_core_aten_ops_exception_list` instead of using `_check_ir_validity=False`.


Test Plan: Added unit test

Reviewed By: tarun292

Differential Revision: D62469015

Pulled By: larryliu0820
@facebook-github-bot
Copy link
Contributor

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

facebook-github-bot pushed a commit that referenced this pull request Sep 10, 2024
Summary:
Currently when a non-core ATen operator shows up in the exported graph, `to_edge()` will fail and the only option is to disable IR validity check by setting `_check_ir_validity=False`. However this is unsafe to do, instead we should still run the rest of the checks.

This PR adds support to allow users to bypass core ATen ops check, by passing a list of non-core ATen ops into `to_edge()`.

Note that:

* This is different than `ops_set_to_not_decompose` in `to_edge_transform_and_lower`, as the ops in `_core_aten_ops_exception_list` are not intended to be kept but more likely showing up because of missing decompositions or missing core ATen tag in `native_functions.yaml`. For this reason, we are combining two lists (`ops_set_to_not_decompose` and `_core_aten_ops_exception_list`) and pass to verifier.
* I updated the error log to encourage people to use `_core_aten_ops_exception_list` instead of using `_check_ir_validity=False`.


Test Plan: Added unit test

Reviewed By: tarun292

Differential Revision: D62469015

Pulled By: larryliu0820
@facebook-github-bot
Copy link
Contributor

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

@larryliu0820
Copy link
Contributor Author

as the ops in _core_aten_ops_exception_list are not intended to be kept but more likely showing up because of missing decompositions or missing core ATen tag in native_functions.yaml.

Why dont we just fix these when they happen then instead of allowing people to bypass?

Fundamentally Im unsure of the value of a verifier if the recommended course of action when it fails is just to bypass. If bypassing it is fine then why not just always bypass? If its not fine in general why is it fine for this specific user who its failing for?

It takes time for us to implement decompositions or adding an operator into core ATen. Bypassing core ATen op check doesn't mean we are bypassing all other checks in the verifier, it's an escape patch for a user to express "I know this op exists in the graph that is not core ATen and there's no portable kernel for it. I'm confident it will be handled downstream".

Summary:
Currently when a non-core ATen operator shows up in the exported graph, `to_edge()` will fail and the only option is to disable IR validity check by setting `_check_ir_validity=False`. However this is unsafe to do, instead we should still run the rest of the checks.

This PR adds support to allow users to bypass core ATen ops check, by passing a list of non-core ATen ops into `to_edge()`.

Note that:

* This is different than `ops_set_to_not_decompose` in `to_edge_transform_and_lower`, as the ops in `_core_aten_ops_exception_list` are not intended to be kept but more likely showing up because of missing decompositions or missing core ATen tag in `native_functions.yaml`. For this reason, we are combining two lists (`ops_set_to_not_decompose` and `_core_aten_ops_exception_list`) and pass to verifier.
* I updated the error log to encourage people to use `_core_aten_ops_exception_list` instead of using `_check_ir_validity=False`.


Test Plan: Added unit test

Reviewed By: tarun292

Differential Revision: D62469015

Pulled By: larryliu0820
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

@larryliu0820 merged this pull request in 7942d2c.

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 Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants