-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[mlir][linalg] Implement patterns for reducing rank of named linalg contraction ops #95710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
mlir/test/lib/Dialect/Linalg/TestLinalgRankReduceContractionOps.cpp
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bunch of nits, LGTM otherwise.
…ontraction ops (llvm#95710) This patch introduces pattern rewrites for reducing the rank of named linalg contraction ops with unit spatial dim(s) to other named contraction ops. For example `linalg.batch_matmul` with batch size 1 -> `linalg.matmul` and `linalg.matmul` with unit LHS spatial dim -> `linalg.vecmat`, etc. These patterns don't support reducing the rank along reduction dimension as those don't convert to other named contraction ops.
This is a neat feature! Any objection into making it a standalone pass? |
Thanks. No objection at all. If I remember correctly the pattern rewrites are public so they should be able to be reused by any pass. In fact someone requested a feature to have options to choose what ops are targeted for reduction (or choose how low to take the rank). I was going to but haven't had time so if you want to address that too that would be great. |
correction. only the populate patterns function is public. so we can either make the pattern rewrite public to make it easier to build passes with individual patterns, or just add the options to the populate function. i dont think i have a particular preference |
This patch introduces pattern rewrites for reducing the rank of named linalg contraction ops with unit spatial dim(s) to other named contraction ops. For example
linalg.batch_matmul
with batch size 1 ->linalg.matmul
andlinalg.matmul
with unit LHS spatial dim ->linalg.vecmat
, etc. These patterns don't support reducing the rank along reduction dimension as those don't convert to other named contraction ops.