[ExecuTorch][Export][1/N] Export API pipeline re-architecture, making it composable#12936
Conversation
… it composable RFC: #12660 This diff introduces composable architecture for the export pipeline. Changes: 1. Introduces notion of `PipelineArtifact` which encompasses stage artifacts and run context necessary to execute a stage and the pipeline. 1. Move all stages to new file to better architect the component 1. Export api will now accept `pipeline_stages` and honors the sequence if provided otherwise fallback to default sequence: `source_transform -> quantize -> torch.export -> to_edge_transform_and_lower -> to_executorch` 1. Validate if pipeline provided is valid, error out if not. 1. Add unittests to test pipeline sequence and stages With this one can execute a partial pipeline, for example, one can just do `TORCH_EXPORT -> TO_EDGE_TRANSFORM_AND_LOWER -> TO_EXECUTORCH` Current limitation: 1. `TORCH_EXPORT` stage is mandatory to avoid someone passing incorrect input such as `ExportedProgram` instead of nn.module, this enforcement will anchor the pipeline to have expected stages to run. - This limitation will be removed if we choose to add the support to take `ExportedProgram` as input. Note: 1. this diff is large because I moved stages to separate file and added bunch of unittests but core functionality that is added can be reviewed in `export.py` file. CC: @digantdesai 2. Export component was supposed to mimic stages design in tester and now it is. Fixes: #12928 Differential Revision: [D79120574](https://our.internmc.facebook.com/intern/diff/D79120574/) [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/12936
Note: Links to docs will display an error until the docs builds have been completed. ⏳ No Failures, 17 PendingAs of commit 3407bd6 with merge base f497f7f ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
This pull request was exported from Phabricator. Differential Revision: D79120574 |
This PR needs a
|
…ure, making it composable" RFC: #12660 This diff introduces composable architecture for the export pipeline. Changes: 1. Introduces notion of `PipelineArtifact` which encompasses stage artifacts and run context necessary to execute a stage and the pipeline. 1. Move all stages to new file to better architect the component 1. Export api will now accept `pipeline_stages` and honors the sequence if provided otherwise fallback to default sequence: `source_transform -> quantize -> torch.export -> to_edge_transform_and_lower -> to_executorch` 1. Validate if pipeline provided is valid, error out if not. 1. Add unittests to test pipeline sequence and stages With this one can execute a partial pipeline, for example, one can just do `TORCH_EXPORT -> TO_EDGE_TRANSFORM_AND_LOWER -> TO_EXECUTORCH` Current limitation: 1. `TORCH_EXPORT` stage is mandatory to avoid someone passing incorrect input such as `ExportedProgram` instead of nn.module, this enforcement will anchor the pipeline to have expected stages to run. - This limitation will be removed if we choose to add the support to take `ExportedProgram` as input. Note: 1. this diff is large because I moved stages to separate file and added bunch of unittests but core functionality that is added can be reviewed in `export.py` file. CC: digantdesai 2. Export component was supposed to mimic stages design in tester and now it is. Fixes: #12928 Differential Revision: [D79120574](https://our.internmc.facebook.com/intern/diff/D79120574/) [ghstack-poisoned]
|
This pull request was exported from Phabricator. Differential Revision: D79120574 |
digantdesai
left a comment
There was a problem hiding this comment.
LGTM. Thanks for refactoring. No functional changes right?
larryliu0820
left a comment
There was a problem hiding this comment.
Reviewed internally
…ure, making it composable" RFC: #12660 This diff introduces composable architecture for the export pipeline. Changes: 1. Introduces notion of `PipelineArtifact` which encompasses stage artifacts and run context necessary to execute a stage and the pipeline. 1. Move all stages to new file to better architect the component 1. Export api will now accept `pipeline_stages` and honors the sequence if provided otherwise fallback to default sequence: `source_transform -> quantize -> torch.export -> to_edge_transform_and_lower -> to_executorch` 1. Validate if pipeline provided is valid, error out if not. 1. Add unittests to test pipeline sequence and stages With this one can execute a partial pipeline, for example, one can just do `TORCH_EXPORT -> TO_EDGE_TRANSFORM_AND_LOWER -> TO_EXECUTORCH` Current limitation: 1. `TORCH_EXPORT` stage is mandatory to avoid someone passing incorrect input such as `ExportedProgram` instead of nn.module, this enforcement will anchor the pipeline to have expected stages to run. - This limitation will be removed if we choose to add the support to take `ExportedProgram` as input. Note: 1. this diff is large because I moved stages to separate file and added bunch of unittests but core functionality that is added can be reviewed in `export.py` file. CC: digantdesai 2. Export component was supposed to mimic stages design in tester and now it is. Fixes: #12928 Differential Revision: [D79120574](https://our.internmc.facebook.com/intern/diff/D79120574/) [ghstack-poisoned]
|
This pull request was exported from Phabricator. Differential Revision: D79120574 |
…ure, making it composable" RFC: #12660 This diff introduces composable architecture for the export pipeline. Changes: 1. Introduces notion of `PipelineArtifact` which encompasses stage artifacts and run context necessary to execute a stage and the pipeline. 1. Move all stages to new file to better architect the component 1. Export api will now accept `pipeline_stages` and honors the sequence if provided otherwise fallback to default sequence: `source_transform -> quantize -> torch.export -> to_edge_transform_and_lower -> to_executorch` 1. Validate if pipeline provided is valid, error out if not. 1. Add unittests to test pipeline sequence and stages With this one can execute a partial pipeline, for example, one can just do `TORCH_EXPORT -> TO_EDGE_TRANSFORM_AND_LOWER -> TO_EXECUTORCH` Current limitation: 1. `TORCH_EXPORT` stage is mandatory to avoid someone passing incorrect input such as `ExportedProgram` instead of nn.module, this enforcement will anchor the pipeline to have expected stages to run. - This limitation will be removed if we choose to add the support to take `ExportedProgram` as input. Note: 1. this diff is large because I moved stages to separate file and added bunch of unittests but core functionality that is added can be reviewed in `export.py` file. CC: digantdesai 2. Export component was supposed to mimic stages design in tester and now it is. Fixes: #12928 Differential Revision: [D79120574](https://our.internmc.facebook.com/intern/diff/D79120574/) [ghstack-poisoned]
|
This pull request was exported from Phabricator. Differential Revision: D79120574 |
d71c083
into
gh/abhinaykukkadapu/1/base
Stack from ghstack (oldest at bottom):
RFC: #12660
This diff introduces composable architecture for the export pipeline.
Changes:
PipelineArtifactwhich encompasses stage artifacts and run context necessary to execute a stage and the pipeline.pipeline_stagesand honors the sequence if provided otherwise fallback to default sequence:source_transform -> quantize -> torch.export -> to_edge_transform_and_lower -> to_executorchWith this one can execute a partial pipeline, for example, one can just do
TORCH_EXPORT -> TO_EDGE_TRANSFORM_AND_LOWER -> TO_EXECUTORCHCurrent limitation:
TORCH_EXPORTstage is mandatory to avoid someone passing incorrect input such asExportedPrograminstead of nn.module, this enforcement will anchor the pipeline to have expected stages to run.ExportedProgramas input.Note:
export.pyfile. CC: @digantdesaiFixes: #12928
Differential Revision: D79120574