[AIMIGRAPHX-885] Add slice squeeze matcher clean#5004
Draft
TedThemistokleous wants to merge 3 commits into
Draft
[AIMIGRAPHX-885] Add slice squeeze matcher clean#5004TedThemistokleous wants to merge 3 commits into
TedThemistokleous wants to merge 3 commits into
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.
Comment on lines
+1832
to
+1834
| auto squeeze_slice = match::name("squeeze")( | ||
| match::arg(0)(match::name("slice").bind("slice"))) | ||
| .bind("squeeze"); |
Contributor
There was a problem hiding this comment.
[format.py] reported by reviewdog 🐶
Suggested change
| auto squeeze_slice = match::name("squeeze")( | |
| match::arg(0)(match::name("slice").bind("slice"))) | |
| .bind("squeeze"); | |
| auto squeeze_slice = | |
| match::name("squeeze")(match::arg(0)(match::name("slice").bind("slice"))) | |
| .bind("squeeze"); |
Comment on lines
+1857
to
+1858
| input = m.insert_instruction( | ||
| op_ins, make_op("unsqueeze", {{"axes", {axis}}}), input); |
Contributor
There was a problem hiding this comment.
[format.py] reported by reviewdog 🐶
Suggested change
| input = m.insert_instruction( | |
| op_ins, make_op("unsqueeze", {{"axes", {axis}}}), input); | |
| input = | |
| m.insert_instruction(op_ins, make_op("unsqueeze", {{"axes", {axis}}}), input); |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #5004 +/- ##
===========================================
- Coverage 92.73% 92.71% -0.02%
===========================================
Files 592 594 +2
Lines 31289 31493 +204
===========================================
+ Hits 29015 29198 +183
- Misses 2274 2295 +21
🚀 New features to boost your workflow:
|
Regressions detected 🔴 |
|
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
Technical Details
Changelog Category
Add a
CHANGELOG.mdentry for any option other thanNot Applicable