Skip to content

Conversation

abhinaykukkadapu
Copy link
Contributor

@abhinaykukkadapu abhinaykukkadapu commented Jul 28, 2025

Stack from ghstack (oldest at bottom):

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.
  2. Move all stages to new file to better architect the component
  3. 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
  4. Validate if pipeline provided is valid, error out if not.
  5. 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

… 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]
Copy link

pytorch-bot bot commented Jul 28, 2025

🔗 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 Pending

As of commit 3407bd6 with merge base f497f7f (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 Jul 28, 2025
@facebook-github-bot
Copy link
Contributor

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

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.

…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]
@facebook-github-bot
Copy link
Contributor

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

Copy link
Contributor

@digantdesai digantdesai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for refactoring. No functional changes right?

Copy link
Contributor

@larryliu0820 larryliu0820 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]
@facebook-github-bot
Copy link
Contributor

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]
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot facebook-github-bot merged commit d71c083 into gh/abhinaykukkadapu/1/base Aug 1, 2025
102 of 104 checks passed
@facebook-github-bot facebook-github-bot deleted the gh/abhinaykukkadapu/1/head branch August 1, 2025 05:31
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.

4 participants