One thing I’ve noticed about using mlir-tblgen – it emits code assuming that the code is used either within the mlir namespace, or with at least some of the mlir namespace imported. E.g. from RewriterGen.cpp:454:
os << formatv(R"(struct {0} : public RewritePattern {
{0}(MLIRContext *context)
: RewritePattern("{1}", {{)",
I’m wondering whether it’d be okay to change this to use absolute MLIR identifiers, so that the code looks something like:
os << formatv(R"(struct {0} : public ::mlir::RewritePattern {
{0}(::mlir::MLIRContext *context)
: ::mlir::RewritePattern("{1}", {{)",
For types/classes where we know unambigiously where they are this makes sense to me. We could make expectations clearer wrt in which namespace the code should get included etc.
+1 from me. This is clearer and more resilient. It avoids subtle symbol resolution issues given that presumably we will have may dialects and they can well have similar ops. If pulling in two dialects for declarative patterns, the generated C++ patterns are safer with qualified symbols.