[Mlir-commits] [mlir] [mlir] Make C/Python ExecutionEngine constructible with an Operation. (PR #86329)

Jacques Pienaar llvmlistbot at llvm.org
Tue Apr 9 02:09:30 PDT 2024


================
@@ -21,17 +21,46 @@ def run(f):
     assert Context._get_live_count() == 0
 
 
-# Verify capsule interop.
-# CHECK-LABEL: TEST: testCapsule
-def testCapsule():
+# Verify capsule interop for passing an Operation.
+# CHECK-LABEL: TEST: testAcceptsOperation
+def testAcceptsOperation():
+    with Context():
+        module = Operation.parse(
+            r"""
+builtin.module {
+llvm.func @none() {
+llvm.return
+}
+}
+    """
+        )
+        execution_engine = ExecutionEngine(module)
+        execution_engine_capsule = execution_engine._CAPIPtr
+        # CHECK: mlir.execution_engine.ExecutionEngine._CAPIPtr
+        log(repr(execution_engine_capsule))
+        execution_engine._testing_release()
+        execution_engine1 = ExecutionEngine._CAPICreate(execution_engine_capsule)
+        # CHECK: _mlirExecutionEngine.ExecutionEngine
+        log(repr(execution_engine1))
+
+
+run(testAcceptsOperation)
+
+
+# Verify capsule interop for passing a Module.
+# CHECK-LABEL: TEST: testAcceptsModule
+def testAcceptsModule():
     with Context():
         module = Module.parse(
             r"""
+builtin.module {
 llvm.func @none() {
-  llvm.return
+llvm.return
+}
 }
     """
         )
+        print("MODULE:", type(module))
----------------
jpienaar wrote:

Leftover debugging?

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


More information about the Mlir-commits mailing list