[Mlir-commits] [mlir] [mlir][linalg] Generic to category specialization (PR #184624)

Andrzej WarzyƄski llvmlistbot at llvm.org
Fri Mar 6 01:02:11 PST 2026


================
@@ -406,8 +417,20 @@ static FailureOr<LinalgOp> specializeLinalgConvolutions(RewriterBase &rewriter,
 //===----------------------------------------------------------------------===//
 // Categorize linalg generic to named op where possible.
 //===----------------------------------------------------------------------===//
-FailureOr<LinalgOp> mlir::linalg::specializeGenericOp(RewriterBase &rewriter,
-                                                      GenericOp genericOp) {
+FailureOr<LinalgOp>
+mlir::linalg::specializeGenericOp(RewriterBase &rewriter, GenericOp genericOp,
+                                  const SpecializationOptions &options) {
+  // Contraction - e.g. matmul
+  if (isaContractionOpInterface(genericOp)) {
+    return specializeLinalgContractions(rewriter, genericOp,
+                                        options.emitCategoryOps);
+  }
+
+  // Early exit in case of category specialization.
+  // TODO: Remove when all variants account for both named and category.
----------------
banach-space wrote:

What do you mean by `variants`? Linalg Ops? IIUC, we will never be able to match _any_ `linalg.generic` to `linalg.contract`, no? So this early exit would stay forever.

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


More information about the Mlir-commits mailing list