[Mlir-commits] [llvm] [mlir] [mlir python] Port in-tree dialects to nanobind. (PR #119924)
Stella Laurenzo
llvmlistbot at llvm.org
Wed Dec 25 00:22:18 PST 2024
stellaraccident wrote:
> FYI after upgrading `mlir-python-extras` to latest I am suddenly getting this:
>
> ```
> nanobind: leaked 3 instances!
> - leaked instance 0x7fe74e5c1c88 of type "mlir.execution_engine.ExecutionEngine"
> - leaked instance 0x7fe74e5ba868 of type "mlir._mlir_libs._mlir.ir.UnrankedMemRefType"
> - leaked instance 0x7fe74e67afa8 of type "mlir._mlir_libs.Context"
> nanobind: leaked 126 types!
> - leaked type "mlir._mlir_libs._mlir.ir.AffineFloorDivExpr"
> - leaked type "mlir._mlir_libs._mlir.ir.AffineCeilDivExpr"
> - leaked type "mlir._mlir_libs._mlir.ir.F16Type"
> - leaked type "mlir._mlir_libs._mlir.ir.AffineMap"
> - leaked type "mlir._mlir_libs._mlirExecutionEngine.ExecutionEngine"
> - leaked type "mlir._mlir_libs._mlir.ir.FloatTF32Type"
> - leaked type "mlir._mlir_libs._mlir.ir.Float8E8M0FNUType"
> - leaked type "mlir._mlir_libs._mlir.ir.IntegerAttr"
> - leaked type "mlir._mlir_libs._mlir.ir.OpOperandIterator"
> - leaked type "mlir._mlir_libs._mlir.ir.OpView"
> - leaked type "mlir._mlir_libs._mlir.passmanager.PassManager"
> - ... skipped remainder
> nanobind: leaked 860 functions!
> - leaked function "__init__"
> - leaked function ""
> - leaked function ""
> - leaked function ""
> - leaked function "dump"
> - leaked function "get_identity"
> - leaked function "__add__"
> - leaked function "maybe_downcast"
> - leaked function "__init__"
> - leaked function ""
> - leaked function ""
> - ... skipped remainder
> nanobind: this is likely caused by a reference counting issue in the binding code.
> ```
>
> I'm not sure if this is my fault or upstream's 🤷
I've generally found the nanobind leak detector to make false positive warnings in a variety of situations that are common in these kind of programs. I can't tell if this is one of them. There is a function you can call at module init or after to silence it. I'd recommend landing that upstream while investigating.
TBH - the only reliable way I've found to do leak detection is via a python debug build (which explicitly frees at shutdown) and ASAN. Anything else is easily thwarted with valid programs.
https://github.com/llvm/llvm-project/pull/119924
More information about the Mlir-commits
mailing list