Transforms: stop fork splitting from stranding a permute - #22124
Open
rascani wants to merge 2 commits into
Open
Conversation
Contributor
Author
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/22124
Note: Links to docs will display an error until the docs builds have been completed. ❌ 8 New Failures, 1 Unrelated FailureAs of commit be06ff4 with merge base e831b3e ( NEW FAILURES - The following jobs have failed:
FLAKY - The following job failed but was likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This was referenced Aug 25, 2026
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.
Splitting a permute over a fork is meant to be free: each branch takes its own
copy on the way down, and the copies merge again on the way up. That holds when
every branch behaves the same way -- branches that rejoin have their copies
fused at the meeting node, branches that stay separate have theirs hoisted back
to the shared producer.
It does not hold for a fork where some branches rejoin and others do not. The
rejoining side ends with a copy below the meeting node, the diverging side with
one at the source, and neither mechanism can bring those together: upward
propagation has no fork split of its own, so it cannot hoist a copy above a
rejoin. Five ops are enough to see it, with no views and no quantization:
Decline the split in exactly that shape. Uniform forks are unaffected, which is
what keeps the existing behaviour: all-rejoin still splits and fuses at the
meeting node, all-diverge still splits and merges at the producer. A sweep of 75
fan-out shapes now regresses none, and the wins on real graphs are unchanged --
MultiheadAttention 10 to 9, TransformerEncoderLayer 14 to 11.
Also stop is_swappable raising on a non-keepdim reduction. The shared pass
answers the question it was asked and declines; Arm overrides it to keep raising,
since its pipeline normalizes reductions earlier and a violation there means the
ordering is wrong rather than that the graph is unusual.
No behaviour change for Arm: the pass suite produces a failure set identical to
merge base, name for name.
Authored with Claude Code.