[mlir][linalg] enable library call rewrites for linalg operations with index semantics.
authorTobias Gysi <gysit@google.com>
Mon, 19 Apr 2021 12:23:11 +0000 (12:23 +0000)
committerTobias Gysi <gysit@google.com>
Mon, 19 Apr 2021 12:50:59 +0000 (12:50 +0000)
The patch enables the library call lowering for linalg operations that contain index operations.

Differential Revision: https://reviews.llvm.org/D100537

mlir/include/mlir/Conversion/LinalgToStandard/LinalgToStandard.h
mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp

index eeb20c4..d317253 100644 (file)
@@ -29,7 +29,7 @@ namespace linalg {
 // function. The implementation of the function can be either in the same module
 // or in an externally linked library.
 // This is a generic entry point for all LinalgOp, except for CopyOp and
-// IndexedGenericOp, for which omre specialized patterns are provided.
+// IndexedGenericOp, for which more specialized patterns are provided.
 class LinalgOpToLibraryCallRewrite
     : public OpInterfaceRewritePattern<LinalgOp> {
 public:
index d385b46..dd4fafb 100644 (file)
@@ -106,14 +106,12 @@ LogicalResult mlir::linalg::LinalgOpToLibraryCallRewrite::matchAndRewrite(
   if (isa<CopyOp>(op) || isa<IndexedGenericOp>(op))
     return failure();
 
-  // TODO: remove once index ops are supported.
-  if (op.hasIndexSemantics())
-    return failure();
-
   auto libraryCallName = getLibraryCallSymbolRef(op, rewriter);
   if (!libraryCallName)
     return failure();
 
+  // TODO: Add support for more complex library call signatures that include
+  // indices or captured values.
   rewriter.replaceOpWithNewOp<mlir::CallOp>(
       op, libraryCallName.getValue(), TypeRange(),
       createTypeCanonicalizedMemRefOperands(rewriter, op->getLoc(),