I am very new to MLIR world.
I built a mlir module with c++ builder API, like this
auto module = mlir::ModuleOp::create(mlir::UnknownLoc::get(&ctx) , StringRef(“mainModule”));
I added some other Ops(Func Op/ myDialect Ops) inside Module.
I want to see the assembly format for created Module at the end, how to I do that ?
Currently I am using a mlir pass mlir::createPrintOpGraphPass() to do that, but it prints lot of information I don’t really need.
module.dump() prints the module to stderr, module.print(stream) prints the module to the given output stream, e.g., llvm::outs() for stdout. This also works for most other IR objects.
Yes and it doesn’t so as pretty as it could This pass creates a basic graph in graphviz format per block.
As Alex pointed out, print and dump are more appropriate and easier (one can even invoke from one’s debugger). “Pass” wise the easiest is to enable printing on the pass manager, then you would get a dump before and after every pass.
Another method that I often use during development is:
myop.emitWarning() << "Custom Debug Message";
During runtime it will point to the operation and file location that gave origin to myop (useful when several passes were used) and print to the terminal the mlir code of myop.