[Mlir-commits] [mlir] 68ae8ba - [mlir][Linalg] Properly specify Linalg attribute.

Nicolas Vasilache llvmlistbot at llvm.org
Tue Jul 13 09:33:47 PDT 2021


Author: Nicolas Vasilache
Date: 2021-07-13T16:33:33Z
New Revision: 68ae8bacfce3b9bd73fefb0d28efd461e1588586

URL: https://github.com/llvm/llvm-project/commit/68ae8bacfce3b9bd73fefb0d28efd461e1588586
DIFF: https://github.com/llvm/llvm-project/commit/68ae8bacfce3b9bd73fefb0d28efd461e1588586.diff

LOG: [mlir][Linalg] Properly specify Linalg attribute.

This fixes undefined reference introduced by https://reviews.llvm.org/D105859

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

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Linalg/IR/LinalgBase.td
    mlir/lib/Dialect/Linalg/IR/LinalgTypes.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgBase.td b/mlir/include/mlir/Dialect/Linalg/IR/LinalgBase.td
index ce36323dbb28..50028929291a 100644
--- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgBase.td
+++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgBase.td
@@ -49,7 +49,7 @@ def Linalg_Dialect : Dialect {
       kInplaceableAttrName = "linalg.inplaceable";
 
     /// Attribute name used to mark the bufferization layout for region
-    // arguments during linalg comprehensive bufferization.
+    /// arguments during linalg comprehensive bufferization.
     constexpr const static ::llvm::StringLiteral
       kBufferLayoutAttrName = "linalg.buffer_layout";
 

diff  --git a/mlir/lib/Dialect/Linalg/IR/LinalgTypes.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgTypes.cpp
index 047e1e9a62be..0cc170ebeb82 100644
--- a/mlir/lib/Dialect/Linalg/IR/LinalgTypes.cpp
+++ b/mlir/lib/Dialect/Linalg/IR/LinalgTypes.cpp
@@ -62,6 +62,10 @@ struct LinalgInlinerInterface : public DialectInlinerInterface {
 constexpr const ::llvm::StringLiteral
     LinalgDialect::kMemoizedIndexingMapsAttrName;
 
+/// Attribute name used to mark the bufferization layout for region
+/// arguments during linalg comprehensive bufferization.
+constexpr const ::llvm::StringLiteral LinalgDialect::kBufferLayoutAttrName;
+
 /// Attribute name used to mark region arguments that can be bufferized
 /// in-place during linalg comprehensive bufferization.
 constexpr const ::llvm::StringLiteral LinalgDialect::kInplaceableAttrName;
@@ -153,6 +157,16 @@ LogicalResult LinalgDialect::verifyOperationAttribute(Operation *op,
                              << " to be used on function-like operations";
     return success();
   }
+  if (attr.first == LinalgDialect::kBufferLayoutAttrName) {
+    if (!attr.second.isa<AffineMapAttr>()) {
+      return op->emitError() << "'" << LinalgDialect::kBufferLayoutAttrName
+                             << "' is expected to be a affine map attribute";
+    }
+    if (!op->hasTrait<OpTrait::FunctionLike>())
+      return op->emitError() << "expected " << attr.first
+                             << " to be used on function-like operations";
+    return success();
+  }
   if (attr.first == LinalgDialect::kMemoizedIndexingMapsAttrName)
     return success();
   return op->emitError() << "attribute '" << attr.first


        


More information about the Mlir-commits mailing list