Add CSEPass to the default edge compilation pipeline (#19849)#19849
Add CSEPass to the default edge compilation pipeline (#19849)#19849billmguo wants to merge 1 commit into
CSEPass to the default edge compilation pipeline (#19849)#19849Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19849
Note: Links to docs will display an error until the docs builds have been completed. ❌ 3 New Failures, 4 Unrelated FailuresAs of commit cc4c35e with merge base 84c0484 ( NEW FAILURES - The following jobs have failed:
BROKEN TRUNK - The following jobs failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
|
@billmguo has exported this pull request. If you are a Meta employee, you can view the originating Diff in D106584552. |
This PR needs a
|
d32fd3c to
721be34
Compare
721be34 to
be45ec5
Compare
Summary: `CSEPass` (Common Subexpression Elimination) was previously only used by specific backends (MLX, Cadence) and export scripts. This change adds it to `base_post_op_replace_passes` in the default `to_edge` / `to_edge_transform_and_lower` pipeline so all backends benefit from CSE automatically. The pass is placed before `dead_code_elimination_pass` so any dead nodes CSE creates get cleaned up, and before `DebugHandleGeneratorPass` so debug handles are assigned to the final deduplicated graph. CSE can merge structurally-identical nodes across different source partitions, which caused `ConvertToLinearPass` in XNNPACK to see extra output nodes in a partition. This is fixed by filtering outputs to only those reachable from the mm/addmm node within the partition. The `test_dim_order_revert_pass` test is updated to expect 2 `_to_copy` ops (instead of 4) after `to_edge`, since CSE deduplicates the two identical branches. Reviewed By: mohankumarkumar Differential Revision: D106584552
CSEPass to the default edge compilation pipelineCSEPass to the default edge compilation pipeline (#19849)
be45ec5 to
cc4c35e
Compare
Summary:
CSEPass(Common Subexpression Elimination) was previously only used by specific backends (MLX, Cadence) and export scripts. This change adds it tobase_post_op_replace_passesin the defaultto_edge/to_edge_transform_and_lowerpipeline so all backends benefit from CSE automatically.The pass is placed before
dead_code_elimination_passso any dead nodes CSE creates get cleaned up, and beforeDebugHandleGeneratorPassso debug handles are assigned to the final deduplicated graph.CSE can merge structurally-identical nodes across different source partitions, which caused
ConvertToLinearPassin XNNPACK to see extra output nodes in a partition. This is fixed by filtering outputs to only those reachable from the mm/addmm node within the partition.The
test_dim_order_revert_passtest is updated to expect 2_to_copyops (instead of 4) afterto_edge, since CSE deduplicates the two identical branches.Reviewed By: mohankumarkumar
Differential Revision: D106584552