many of the Ops from Standard do not specify a C++ namespace in their ODS in
include/mlir/Dialect/StandardOps/IR/Ops.td. As a result, the associated C++ classes are not put into a namespace directly in the generated header file. However, the wrapping header file
include/mlir/Dialect/StandardOps/IR/Ops.h puts all definitions into the
mlir namespace by putting the include directive into a namespace.
While this works fine when using
Ops.h in C++ code, this scheme requires some workaround when using the ODS in another tablegen file, e.g., in a DRR. The generated code then does not seem to reference the class from the
mlir namespace, but from the default namespace.
... include "mlir/Dialect/StandardOps/IR/Ops.td" ... def TestPattern : Pat< (SomeOp:$res $arg), (AddIOp $arg, $arg), >;
fails at compilation, since the generated code references
AddIOp instead of
mlir::AddIOp. What is the correct way to specify the namespace for
AddIOp here? As far as I understand, this wouldn’t be an issue at all if the ODS for all Ops would specify a