Hi, I’m new in MLIR and LLVM. I am learning about creating a transform pass.
My goal is to add a PragmaOp
from my own dialect to the front of the AffineForOp
. But the transform pass didn’t run properly.
This is what have done so far to try to figure out what happened:
- I had used
-print-ir-after-all
to confirm the pass is not work and the opt program is finished successfully. - I had changed
OperationPass<mlir::AffineForOp>
toOperationPass<mlir::ModuleOp>
and the pass is work fine.
How can I solve this? Is there any debug tools to trace why hook function not been evoked? Thanks a lot.
This is some of my code, my dialect named miniEmitC:
- Pass declaration:
def InsertminiEmitCPragmaScop : Pass<"insert-pragma-scop", "mlir::AffineForOp"> { let summary = "Insert a PET scop pragma for affine.for."; let constructor = "createInsertminiEmitCPragmaScopPass()"; let dependentDialects = ["miniEmitCDialect"]; }
- Pass implementation:
namespace miniemitc { namespace { struct InsertminiEmitCPragmaScopPass : public InsertminiEmitCPragmaScopBase<InsertminiEmitCPragmaScopPass> { void runOnOperation() override { auto op = getOperation(); op.emitWarning(); // TODO: Add insert func } }; } // namespace std::unique_ptr<OperationPass<AffineForOp>> createInsertminiEmitCPragmaScopPass() { return std::make_unique<InsertminiEmitCPragmaScopPass>(); } } // namespace miniemitc