From 68ae8bacfce3b9bd73fefb0d28efd461e1588586 Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Tue, 13 Jul 2021 15:32:40 +0000 Subject: [PATCH] [mlir][Linalg] Properly specify Linalg attribute. This fixes undefined reference introduced by https://reviews.llvm.org/D105859 Differential Revision: https://reviews.llvm.org/D105897 --- mlir/include/mlir/Dialect/Linalg/IR/LinalgBase.td | 2 +- mlir/lib/Dialect/Linalg/IR/LinalgTypes.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgBase.td b/mlir/include/mlir/Dialect/Linalg/IR/LinalgBase.td index ce36323..5002892 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 047e1e9..0cc170e 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()) { + return op->emitError() << "'" << LinalgDialect::kBufferLayoutAttrName + << "' is expected to be a affine map attribute"; + } + if (!op->hasTrait()) + 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 -- 2.7.4