You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a weird MLIR tablegen issue I came across when I try to add a hcl.struct type.
The struct tablegen type definition is like this:
def Struct : HeteroCL_Type<"Struct"> {
let summary = "struct type";
let mnemonic = "struct";
let parameters = (ins "ArrayRef<Type>":$elementTypes);
let printer = [{
$_printer << "<";
llvm::interleaveComma(getImpl()->elementTypes, $_printer);
$_printer << '>';
}];
let parser = [{
if ($_parser.parseLess())
return Type();
SmallVector<mlir::Type, 1> elementTypes;
do {
mlir::Type elementType;
if ($_parser.parseType(elementType))
return nullptr;
elementTypes.push_back(elementType);
} while (succeeded($_parser.parseOptionalComma()));
if ($_parser.parseGreater())
return Type();
return get($_ctxt, elementTypes);
}];
}
As we have parameters, there will be a TypeStorage class generated by tablegen, the constructor of that type storage class looks like this:
static StructTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &tblgenKey) {
auto elementTypes = std::get<0>(tblgenKey);
// We need: auto elementTypes = allocator.copyInto(std::get<0>(tblgenKey));returnnew (allocator.allocate<StructTypeStorage>()) StructTypeStorage(elementTypes);
}
The elementTypes is an array member of the storage class: ArrayRef<Type> elementTypes. We need to do an allocator.copyInto when constructing the TypeStorage object (uniquing the type object), or else we get this error:
This is a weird MLIR tablegen issue I came across when I try to add a
hcl.struct
type.The struct tablegen type definition is like this:
As we have
parameters
, there will be aTypeStorage
class generated by tablegen, the constructor of that type storage class looks like this:The
elementTypes
is an array member of the storage class:ArrayRef<Type> elementTypes
. We need to do anallocator.copyInto
when constructing the TypeStorage object (uniquing the type object), or else we get this error:The text was updated successfully, but these errors were encountered: