Arm backend: Generalize fuse_view_copy_transform_pass#18285
Arm backend: Generalize fuse_view_copy_transform_pass#18285AdrianLundell wants to merge 6 commits intopytorch:mainfrom
Conversation
Update the fuse_view_copy_transform_pass to check shapes rather than args to match differet ways of expressing the same shape. This change makes some as_strided ops into noops which they were not previosuly, so an addtional noops check is added to fix this. Additionally moves constants in the pass to class level to simplify overriding behaviour for inheriting passes. Note: test names as_strided_copy -> as_strided since the _copy suffix of operator names are removed in name check. Signed-off-by: Adrian Lundell <adrian.lundell@arm.com> Change-Id: Iba8dc3862c3fc4a8a34e036377ec7bcee84988b1
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18285
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ❌ 2 New Failures, 3 Unrelated FailuresAs of commit 60c1a8b with merge base 656850a ( 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. |
This PR needs a
|
|
@digantdesai Hi, does this look ok to you? |
|
Bumping this @digantdesai @kimishpatel |
|
@digantdesai This patch may also help reducing transposes in some cases since it will remove view ops which are blocking permute fusing sometimes. |
There was a problem hiding this comment.
Pull request overview
This PR updates Arm backend view/copy fusion to treat “equivalent” reshape specifications as the same shape by comparing inferred shapes (from meta["val"]) instead of the raw shape arguments. It also tightens TOSA partition rejection logic so partitions that would lower to empty graphs due to newly-detected no-ops are not delegated.
Changes:
- Refactors
FuseViewCopyTransformto use class-level constants and removes no-opview_copybased on computed output shape. - Adds a partitioner no-op detector for
aten.as_strided_copy(shape/stride/offset identical) to prevent delegating trivial partitions. - Updates as_strided-related Arm tests to reflect the new no-op behavior and renamed test functions.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
backends/transforms/fuse_view_copy.py |
Makes view-copy fusion/removal compare actual inferred shapes (meta["val"].shape) and moves op lists to class attributes for override-friendly behavior. |
backends/arm/tosa/partitioner.py |
Treats “no-op” as_strided_copy as non-compute to avoid delegating partitions that would be optimized away during lowering. |
backends/arm/test/ops/test_as_strided_copy.py |
Adjusts test cases to avoid delegating a true no-op as_strided_copy and renames test functions accordingly. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Update the fuse_view_copy_transform_pass to check shapes rather than args to match different ways of expressing the same shape. This change makes some as_strided ops into noops which they were not previously so an additional noops check is added to fix this.
Additionally moves constants in the pass to class level to simplify overriding behavior for inheriting passes.
Note: test names as_strided_copy -> as_strided since the _copy suffix of operator names are removed in name check.
cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell