[AIMIGRAPHX-885] Add slice squeeze matcher#5004
Merged
Merged
Conversation
Port the find_slice_squeeze matcher from the MLP_prediction_towers branch. This matcher rewrites slice->squeeze->pointwise/reduce into slice->pointwise/reduce->squeeze (unsqueezing the other inputs), which lets the squeeze propagate downstream and parallel slice branches merge back together. Includes the associated unit tests.
Replace the brittle "not pointwise" check with the shared is_reduce helper from find_op_shape_transform_op so reduce/argmin/argmax detection is precise and consistent with the rest of the pass.
Delegate the reduce/argmin axis remapping in find_slice_squeeze to the shared insert() helper by building a source->common axes map for the unsqueeze. This removes the hand-rolled axis-shifting logic, keeps behavior consistent with find_op_shape_transform_op, and additionally handles layout permutations for free.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #5004 +/- ##
===========================================
+ Coverage 92.69% 92.69% +0.01%
===========================================
Files 596 596
Lines 31603 31631 +28
===========================================
+ Hits 29292 29320 +28
Misses 2311 2311
🚀 New features to boost your workflow:
|
Regressions detected 🔴 * No develop baseline was found for this PR's branch point; compared against the latest available develop run instead. |
|
pfultz2
approved these changes
Jun 23, 2026
pfultz2
requested changes
Jun 23, 2026
pfultz2
approved these changes
Jun 26, 2026
shivadbhavsar
approved these changes
Jun 26, 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.
Motivation
Further split of the changes regarding the MLP tower components
#4723
Handle the slice squeeze matching such that we can
rewrite slice->squeeze->pointwise/reduce into slice->pointwise/reduce->squeeze
This is used in the MLP tower before we perform a horizontal fusion down the pipeline for the pointwise activation op. In that case a SILU, but this can be used for other activations
Technical Details
Changelog Category
Add a
CHANGELOG.mdentry for any option other thanNot Applicable