Skip to content

Commit 7224da6

Browse files
authored
Transforms: share the permute/view propagation driver (pytorch#22123)
Move the propagation algorithm itself to backends/transforms, leaving the TOSA configuration behind in the Arm backend. The Arm file is now 107 lines: the overrides mixin, and two subclasses that combine it with ArmPass and the shared Up and Down passes. The split is possible because the extension points landed first. The algorithm asks whether a node is transparent, whether an elementwise op carries extra non-layout inputs, whether a user blocks crossing, whether to propagate at all, which region-cancellation engine to fuse with, and which duplicate users must not be collapsed. Arm answers all six; the shared defaults are neutral, so a backend that answers none still gets a working mover. Class names are unchanged on the Arm side, so arm_pass_manager and the existing tests are untouched. Method resolution puts the TOSA overrides ahead of the shared implementation and ArmPass last, which is what the previous single-file arrangement did implicitly. Cortex-M can now use this instead of growing its own fixed-point loop, which is the point of the exercise: on the shared 36-case matrix this driver reaches 82 permutes where that loop stalls at 156. pass being moved: an INT48 operand whose packed storage a permute would address wrongly, and a TABLE whose operand shape Ethos-U85 miscompiles. Both are TOSA facts, so they answer extension points rather than living in the driver -- blocks_moving for the first, tolerates_shape_after_move for the second, with _shape_seen_by_next_node supplying what the crossed node ends up reading, which only the direction knows. That change also deleted the blanket Ethos-U85 opt-out it replaced, so should_propagate loses its only caller and goes with it rather than becoming a hook in the new shared file that nothing answers. No behaviour change: the Arm pass suite produces a failure set identical to merge base, name for name. Authored with Claude Code.
1 parent c5f2f17 commit 7224da6

4 files changed

Lines changed: 1001 additions & 937 deletions

File tree

‎backends/arm/_passes/BUCK‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ fbcode_target(
6363
"//executorch/backends/transforms:canonicalize_view_copy_permute_pass",
6464
"//executorch/backends/transforms:permute_view_meta",
6565
"//executorch/backends/transforms:fuse_duplicate_users_pass",
66+
"//executorch/backends/transforms:propagate_view_copy_permute_pass",
6667
"//executorch/backends/transforms:fuse_identical_input_transforms_pass",
6768
"//executorch/backends/transforms:convert_conv1d_to_conv2d_pass",
6869
"//executorch/backends/transforms:fuse_view_copy",

0 commit comments

Comments
 (0)