[Mlir-commits] [mlir] [MLIR][Linalg] Improve morphism semantics (PR #222959)

Adam Siemieniuk llvmlistbot at llvm.org
Fri Sep 11 08:04:48 PDT 2026


================
@@ -43,11 +43,51 @@ static LogicalResult generalizeNamedOpPrecondition(LinalgOp linalgOp) {
   return success();
 }
 
-FailureOr<GenericOp> mlir::linalg::generalizeNamedOp(RewriterBase &rewriter,
-                                                     LinalgOp linalgOp) {
+// Converts a named matmul-like op (`matmul`, `batch_matmul`, or
+// `batch_reduce_matmul`) into a `linalg.contract` category op, preserving the
+// operand indexing maps and cast semantics. Returns failure for other ops.
+static FailureOr<LinalgOp> generalizeToContractOp(RewriterBase &rewriter,
+                                                  LinalgOp namedOp) {
+  if (!isa<MatmulOp, BatchMatmulOp, BatchReduceMatmulOp>(
----------------
adam-smnk wrote:

Misses a few named ops, left for a later PR? (just asking)

https://github.com/llvm/llvm-project/pull/222959


More information about the Mlir-commits mailing list