[all-commits] [llvm/llvm-project] e2c49a: [mlir python] Add locking around PyMlirContext::li...

Peter Hawkins via All-commits all-commits at lists.llvm.org
Mon Jan 13 07:49:48 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e2c49a45da31522d91e2e7b12bbc0901b0519384
      https://github.com/llvm/llvm-project/commit/e2c49a45da31522d91e2e7b12bbc0901b0519384
  Author: Peter Hawkins <phawkins at google.com>
  Date:   2025-01-13 (Mon, 13 Jan 2025)

  Changed paths:
    M mlir/lib/Bindings/Python/IRCore.cpp
    M mlir/lib/Bindings/Python/IRModule.h

  Log Message:
  -----------
  [mlir python] Add locking around PyMlirContext::liveOperations. (#122720)

In JAX, I observed a race between two PyOperation destructors from
different threads updating the same `liveOperations` map, despite not
intentionally sharing the context between different threads. Since I
don't think we can be completely sure when GC happens and on which
thread, it seems safest simply to add locking here.

We may also want to explicitly support sharing a context between threads
in the future, which would require this change or something similar.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list