[Mlir-commits] [mlir] [MLIR] Split ExecutionEngine Initialization out of ctor into an explicit method call (PR #153524)

Mehdi Amini llvmlistbot at llvm.org
Fri Aug 15 02:14:50 PDT 2025


================
@@ -124,6 +124,17 @@ NB_MODULE(_mlirExecutionEngine, m) {
           },
           nb::arg("name"), nb::arg("callback"),
           "Register `callback` as the runtime symbol `name`.")
+      .def(
+          "initialize",
+          [](PyExecutionEngine &executionEngine) {
+            mlirExecutionEngineInitialize(executionEngine.get());
+          },
+          "Initialize the ExecutionEngine. Global constructors specified by "
+          "`llvm.mlir.global_ctors` will be run. One common scenario is that "
+          "kernel binary compiled from `gpu.module` gets loaded during "
+          "initialization. Make sure all symbols are resolvable before "
+          "initialization by calling `raw_register_runtime` or including "
+          "shared libraries.")
----------------
joker-eph wrote:

> yes it is because python API has raw_register_runtime which calls mlirExecutionEngineRegisterSymbol. As long as user of one binding can use mlirExecutionEngineRegisterSymbol to register symbol, the exposure would be useful. 

I don't follow. Can you write a python test that show the usefulness of the API? 

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


More information about the Mlir-commits mailing list