Commit bb8197e
Handle rank-changing views in RemovePermutesAroundElementwiseOps
Summary:
Extend RemovePermutesAroundElementwiseOps to cancel permute pairs across rank-changing squeeze/unsqueeze view boundaries. When a permute's sole user is a view_copy that adds or removes a single size-1 dimension, the pass adapts the expected permutation to the new rank and continues traversal. This enables removing permutes that sit on opposite sides of an unsqueeze→elementwise→squeeze chain (e.g. the NHWC↔NTC layout conversion around convolutions in the cascade detector model).
Key changes:
- Accept extra_permutable_ops constructor parameter for backend-specific ops
- Track per-node expected permutations across view boundaries
- Run dimension updates before edges_in bypass to preserve original metadata
- Handle view_copy, unsqueeze_copy, squeeze_copy rank changes
- Treat aten.full.default as a compile-time constant
Note: The PostponePermuteOpBelowSqueezeOrUnsqueezeLikeView pass is removed from the Arm pass manager, since it doesn't actually help anymore.
Differential Revision: D1047752441 parent b04cc65 commit bb8197e
6 files changed
Lines changed: 442 additions & 100 deletions
File tree
- backends
- arm/_passes
- cadence/aot
- transforms
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | 164 | | |
169 | 165 | | |
170 | 166 | | |
| |||
538 | 534 | | |
539 | 535 | | |
540 | 536 | | |
541 | | - | |
542 | 537 | | |
543 | 538 | | |
544 | 539 | | |
| |||
Lines changed: 9 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
603 | 603 | | |
604 | 604 | | |
605 | 605 | | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | | - | |
610 | | - | |
611 | | - | |
612 | | - | |
613 | | - | |
614 | | - | |
615 | | - | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
616 | 616 | | |
617 | 617 | | |
618 | 618 | | |
| |||
0 commit comments