[Mlir-commits] [mlir] [MLIR][Python] remove `liveOperations` (PR	#155114)
    Maksim Levental 
    llvmlistbot at llvm.org
       
    Tue Sep 23 18:53:17 PDT 2025
    
    
  
makslevental wrote:
> So, I was using `_clear_live_operations` to set the valid flag in `PyOperation` to false to signal that the Python `Operation`s were no longer valid so as to trigger reasonable behavior when debugging. I was also issuing a warning when it returned a non-zero result. Without this, I have no idea if there's a dangling pointer bug which could explode if I touch (or click) something the wrong way.
I added an API `_set_invalid` with use-cases like yours (but not yours specifically since I wasn't aware of it) in mind: 
https://github.com/llvm/llvm-project/blob/b5daf76798561194dac484347e9951a53032ba06/mlir/test/python/pass_manager.py#L234
So you can invalidate ops by hand. Now this requires actually being able to "find" them i.e., they should already have been instantiated on the Python side and be accessible/reachable by you at the point at which you return from the call to the pass manager. The first part was always a requirement (the `liveOperations` operations map would only have had in it ops that were already "live" right) but second part might be challenging.
https://github.com/llvm/llvm-project/pull/155114
    
    
More information about the Mlir-commits
mailing list