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)
// Apply any generic pass manager command line options and run the pipeline.
mlir::OpPassManager &optPM = pm.nest<mlir::FuncOp>();
std::cout<<"lower to affine success"<<std::endl;
Then I found it crashed in
LowertoLLVM.cpp .I didn’t change LowertoLLVM.cpp at all
What might cause that situation ?How to solve that problem?
Can you provide more detail? When you say crashed do you mean that the pass failed, that you hit an assert, or something else? What is the input IR? Can you try some of the recommendations at https://mlir.llvm.org/getting_started/Debugging? In particular, a local crash reproducer would be helpful here as it will provide a minimal reproduction of what you’re seeing.
segmentation fault and input IR is toy Dialect (I write python API using boost python like
I am afraid that’s not enough for any of us to reproduce your problem. There’s not even evidence that the issue is with MLIR and not with your code or bindings. “toy dialect” isn’t a sufficient description of the input IR. It is customary to try and provide something that lets anyone just compile mlir from the main repository, call
mlir-opt (or add +/-10 LoC somewhere) and see the problem. In this case, I suggest at least to (1) try minimizing the list of passes you run and still see the problem; (2) dump the module before the pass pipeline.
I also note that you might be misunderstanding how the pass manager works, looking at the code snippet you posted above. Passes are not actually executed until the
run cal on the pass manager. The fact that the code prints
lower to affine success does not mean the pass succeeded, only that creating a pass (allocation, really) and adding it to the pass manager (
push_back on a vector) succeeded. So the issue may be absolutely any pass in the pipeline.