Repository navigation
Commit 7224da6
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
- transforms
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| |||
0 commit comments