[Mlir-commits] [mlir] Added PyThreadPool as wrapper around MlirLlvmThreadPool in MLIR python bindings (PR #130109)

Mehdi Amini llvmlistbot at llvm.org
Fri Mar 7 14:17:52 PST 2025


================
@@ -148,13 +148,18 @@ def process_initializer_module(module_name):
             break
 
     class Context(ir._BaseContext):
-        def __init__(self, load_on_create_dialects=None, *args, **kwargs):
+        def __init__(
+            self, load_on_create_dialects=None, thread_pool=None, *args, **kwargs
+        ):
             super().__init__(*args, **kwargs)
             self.append_dialect_registry(get_dialect_registry())
             for hook in post_init_hooks:
                 hook(self)
             if not disable_multithreading:
-                self.enable_multithreading(True)
+                if thread_pool is None:
+                    self.enable_multithreading(True)
+                else:
+                    self.set_thread_pool(thread_pool)
----------------
joker-eph wrote:

We ignore the thread_pool argument if `disable_multithreading` is set: can we throw instead?

https://github.com/llvm/llvm-project/pull/130109


More information about the Mlir-commits mailing list