[Mlir-commits] [mlir] [mlir][WIP] `DenseElementsAttr` generalized (PR #179122)
Matthias Springer
llvmlistbot at llvm.org
Wed Feb 4 07:47:49 PST 2026
https://github.com/matthias-springer updated https://github.com/llvm/llvm-project/pull/179122
>From a347b32de9a23cc3a36b67fecdd898e7336a55c6 Mon Sep 17 00:00:00 2001
From: Matthias Springer <me at m-sp.org>
Date: Sun, 1 Feb 2026 17:41:37 +0000
Subject: [PATCH] [mlir][WIP] `DenseElementsAttr` generalized
---
mlir/include/mlir/IR/BuiltinTypeInterfaces.td | 58 +++++++
mlir/lib/AsmParser/AttributeParser.cpp | 146 +++++++++++++++++-
mlir/lib/AsmParser/Parser.h | 6 +
mlir/lib/IR/AsmPrinter.cpp | 72 +++++++--
mlir/lib/IR/AttributeDetail.h | 4 +
mlir/lib/IR/BuiltinTypes.cpp | 1 +
.../IR/dense-elements-type-interface.mlir | 28 ++++
mlir/test/lib/Dialect/Test/TestTypeDefs.td | 14 ++
mlir/test/lib/Dialect/Test/TestTypes.cpp | 28 ++++
mlir/test/lib/Dialect/Test/TestTypes.h | 1 +
10 files changed, 339 insertions(+), 19 deletions(-)
create mode 100644 mlir/test/IR/dense-elements-type-interface.mlir
diff --git a/mlir/include/mlir/IR/BuiltinTypeInterfaces.td b/mlir/include/mlir/IR/BuiltinTypeInterfaces.td
index 9ef08b7020b99..4277f64ee021f 100644
--- a/mlir/include/mlir/IR/BuiltinTypeInterfaces.td
+++ b/mlir/include/mlir/IR/BuiltinTypeInterfaces.td
@@ -338,4 +338,62 @@ def ShapedTypeInterface : TypeInterface<"ShapedType"> {
}];
}
+//===----------------------------------------------------------------------===//
+// DenseElementTypeInterface
+//===----------------------------------------------------------------------===//
+
+def DenseElementTypeInterface : TypeInterface<"DenseElementType"> {
+ let cppNamespace = "::mlir";
+ let description = [{
+ This interface allows custom types to be used as element types in
+ DenseElementsAttr. Types implementing this interface define:
+ 1. The byte size for element storage
+ 2. How to convert between raw bytes and the corresponding Attribute
+
+ For example, a custom `!my_dialect.fixed_point` type might map to a
+ `my_dialect.fixed_point_attr` attribute. The interface methods handle
+ conversion between the attribute and raw storage bytes.
+
+ When this interface is implemented by an element type, DenseElementsAttr
+ uses the new type-first syntax:
+ `dense<tensor<2x!my.type> : [#my.val<1>, #my.val<2>]>`
+ instead of the traditional literal-first syntax:
+ `dense<[1, 2, 3]> : tensor<3xi32>`
+ }];
+
+ let methods = [
+ InterfaceMethod<
+ /*desc=*/[{
+ Return the number of bits required to store one element in dense
+ storage. This must be a compile-time constant for the type and must
+ be a multiple of 8 (byte-aligned).
+ }],
+ /*retTy=*/"size_t",
+ /*methodName=*/"getDenseElementBitSize",
+ /*args=*/(ins)
+ >,
+ InterfaceMethod<
+ /*desc=*/[{
+ Convert raw storage bytes to an attribute representing this element
+ value. The `rawData` array contains exactly `getDenseElementBitSize()/8`
+ bytes.
+ }],
+ /*retTy=*/"::mlir::Attribute",
+ /*methodName=*/"convertToAttribute",
+ /*args=*/(ins "::llvm::ArrayRef<char>":$rawData)
+ >,
+ InterfaceMethod<
+ /*desc=*/[{
+ Convert an attribute to raw storage bytes. Appends exactly
+ `getDenseElementBitSize()/8` bytes to `result`. Returns failure if the
+ attribute is incompatible with this element type.
+ }],
+ /*retTy=*/"::llvm::LogicalResult",
+ /*methodName=*/"convertFromAttribute",
+ /*args=*/(ins "::mlir::Attribute":$attr,
+ "::llvm::SmallVectorImpl<char>&":$result)
+ >,
+ ];
+}
+
#endif // MLIR_IR_BUILTINTYPEINTERFACES_TD_
diff --git a/mlir/lib/AsmParser/AttributeParser.cpp b/mlir/lib/AsmParser/AttributeParser.cpp
index 519609a38be6e..1f0bb774386af 100644
--- a/mlir/lib/AsmParser/AttributeParser.cpp
+++ b/mlir/lib/AsmParser/AttributeParser.cpp
@@ -16,6 +16,7 @@
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinDialect.h"
+#include "mlir/IR/BuiltinTypeInterfaces.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/DialectResourceBlobManager.h"
#include "mlir/IR/IntegerSet.h"
@@ -961,7 +962,54 @@ Attribute Parser::parseDenseElementsAttr(Type attrType) {
if (parseToken(Token::less, "expected '<' after 'dense'"))
return nullptr;
- // Parse the literal data if necessary.
+ // Check for the new type-first syntax: dense<TYPE : [ATTR, ...]>
+ // This is used for element types implementing DenseElementTypeInterface.
+ // Try to parse an optional type - if successful and followed by ':', use
+ // type-first syntax.
+ //
+ // Note: We explicitly skip l_paren here because parseOptionalType would try
+ // to parse it as a tuple/function type, but in dense literals, '(' starts
+ // a complex literal like (0, 1). The type-first syntax doesn't support
+ // tuple element types anyway.
+ Type type;
+ OptionalParseResult typeResult = getToken().is(Token::l_paren)
+ ? OptionalParseResult(std::nullopt)
+ : parseOptionalType(type);
+ if (typeResult.has_value()) {
+ if (failed(*typeResult))
+ return nullptr;
+
+ // We parsed a type. Check if this is the type-first syntax (followed by
+ // ':') or an error.
+ if (!getToken().is(Token::colon)) {
+ emitError(attribLoc, "expected ':' after type in dense attribute");
+ return nullptr;
+ }
+
+ auto shapedType = dyn_cast<ShapedType>(type);
+ if (!shapedType) {
+ emitError(attribLoc, "expected a shaped type for dense elements");
+ return nullptr;
+ }
+
+ if (!shapedType.hasStaticShape()) {
+ emitError(attribLoc, "dense elements type must have static shape");
+ return nullptr;
+ }
+
+ // Check that the element type implements DenseElementTypeInterface.
+ Type eltType = shapedType.getElementType();
+ if (!isa<DenseElementType>(eltType)) {
+ emitError(attribLoc,
+ "element type must implement DenseElementTypeInterface for "
+ "type-first dense syntax");
+ return nullptr;
+ }
+
+ return parseDenseElementsAttrTyped(attribLoc, shapedType);
+ }
+
+ // Parse the literal data if necessary (old syntax: dense<LITERAL> : TYPE).
TensorLiteralParser literalParser(*this);
if (!consumeIf(Token::greater)) {
if (literalParser.parse(/*allowHex=*/true) ||
@@ -969,10 +1017,100 @@ Attribute Parser::parseDenseElementsAttr(Type attrType) {
return nullptr;
}
- auto type = parseElementsLiteralType(attribLoc, attrType);
- if (!type)
+ auto literalType = parseElementsLiteralType(attribLoc, attrType);
+ if (!literalType)
+ return nullptr;
+ return literalParser.getAttr(attribLoc, literalType);
+}
+
+/// Parse a dense elements attribute with the type-first syntax.
+/// Syntax: dense<TYPE : [ATTR, ATTR, ...]>
+/// This is used for element types implementing DenseElementTypeInterface.
+/// The shaped type and ':' token validation are already done by the caller.
+Attribute Parser::parseDenseElementsAttrTyped(SMLoc loc,
+ ShapedType shapedType) {
+ // Consume the ':' that separates the type from the element list.
+ consumeToken(Token::colon);
+
+ auto denseEltType = cast<DenseElementType>(shapedType.getElementType());
+ ArrayRef<int64_t> shape = shapedType.getShape();
+
+ // Parse the element attributes and convert to raw bytes.
+ SmallVector<char> rawData;
+ size_t byteSize = denseEltType.getDenseElementBitSize() / CHAR_BIT;
+
+ // Helper to parse a single element.
+ auto parseSingleElement = [&]() -> ParseResult {
+ Attribute elemAttr = parseAttribute();
+ if (!elemAttr)
+ return failure();
+ if (failed(denseEltType.convertFromAttribute(elemAttr, rawData))) {
+ emitError("incompatible attribute for element type");
+ return failure();
+ }
+ return success();
+ };
+
+ // Recursively parse elements matching the expected shape.
+ std::function<ParseResult(ArrayRef<int64_t>)> parseElements;
+ parseElements = [&](ArrayRef<int64_t> remainingShape) -> ParseResult {
+ // Leaf: parse a single element.
+ if (remainingShape.empty())
+ return parseSingleElement();
+
+ // Non-leaf: expect a list with the correct number of elements.
+ int64_t expectedCount = remainingShape[0];
+ ArrayRef<int64_t> innerShape = remainingShape.drop_front();
+ int64_t actualCount = 0;
+
+ auto parseOne = [&]() -> ParseResult {
+ if (parseElements(innerShape))
+ return failure();
+ ++actualCount;
+ return success();
+ };
+
+ if (parseCommaSeparatedList(Delimiter::Square, parseOne))
+ return failure();
+
+ if (actualCount != expectedCount) {
+ emitError() << "expected " << expectedCount
+ << " elements in dimension, got " << actualCount;
+ return failure();
+ }
+ return success();
+ };
+
+ // Check for splat (single element for the whole tensor).
+ bool isSplat = false;
+ if (!getToken().is(Token::l_square)) {
+ // Single element - parse as splat.
+ if (parseSingleElement())
+ return nullptr;
+ isSplat = shapedType.getNumElements() != 1;
+ } else if (shape.empty()) {
+ // Scalar type shouldn't have a list.
+ emitError(loc, "expected single element for scalar type, got list");
+ return nullptr;
+ } else {
+ // Parse structured literal matching the shape.
+ if (parseElements(shape))
+ return nullptr;
+ }
+
+ // Verify element count (should match unless it's a splat).
+ int64_t numElements = shapedType.getNumElements();
+ if (!isSplat && rawData.size() != byteSize * numElements) {
+ emitError(loc) << "parsed " << (rawData.size() / byteSize)
+ << " elements, but type expects " << numElements;
+ return nullptr;
+ }
+
+ if (parseToken(Token::greater, "expected '>' to close dense attribute"))
return nullptr;
- return literalParser.getAttr(attribLoc, type);
+
+ // Create the attribute from raw buffer.
+ return DenseElementsAttr::getFromRawBuffer(shapedType, rawData);
}
Attribute Parser::parseDenseResourceElementsAttr(Type attrType) {
diff --git a/mlir/lib/AsmParser/Parser.h b/mlir/lib/AsmParser/Parser.h
index ecc128cf767b3..4d9bfbfe2091d 100644
--- a/mlir/lib/AsmParser/Parser.h
+++ b/mlir/lib/AsmParser/Parser.h
@@ -290,6 +290,12 @@ class Parser {
Attribute parseDenseElementsAttr(Type attrType);
ShapedType parseElementsLiteralType(SMLoc loc, Type type);
+ /// Parse a dense elements attribute with type-first syntax.
+ /// This is used for element types that implement DenseElementTypeInterface.
+ /// Syntax: dense<TYPE : [ATTR, ATTR, ...]>
+ /// The shaped type must already be parsed and validated.
+ Attribute parseDenseElementsAttrTyped(SMLoc loc, ShapedType shapedType);
+
/// Parse a dense resource elements attribute.
Attribute parseDenseResourceElementsAttr(Type attrType);
diff --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp
index 81455699421cc..0897065849c25 100644
--- a/mlir/lib/IR/AsmPrinter.cpp
+++ b/mlir/lib/IR/AsmPrinter.cpp
@@ -512,6 +512,11 @@ class AsmPrinter::Impl {
void printDenseIntOrFPElementsAttr(DenseIntOrFPElementsAttr attr,
bool allowHex);
+ /// Print a dense elements attribute using DenseElementTypeInterface.
+ /// Uses the type-first syntax: dense<TYPE : [ATTR, ...]>
+ void printDenseElementsAttrWithInterface(DenseElementsAttr attr,
+ DenseElementType denseEltType);
+
/// Print a dense array attribute.
void printDenseArrayAttr(DenseArrayAttr attr);
@@ -2501,23 +2506,41 @@ void AsmPrinter::Impl::printAttributeImpl(Attribute attr,
printSymbolReference(nestedRef.getValue(), os);
}
- } else if (auto intOrFpEltAttr =
- llvm::dyn_cast<DenseIntOrFPElementsAttr>(attr)) {
- if (printerFlags.shouldElideElementsAttr(intOrFpEltAttr)) {
- printElidedElementsAttr(os);
- } else {
- os << "dense<";
- printDenseIntOrFPElementsAttr(intOrFpEltAttr, /*allowHex=*/true);
- os << '>';
+ } else if (auto denseEltAttr = llvm::dyn_cast<DenseElementsAttr>(attr)) {
+ // Check if the element type implements DenseElementTypeInterface.
+ // If so, use the type-first syntax which embeds the type in the attribute.
+ Type eltType = denseEltAttr.getElementType();
+ if (auto denseEltType = llvm::dyn_cast<DenseElementType>(eltType)) {
+ if (printerFlags.shouldElideElementsAttr(denseEltAttr)) {
+ printElidedElementsAttr(os);
+ } else {
+ os << "dense<";
+ printDenseElementsAttrWithInterface(denseEltAttr, denseEltType);
+ os << '>';
+ }
+ // Type is embedded in the syntax, don't print it again.
+ return;
}
- } else if (auto strEltAttr = llvm::dyn_cast<DenseStringElementsAttr>(attr)) {
- if (printerFlags.shouldElideElementsAttr(strEltAttr)) {
- printElidedElementsAttr(os);
- } else {
- os << "dense<";
- printDenseStringElementsAttr(strEltAttr);
- os << '>';
+ // Fall back to existing printing for built-in element types.
+ if (auto intOrFpEltAttr =
+ llvm::dyn_cast<DenseIntOrFPElementsAttr>(denseEltAttr)) {
+ if (printerFlags.shouldElideElementsAttr(intOrFpEltAttr)) {
+ printElidedElementsAttr(os);
+ } else {
+ os << "dense<";
+ printDenseIntOrFPElementsAttr(intOrFpEltAttr, /*allowHex=*/true);
+ os << '>';
+ }
+ } else if (auto strEltAttr =
+ llvm::dyn_cast<DenseStringElementsAttr>(denseEltAttr)) {
+ if (printerFlags.shouldElideElementsAttr(strEltAttr)) {
+ printElidedElementsAttr(os);
+ } else {
+ os << "dense<";
+ printDenseStringElementsAttr(strEltAttr);
+ os << '>';
+ }
}
} else if (auto sparseEltAttr = llvm::dyn_cast<SparseElementsAttr>(attr)) {
@@ -2705,6 +2728,25 @@ void AsmPrinter::Impl::printDenseStringElementsAttr(
printDenseElementsAttrImpl(attr.isSplat(), attr.getType(), os, printFn);
}
+void AsmPrinter::Impl::printDenseElementsAttrWithInterface(
+ DenseElementsAttr attr, DenseElementType denseEltType) {
+ // Print the type first: dense<TYPE : [ELEMENTS]>
+ printType(attr.getType());
+ os << " : ";
+
+ ArrayRef<char> rawData = attr.getRawData();
+ size_t byteSize = denseEltType.getDenseElementBitSize() / CHAR_BIT;
+
+ // Print elements: convert raw bytes to attribute, then print attribute.
+ printDenseElementsAttrImpl(
+ attr.isSplat(), attr.getType(), os, [&](unsigned index) {
+ size_t offset = attr.isSplat() ? 0 : index * byteSize;
+ ArrayRef<char> elemData = rawData.slice(offset, byteSize);
+ Attribute elemAttr = denseEltType.convertToAttribute(elemData);
+ printAttributeImpl(elemAttr);
+ });
+}
+
void AsmPrinter::Impl::printDenseArrayAttr(DenseArrayAttr attr) {
Type type = attr.getElementType();
unsigned bitwidth = type.isInteger(1) ? 8 : type.getIntOrFloatBitWidth();
diff --git a/mlir/lib/IR/AttributeDetail.h b/mlir/lib/IR/AttributeDetail.h
index cb9d21bf3e611..9055d58c5fe5d 100644
--- a/mlir/lib/IR/AttributeDetail.h
+++ b/mlir/lib/IR/AttributeDetail.h
@@ -16,6 +16,7 @@
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/AttributeSupport.h"
#include "mlir/IR/BuiltinAttributes.h"
+#include "mlir/IR/BuiltinTypeInterfaces.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/IntegerSet.h"
#include "mlir/IR/MLIRContext.h"
@@ -32,6 +33,9 @@ namespace detail {
/// Return the bit width which DenseElementsAttr should use for this type.
inline size_t getDenseElementBitWidth(Type eltType) {
+ // Check for DenseElementTypeInterface first.
+ if (auto denseEltType = llvm::dyn_cast<DenseElementType>(eltType))
+ return denseEltType.getDenseElementBitSize();
// Align the width for complex to 8 to make storage and interpretation easier.
if (ComplexType comp = llvm::dyn_cast<ComplexType>(eltType))
return llvm::alignTo<8>(getDenseElementBitWidth(comp.getElementType())) * 2;
diff --git a/mlir/lib/IR/BuiltinTypes.cpp b/mlir/lib/IR/BuiltinTypes.cpp
index 1e198043c590a..d0165db058683 100644
--- a/mlir/lib/IR/BuiltinTypes.cpp
+++ b/mlir/lib/IR/BuiltinTypes.cpp
@@ -12,6 +12,7 @@
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinDialect.h"
+#include "mlir/IR/BuiltinTypeInterfaces.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/Dialect.h"
#include "mlir/IR/TensorEncoding.h"
diff --git a/mlir/test/IR/dense-elements-type-interface.mlir b/mlir/test/IR/dense-elements-type-interface.mlir
new file mode 100644
index 0000000000000..8aa1386cfeb73
--- /dev/null
+++ b/mlir/test/IR/dense-elements-type-interface.mlir
@@ -0,0 +1,28 @@
+// RUN: mlir-opt -allow-unregistered-dialect %s | mlir-opt -allow-unregistered-dialect | FileCheck %s
+
+// Test dense elements attribute with custom element type using DenseElementTypeInterface.
+// Uses the new type-first syntax: dense<TYPE : [ATTR, ...]>
+// Note: The type is embedded in the attribute, so it's not printed again at the end.
+
+// CHECK-LABEL: func @dense_custom_element_type
+func.func @dense_custom_element_type() {
+ // The type is embedded in the dense attribute syntax, not printed separately.
+ // CHECK: "unregistered_op"() {attr = dense<tensor<3x!test.dense_element> : [1 : i32, 2 : i32, 3 : i32]>}
+ "unregistered_op"() {attr = dense<tensor<3x!test.dense_element> : [1 : i32, 2 : i32, 3 : i32]>} : () -> ()
+ return
+}
+
+// CHECK-LABEL: func @dense_custom_element_type_2d
+func.func @dense_custom_element_type_2d() {
+ // CHECK: "unregistered_op"() {attr = dense<tensor<2x2x!test.dense_element> : {{\[}}{{\[}}1 : i32, 2 : i32], [3 : i32, 4 : i32]]>}
+ "unregistered_op"() {attr = dense<tensor<2x2x!test.dense_element> : [[1 : i32, 2 : i32], [3 : i32, 4 : i32]]>} : () -> ()
+ return
+}
+
+// CHECK-LABEL: func @dense_custom_element_splat
+func.func @dense_custom_element_splat() {
+ // A splat should be detected and stored efficiently
+ // CHECK: "unregistered_op"() {attr = dense<tensor<4x!test.dense_element> : 42 : i32>}
+ "unregistered_op"() {attr = dense<tensor<4x!test.dense_element> : 42 : i32>} : () -> ()
+ return
+}
diff --git a/mlir/test/lib/Dialect/Test/TestTypeDefs.td b/mlir/test/lib/Dialect/Test/TestTypeDefs.td
index 964792ceebc07..cfbadc6aa8a7a 100644
--- a/mlir/test/lib/Dialect/Test/TestTypeDefs.td
+++ b/mlir/test/lib/Dialect/Test/TestTypeDefs.td
@@ -18,6 +18,7 @@ include "TestDialect.td"
include "TestAttrDefs.td"
include "TestInterfaces.td"
include "mlir/IR/BuiltinTypes.td"
+include "mlir/IR/BuiltinTypeInterfaces.td"
include "mlir/Interfaces/DataLayoutInterfaces.td"
include "mlir/Dialect/Bufferization/IR/BufferizationTypeInterfaces.td"
@@ -512,4 +513,17 @@ def TestTypeNewlineAndIndent : Test_Type<"TestTypeNewlineAndIndent"> {
let hasCustomAssemblyFormat = 1;
}
+//===----------------------------------------------------------------------===//
+// Test type for DenseElementTypeInterface
+//===----------------------------------------------------------------------===//
+
+def TestTypeDenseElement : Test_Type<"TestDenseElement",
+ [DeclareTypeInterfaceMethods<DenseElementTypeInterface>]> {
+ let mnemonic = "dense_element";
+ let description = [{
+ A test type that implements DenseElementTypeInterface to test dense
+ elements with custom element types. Elements are stored as 32-bit integers.
+ }];
+}
+
#endif // TEST_TYPEDEFS
diff --git a/mlir/test/lib/Dialect/Test/TestTypes.cpp b/mlir/test/lib/Dialect/Test/TestTypes.cpp
index 71dd25b0093e0..ef3396fc4f610 100644
--- a/mlir/test/lib/Dialect/Test/TestTypes.cpp
+++ b/mlir/test/lib/Dialect/Test/TestTypes.cpp
@@ -15,6 +15,7 @@
#include "TestDialect.h"
#include "mlir/Dialect/LLVMIR/LLVMTypes.h"
#include "mlir/IR/Builders.h"
+#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/DialectImplementation.h"
#include "mlir/IR/ExtensibleDialect.h"
#include "mlir/IR/Types.h"
@@ -22,6 +23,7 @@
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/TypeSize.h"
+#include <cstring>
#include <optional>
using namespace mlir;
@@ -605,3 +607,29 @@ void TestTypeNewlineAndIndentType::print(::mlir::AsmPrinter &printer) const {
printer.printNewline();
printer << ">";
}
+
+//===----------------------------------------------------------------------===//
+// TestDenseElementType - DenseElementTypeInterface Implementation
+//===----------------------------------------------------------------------===//
+
+// Elements are stored as 32-bit integers.
+size_t TestDenseElementType::getDenseElementBitSize() const { return 32; }
+
+Attribute
+TestDenseElementType::convertToAttribute(ArrayRef<char> rawData) const {
+ assert(rawData.size() == 4 && "expected 4 bytes for TestDenseElement");
+ int32_t value;
+ std::memcpy(&value, rawData.data(), sizeof(value));
+ return IntegerAttr::get(IntegerType::get(getContext(), 32), value);
+}
+
+LogicalResult TestDenseElementType::convertFromAttribute(
+ Attribute attr, SmallVectorImpl<char> &result) const {
+ auto intAttr = dyn_cast<IntegerAttr>(attr);
+ if (!intAttr || intAttr.getType().getIntOrFloatBitWidth() != 32)
+ return failure();
+ int32_t value = intAttr.getValue().getSExtValue();
+ result.append(reinterpret_cast<const char *>(&value),
+ reinterpret_cast<const char *>(&value) + sizeof(value));
+ return success();
+}
diff --git a/mlir/test/lib/Dialect/Test/TestTypes.h b/mlir/test/lib/Dialect/Test/TestTypes.h
index 6499a96f495d0..705fb86e9e9b3 100644
--- a/mlir/test/lib/Dialect/Test/TestTypes.h
+++ b/mlir/test/lib/Dialect/Test/TestTypes.h
@@ -19,6 +19,7 @@
#include "TestTraits.h"
#include "mlir/Dialect/Bufferization/IR/BufferizationTypeInterfaces.h"
+#include "mlir/IR/BuiltinTypeInterfaces.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/Dialect.h"
#include "mlir/IR/DialectImplementation.h"
More information about the Mlir-commits
mailing list