Arm backend: Improve permute/view fusing#21055
Merged
Merged
Conversation
Adds transpose counting to pixel-shuffle tests including a mixed precision case with decomposed Q/DQ nodes which the previous permute propagation did not handle. This is fixed by adding support for propagating views and permutes over across forks in the graph, as long as it can be proven that the branches will eventually converge. Also adds support for where to fuse_identiacal_input_transforms Signed-off-by: Adrian Lundell <adrian.lundell@arm.com> Change-Id: If66ff26d8020cdeab9ea88bc87a687a63a57dda0
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21055
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: ✅ You can merge normally! (1 Unrelated Failure)As of commit b69a130 with merge base 266e0dc ( BROKEN TRUNK - The following job 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. |
rascani
approved these changes
Jul 21, 2026
| lambda arg: arg.meta["val"] if isinstance(arg, torch.fx.Node) else arg, | ||
| ) | ||
| node.meta["val"] = cast(Any, node.target)(*args, **kwargs) | ||
| except Exception: |
Contributor
There was a problem hiding this comment.
Is there any way to narrow this to expected Exception classes?
Collaborator
Author
There was a problem hiding this comment.
Good question, let's see what happens if I remove it completely. When I think about it it seems that the only thing this would do is to hide real errors, I am not sure that there are any cases where it is valid to simply pass
Signed-off-by: Adrian Lundell <adrian.lundell@arm.com> Change-Id: I1986dc95047d87a0f325c7ebbb86db50c7deef72
Change-Id: Id0595962b9d49c2c5828379769a7631895101910 Signed-off-by: Adrian Lundell <adrian.lundell@arm.com>
While the simple meta-data update was faster, it is difficult to ensure a fully safe update this way since there is no clear contract on what is expected from the Node. This means the only way to use such a method would be a) Skip errors and hope nothing breaks from it b) Handle errors case-by-case when finding them by trial and error This is also error-prone and not future-proof. Instead use the slower full retrace. Signed-off-by: Adrian Lundell <adrian.lundell@arm.com> Change-Id: I0c55457122dae4a60f7db86cd5e997b5cf983a17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes view/permutes always split to all branches of a node with multiple outputs for downward propagation. Note that this will never increase the number of permutes/views in the graph, since any non-fused permutes/views will propagate back and be fused together again by the upward propagation pass.
Adds support for where operator to fuse_identical_input_transforms
Replaces _would_strand_layout_op_on_wider_elements with MoveDataMovementOpsToSmallerDtypePass to allow ops to
propagate more freely during the fusing phase
Adds tosa ops to MatchArgsPass since it is run after some ops have been rewritten to TOSA.
Generalizes refresh_permute_view_meta into refresh_node_meta which works for any operators and uses that.
cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani