[ExecuTorch][to_backend] Enable to_backend API to leverage preprocess_multimethod#9824
Merged
mcr229 merged 12 commits intogh/mcr229/21/headfrom Apr 16, 2025
Merged
[ExecuTorch][to_backend] Enable to_backend API to leverage preprocess_multimethod#9824mcr229 merged 12 commits intogh/mcr229/21/headfrom
mcr229 merged 12 commits intogh/mcr229/21/headfrom
Conversation
Contributor
Author
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/9824
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit f23ecf3 with merge base ae2d822 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This was referenced Apr 1, 2025
cccclai
reviewed
Apr 7, 2025
cccclai
reviewed
Apr 7, 2025
cccclai
reviewed
Apr 7, 2025
mcr229
commented
Apr 8, 2025
cccclai
reviewed
Apr 8, 2025
Contributor
Author
for the failing test, let me rebase and resubmit |
cccclai
approved these changes
Apr 13, 2025
Contributor
cccclai
left a comment
There was a problem hiding this comment.
Looks good. Thank you for being patient and all the effort!
mcr229
added a commit
that referenced
this pull request
Apr 16, 2025
### summary We introduce a new preprocess_multimethod. This takes the place of preprocess all in the following discussion: #8230 This is a class method so that we can allow the default implementation to leverage the static preprocess method. The default implementation just applies preprocess on all the exported programs given. ### Testing Testing done in follow up PR #9824
keyprocedure
pushed a commit
to keyprocedure/executorch
that referenced
this pull request
Apr 21, 2025
### summary We introduce a new preprocess_multimethod. This takes the place of preprocess all in the following discussion: pytorch#8230 This is a class method so that we can allow the default implementation to leverage the static preprocess method. The default implementation just applies preprocess on all the exported programs given. ### Testing Testing done in follow up PR pytorch#9824
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
We add a new to_backend api which for multi method models. Specifically, we pass in a dictionary mapping MethodName to ExportedProgram, as well as a dictionary mapping MethodName to Partitioner. We then return a dictionary mapping MethodName to the partitioned and lowered exported program.
In addition, we also provide a new preprocess API for backends to implement. This API is preprocess_multimethod. The signature of the new method is as follows:
This new API enableds backends to preprocess all partitions/methods at once. This way, while processing blobs, they can identify shared components between preprocessed blobs. Shared components can be serialized within the NamedDataStore.
The key change in backend infra, is that when partitioning, we now have to identify all the partitioned graphs to be lowered at once, and pass them to preprocess_multimethod at once. Previously, as we found lowerable partitions, we preprocessed and embedded them into the graph.
Testing
python -m unittest exir.backend.test.test_to_backend_multi_method