[mlir][Linalg] Properly specify Linalg attribute.

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

Differential Revision: https://reviews.llvm.org/D105897
This commit is contained in:
Nicolas Vasilache 2021-07-13 15:32:40 +00:00
parent 3d89fb4d13
commit 68ae8bacfc
2 changed files with 15 additions and 1 deletions

View File

@ -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";

View File

@ -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