[all-commits] [llvm/llvm-project] ab18cc: [MLIR][py] Add PyThreadPool as wrapper around Mlir...

vfdev via All-commits all-commits at lists.llvm.org
Mon Mar 10 03:19:44 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ab18cc246c2490564043161db5d9646cf1163de4
      https://github.com/llvm/llvm-project/commit/ab18cc246c2490564043161db5d9646cf1163de4
  Author: vfdev <vfdev.5 at gmail.com>
  Date:   2025-03-10 (Mon, 10 Mar 2025)

  Changed paths:
    M mlir/include/mlir-c/IR.h
    M mlir/lib/Bindings/Python/IRCore.cpp
    M mlir/lib/Bindings/Python/IRModule.h
    M mlir/lib/CAPI/IR/IR.cpp
    M mlir/python/mlir/_mlir_libs/__init__.py
    M mlir/test/python/ir/context_lifecycle.py

  Log Message:
  -----------
  [MLIR][py] Add PyThreadPool as wrapper around MlirLlvmThreadPool in MLIR python bindings (#130109)

In some projects like JAX ir.Context are used with disabled multi-threading to avoid
caching multiple threading pools:

https://github.com/jax-ml/jax/blob/623865fe9538100d877ba9d36f788d0f95a11ed2/jax/_src/interpreters/mlir.py#L606-L611

However, when context has enabled multithreading it also uses locks on
the StorageUniquers and this can be helpful to avoid data races in the
multi-threaded execution (for example with free-threaded cpython,
https://github.com/jax-ml/jax/issues/26272).
With this PR user can enable the multi-threading: 1) enables additional
locking and 2) set a shared threading pool such that cached contexts can
have one global pool.



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