[Mlir-commits] [mlir] [mlir][linalg] Implement patterns for reducing rank of named linalg contraction ops (PR #95710)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Jun 20 08:10:49 PDT 2024
================
@@ -1692,6 +1692,13 @@ void populateTransposeMatmulPatterns(RewritePatternSet &patterns,
void populateBlockPackMatmulPatterns(RewritePatternSet &patterns,
const ControlBlockPackMatmulFn &controlFn);
+/// Adds patterns that that reduce the rank of named contraction ops that have
+/// unit dimensions in the operand(s) by converting to a senquence of `collapse_shape`,
+/// `<corresponding linalg named op>`, `expand_shape` (if on tensors). For example a
+/// `linalg.batch_matmul` with unit batch size will convert to `linalg.matmul`
+/// and a `linalg.matvec` with with unit spatial dim in lhs will convert to a `linalg.dot`.
+void populateContractionOpRankReducingPatterns(RewritePatternSet &patterns);
----------------
srcarroll wrote:
yah i was considering doing that. i was thinking of making it simple for now and just having a rank parameter that controls how low the rank is reduced to. so if you want to only go down to matmul, rank would be 2. if you want to go down to matvec then rank 1 and dot rank 0. would that work?
https://github.com/llvm/llvm-project/pull/95710
More information about the Mlir-commits
mailing list