-
Notifications
You must be signed in to change notification settings - Fork 537
[ExecuTorch][to_backend] Enable to_backend API to leverage preprocess_all #9811
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
Conversation
…_all We add a new to_backend api which essentially takes in: ``` Method --> ExportedProgram Method --> Partitioner ``` This new to_backend api will then return ``` Method --> ExportedProgram ``` in which the ExportedPrograms are lowered using the partitioner. The key difference from the other to_backend implementation is that this implementation leverages `preprocess_all`. The existing implementation goes in the following steps: 1. Partition the ExportedProgram and return a tagged module, each tag represents a partition, and nodes belonging to a partition have the tag in its metadata 2. loop through every tag(partition) 2.1. create a submodule and call submodule node for the partition 2.2. create an exported program from the submodule 2.3. lower this exported program to the specified backend_id and generate a loweredbackendmodule 2.4. replace the call submodule node with call delegate node and the generated loweredbackend module 2.5 adjust the original owning program. 3. Return the newly adjusted owning program The new implementation reorders the steps so that preprocess_all can be given all the partitioned programs at once: 1. loop through every method with a specified partitioner 2. Partition the method's corresponding ExportedProgram with the specified partitioner and return a tagged module, each tag represents a partition, and nodes belonging to a partition have the tag in its metadata 3. loop through every tag(partition) 4. create a submodule and call submodule node for the partition 5. create an exported program from the submodule 6. store a bunch of meta data like owning_graph, is_submodule, delegation_spec, exported_program in the call_submodule's metadata 7. return the list of all submodule nodes created for each partition 8. Add mapping of method to the list of partitioned submodule nodes 9. Sort the above mapping by backend type (backend_id) 10. loop through backend types: 11. lower all the submodule nodes of this backend type at once with preprocess_all 12. loop through lowered call submodule nodes and replace them with results from preprocess_all 11. Return mapping of method to lowered programs The new to_backend api is not used any where, the intent is for it to eventually be used in the EdgeProgramManager's to_backend implementation which already has and uses method_to_partitioner and method_to_program mappings. Differential Revision: [D69954542](https://our.internmc.facebook.com/intern/diff/D69954542/) [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/9811
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 75 PendingAs of commit b5e9996 with merge base d023a77 ( NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
…_all We add a new to_backend api which essentially takes in: ``` Method --> ExportedProgram Method --> Partitioner ``` This new to_backend api will then return ``` Method --> ExportedProgram ``` in which the ExportedPrograms are lowered using the partitioner. The key difference from the other to_backend implementation is that this implementation leverages `preprocess_all`. The existing implementation goes in the following steps: 1. Partition the ExportedProgram and return a tagged module, each tag represents a partition, and nodes belonging to a partition have the tag in its metadata 2. loop through every tag(partition) 2.1. create a submodule and call submodule node for the partition 2.2. create an exported program from the submodule 2.3. lower this exported program to the specified backend_id and generate a loweredbackendmodule 2.4. replace the call submodule node with call delegate node and the generated loweredbackend module 2.5 adjust the original owning program. 3. Return the newly adjusted owning program The new implementation reorders the steps so that preprocess_all can be given all the partitioned programs at once: 1. loop through every method with a specified partitioner 2. Partition the method's corresponding ExportedProgram with the specified partitioner and return a tagged module, each tag represents a partition, and nodes belonging to a partition have the tag in its metadata 3. loop through every tag(partition) 4. create a submodule and call submodule node for the partition 5. create an exported program from the submodule 6. store a bunch of meta data like owning_graph, is_submodule, delegation_spec, exported_program in the call_submodule's metadata 7. return the list of all submodule nodes created for each partition 8. Add mapping of method to the list of partitioned submodule nodes 9. Sort the above mapping by backend type (backend_id) 10. loop through backend types: 11. lower all the submodule nodes of this backend type at once with preprocess_all 12. loop through lowered call submodule nodes and replace them with results from preprocess_all 11. Return mapping of method to lowered programs The new to_backend api is not used any where, the intent is for it to eventually be used in the EdgeProgramManager's to_backend implementation which already has and uses method_to_partitioner and method_to_program mappings. Differential Revision: [D69954542](https://our.internmc.facebook.com/intern/diff/D69954542/) ghstack-source-id: 267527354 Pull Request resolved: #9811
This pull request was exported from Phabricator. Differential Revision: D69954542 |
This PR needs a
|
Abandoning |
Stack from ghstack (oldest at bottom):
We add a new to_backend api which essentially takes in:
This new to_backend api will then return
in which the ExportedPrograms are lowered using the partitioner. The key difference from the other to_backend implementation is that this implementation leverages
preprocess_all
.The existing implementation goes in the following steps:
2.1. create a submodule and call submodule node for the partition
2.2. create an exported program from the submodule
2.3. lower this exported program to the specified backend_id and generate a loweredbackendmodule
2.4. replace the call submodule node with call delegate node and the generated loweredbackend module
2.5 adjust the original owning program.
The new implementation reorders the steps so that preprocess_all can be given all the partitioned programs at once:
2. Partition the method's corresponding ExportedProgram with the specified partitioner and return a tagged module, each tag represents a partition, and nodes belonging to a partition have the tag in its metadata
3. loop through every tag(partition)
4. create a submodule and call submodule node for the partition
5. create an exported program from the submodule
6. store a bunch of meta data like owning_graph, is_submodule, delegation_spec, exported_program in the call_submodule's metadata
7. return the list of all submodule nodes created for each partition
8. Add mapping of method to the list of partitioned submodule nodes
11. lower all the submodule nodes of this backend type at once with preprocess_all
12. loop through lowered call submodule nodes and replace them with results from preprocess_all
The new to_backend api is not used any where, the intent is for it to eventually be used in the EdgeProgramManager's to_backend implementation which already has and uses method_to_partitioner and method_to_program mappings.
Differential Revision: D69954542