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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Aug 15 02:45:52 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {darker}-->


:warning: Python code formatter, darker found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
darker --check --diff -r HEAD~1...HEAD mlir/test/python/execution_engine.py
``````````

</details>

<details>
<summary>
View the diff from darker here.
</summary>

``````````diff
--- execution_engine.py	2025-08-15 09:43:15.000000 +0000
+++ execution_engine.py	2025-08-15 09:45:19.614840 +0000
@@ -348,18 +348,20 @@
     def initCallback():
         nonlocal init_cnt
         init_cnt += 1
 
     with Context():
-        module = Module.parse(r"""
+        module = Module.parse(
+            r"""
 llvm.mlir.global_ctors ctors = [@ctor], priorities = [0 : i32], data = [#llvm.zero]
 llvm.func @ctor() {
   func.call @init_callback() : () -> ()
   llvm.return
 }
 func.func private @init_callback() attributes { llvm.emit_c_interface }
-        """)
+        """
+        )
 
         # Setup execution engine
         execution_engine = ExecutionEngine(lowerToLLVM(module))
 
         # Validate initialization hasn't run yet
@@ -372,10 +374,11 @@
         execution_engine.initialize()
         assert init_cnt == 1
         # # Second initialization should be no-op
         execution_engine.initialize()
         assert init_cnt == 1
+
 
 run(testJITCallbackInGlobalCtor)
 
 #  Test addition of two memrefs.
 # CHECK-LABEL: TEST: testMemrefAdd

``````````

</details>


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


More information about the Mlir-commits mailing list