Hello, I want to design my own dialect, and refer to the standalone example. The example defines a new type as well as a new operation using I32 typeattr argument, and standalone-opt
can correctly parse and print them.
My problem is that, when I want to use the new type as argument in new dialect operation, it will show the error that the new type is not a member in my dialect.
The error message is
/cute/build/include/CuTe/CuTeOps.cpp.inc:40:36: error: ‘CustomType’ is not a member of ‘mlir::cute’
40 | if (!((::llvm::isa<::mlir::cute::CustomType>(type)))) {
| ^~~~~~~~~~
/cute/build/include/CuTe/CuTeOps.cpp.inc:40:52: error: no matching function for call to ‘isa< >(mlir::Type&)’
40 | if (!((::llvm::isa<::mlir::cute::CustomType>(type)))) {
But Actually my CuTeOpsType.h.inc file has the line MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::cute::CustomType)
So I am wondering what may lead to this error. Thanks for your help!
My code is like this
In CuTeTypes.td:
def CuTe_CustomType : CuTe_Type<“Custom”, “custom”> {
let summary = “CuTe custom type”;
let description = “Custom type in cute dialect”;
let parameters = (ins StringRefParameter<“the custom value”>:$value);
let assemblyFormat = “<
$value >
”;
}
def IsCustomTypePred : CPred<“::llvm::isa<::mlir::cute::CustomType>($_self)”>;
def cute_CustomType : Type<IsCustomTypePred, “cute.custom type”>;
In CuTeOps.td:
…
let arguments = (ins cute_CustomType:$input);
let results = (outs cute_CustomType:$output);