Hello,I’m trying to make python API of toy toturial using boost python. It works well when create createLowerToAffinePass
,but it crashed when I add createLowerToLLVMPass
.The code is as following:(context is global and I register toy dialect before creating the MLIRContext as I’m been told in other thread I started)
void dumpMLIRLLVM(mlir::ModuleOp module)
{
mlir::registerPassManagerCLOptions();
mlir::PassManager pm(&context);
// Apply any generic pass manager command line options and run the pipeline.
applyPassManagerCLOptions(pm);
pm.addPass(mlir::createInlinerPass());
pm.addPass(mlir::createSymbolDCEPass());
mlir::OpPassManager &optPM = pm.nest<mlir::FuncOp>();
optPM.addPass(mlir::toy::createShapeInferencePass());
optPM.addPass(mlir::createCanonicalizerPass());
optPM.addPass(mlir::createCSEPass());
pm.addPass(mlir::toy::createLowerToAffinePass());
optPM.addPass(mlir::createCanonicalizerPass());
optPM.addPass(mlir::createCSEPass());
optPM.addPass(mlir::createLoopFusionPass());
optPM.addPass(mlir::createMemRefDataFlowOptPass());
std::cout<<"lower to affine success"<<std::endl;
pm.addPass(mlir::toy::createLowerToLLVMPass());
if (mlir::failed(pm.run(module))){
std::cout<<"pm.run(module) failed"<<std::endl;
return ;
}
module.dump();
}
Then I found it crashed in applyFullConversion(...)
in ToyToLLVMLoweringPass::runOnOperation()
in LowertoLLVM.cpp
.I didn’t change LowertoLLVM.cpp at all
What might cause that situation ?How to solve that problem?