Skip to content

Python bidings don't know that modules are operations #93337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ftynse opened this issue May 24, 2024 · 1 comment
Open

Python bidings don't know that modules are operations #93337

ftynse opened this issue May 24, 2024 · 1 comment
Assignees
Labels
mlir:python MLIR Python bindings

Comments

@ftynse
Copy link
Member

ftynse commented May 24, 2024

The following trivial code crashes:

from mlir.ir import *

m = ir.Module.create()
m.operation.erase()

because erase erases the module operation, and then the destructor of PyModule attempts to erase it the second time (transitively through the module object).

We should connect PyModule to the corresponding PyOperation in the bindings and avoid calling mlirModuleDestroy if the operation was already destroyed, using the valid flag on the operation.

@ftynse ftynse added the mlir:python MLIR Python bindings label May 24, 2024
@llvmbot
Copy link
Member

llvmbot commented May 24, 2024

@llvm/issue-subscribers-mlir-python

Author: Oleksandr "Alex" Zinenko (ftynse)

The following trivial code crashes:
from mlir.ir import *

m = ir.Module.create()
m.operation.erase()

because erase erases the module operation, and then the destructor of PyModule attempts to erase it the second time (transitively through the module object).

We should connect PyModule to the corresponding PyOperation in the bindings and avoid calling mlirModuleDestroy if the operation was already destroyed, using the valid flag on the operation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mlir:python MLIR Python bindings
Projects
None yet
Development

No branches or pull requests

4 participants