Skip to content

support canonicalizing linalg.generics that transpose#3013

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_923530441
Open

support canonicalizing linalg.generics that transpose#3013
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_923530441

Conversation

@copybara-service
Copy link
Copy Markdown
Contributor

support canonicalizing linalg.generics that transpose

This is a follow on from #3004. In #3004, a pattern was added to support canonicalizing linalg.generics in which one or more dimensions were dropped from an arg, creating an implicit broadcast. We noticed that transpositions were also possible, and then I found an upstream canonicalization pattern that supports extracting such transpositions into an explicit transpose op.

Nb., this is not something I actually saw in any torch-mlir outputs, but having it should increase the robustness of our linalg-canonicalizations from all frontends, and it's rather simple to include.

This is a follow on from #3004. In #3004, a pattern was added to support canonicalizing linalg.generics in which one or more dimensions were dropped from an arg, creating an implicit broadcast. We noticed that transpositions were also possible, and then I found an upstream canonicalization pattern that supports extracting such transpositions into an explicit transpose op.

Nb., this is not something I actually saw in any torch-mlir outputs, but having it should increase the robustness of our linalg-canonicalizations from all frontends, and it's rather simple to include.

PiperOrigin-RevId: 923530441
@j2kun j2kun requested a review from mdgrs May 29, 2026 22:24
@j2kun
Copy link
Copy Markdown
Collaborator

j2kun commented May 29, 2026

Note due to copybara this squashed the commit it's rebased over into one. The new part is simply the line:

 mlir::linalg::populateDecomposeProjectedPermutationPatterns(patterns);

And the new test tests/Transforms/linalg_canonicalizations/transpose_non_unit.mlir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant