Creating a new Type

Hi,

I am trying to create a type using table generation. I have followed and copied code from the MLIR core and ended with the following .td file

################################################

include “mlir/IR/BuiltinDialect.td”

// Base class for Builtin dialect types.
class Builtin_Type<string name, string baseCppClass = “::mlir::Type”>
: TypeDef<Builtin_Dialect, name, baseCppClass> {
let mnemonic = ?;
}

def Builtin_CustomTensor : Builtin_Type<“CustomTensor”, “TensorType”> {
let summary = “Multi-dimensional array with a fixed number of dimensions”;

let parameters = (ins
ArrayRefParameter<“int64_t”>:$shape,
“Type”:$elementType,
StringRefParameter<"">:$typeData
);

let builders = [
TypeBuilderWithInferredContext<(ins
“ArrayRef<int64_t>”:$shape, “Type”:elementType ), [{ return _get(elementType.getContext(), shape, elementType);
}]>
];
let skipDefaultBuilders = 1;
let genVerifyDecl = 1;
}

################################################

Although I successfully generate the #include “customtensor_ir_typedef.h.inc” and customtensor_ir_typedef.cc.inc when compiling I keep getting:

/usr/include/c++/7/type_traits:1446:12: error: invalid use of incomplete type ‘struct mlir::detail::CustomTensorTypeStorage’

mlir/include/mlir/Support/StorageUniquer.h:140:5: error: ‘value’ is not a member of ‘std::is_trivially_destructiblemlir::detail::CustomTensorTypeStorage

mlir/include/mlir/Support/StorageUniquer.h:142:5: error: no matching function for call to ‘mlir::StorageUniquer::registerParametricStorageTypeImpl(mlir::TypeID&, mlir::StorageUniquer::registerParametricStorageType(mlir::TypeID) [with Storage = mlir::detail::CustomTensorTypeStorage]::<lambda(mlir::StorageUniquer::BaseStorage*)>)’

any ideas what my definition is missing ? I have also noticed that this error is triggered when I perform addTypes(); to my dialect.

Thanks
Aaron

Solved the problem :slight_smile: . Forgot to add the #define GET_TYPEDEF_CLASSES before adding the autogenerated cc.inc
Aaron