Handle squeeze_copy.dims in RemovePermutesAroundElementwiseOps - #21605
Handle squeeze_copy.dims in RemovePermutesAroundElementwiseOps#21605mcremon-meta wants to merge 1 commit into
Conversation
Summary: `_SQUEEZE_OPS` listed only `aten.squeeze_copy.dim`, the singular overload. The plural `aten.squeeze_copy.dims` was therefore not permutable at all, so any candidate region containing one was rejected outright -- `is_node_permutable` returns False and `visit` bails. That overload is common in practice: `Tensor.squeeze(dim)` traces to it, so it shows up wherever a model drops a channel or batch axis between two permuted regions. Adds `_SQUEEZE_DIMS_OPS` alongside the singular form and threads it through the three places the singular one is handled: the permutability check, the permutation adaptation across the rank change, and the arg rewrite in `permute_subgraph` (a list remap, like `update_mean_dim`). Unlike `.dim`, this overload can change rank by more than one and *silently keeps* any listed dim that is not size 1, which would make the rank change data-dependent. `_squeezed_dims` therefore normalises the list and declines -- leaving the region unoptimised -- unless every listed position is a concrete size-1 dim. Duplicates and symbolic shapes are also declined. `_concrete_shape` is added as a small shared helper for reading a node's shape when it may be absent (Arm graphs) or symbolic. This pass is shared, so the Cadence (opt_level=2) and Arm/TOSA subclasses pick this up too; their suites are covered below. Reviewed By: aliafzal Differential Revision: D114508253
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21605
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: ❌ 1 New FailureAs of commit b48d225 with merge base bb6b99a ( NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@mcremon-meta has exported this pull request. If you are a Meta employee, you can view the originating Diff in D114508253. |
This PR needs a
|
Summary:
_SQUEEZE_OPSlisted onlyaten.squeeze_copy.dim, the singular overload. Theplural
aten.squeeze_copy.dimswas therefore not permutable at all, so anycandidate region containing one was rejected outright --
is_node_permutablereturns False and
visitbails.That overload is common in practice:
Tensor.squeeze(dim)traces to it, so itshows up wherever a model drops a channel or batch axis between two permuted
regions.
Adds
_SQUEEZE_DIMS_OPSalongside the singular form and threads it through thethree places the singular one is handled: the permutability check, the
permutation adaptation across the rank change, and the arg rewrite in
permute_subgraph(a list remap, likeupdate_mean_dim).Unlike
.dim, this overload can change rank by more than one and silentlykeeps any listed dim that is not size 1, which would make the rank change
data-dependent.
_squeezed_dimstherefore normalises the list and declines --leaving the region unoptimised -- unless every listed position is a concrete
size-1 dim. Duplicates and symbolic shapes are also declined.
_concrete_shapeis added as a small shared helper for reading a node's shapewhen it may be absent (Arm graphs) or symbolic.
This pass is shared, so the Cadence (opt_level=2) and Arm/TOSA subclasses pick
this up too; their suites are covered below.
Reviewed By: aliafzal
Differential Revision: D114508253