[Python Bindings] isolatedOp assertion failure when creating Block

Hi!

I have a function operation in a dialect and when I try to create a block inside the operation using python bindings I get the following error:

Assertion failed: (isolatedOp->hasTrait<OpTrait::IsIsolatedFromAbove>() && "Intended to check IsolatedFromAbove ops"), function verifyIsIsolatedFromAbove, file Operation.cpp, line 1078.

Any ideas as to where the error is coming from?

Thanks,
Josh

It’s coming from Operation.cpp line 1078 :wink:

Well actually at HEAD it is line 1262 so you seem to be using an old version of MLIR.

Since you mention Python, I suspect you have multiple shared libraries involved in building the bindings, and they are statically some pieces of MLIR leading to ODR issues.

Same as Pybind error when accessing the same compiled obj (mlir.ir.module.parse and parseSourceFile<mlir::ModuleOp>) - #4 by segmentKOBE

1 Like

Thank you for your help! It turns out I had accidentally linked 2 versions of llvm to the compiler. It’s resolved now!