[Mlir-commits] [mlir] [MLIR][Python] Do not install ExecutionEngine wrapper when disabled (PR #211250)

Anutosh Bhat llvmlistbot at llvm.org
Thu Jul 23 00:03:30 PDT 2026


https://github.com/anutosh491 updated https://github.com/llvm/llvm-project/pull/211250

>From d4920ce022d49d737a8157802141eeecc53a6942 Mon Sep 17 00:00:00 2001
From: anutosh491 <andersonbhat491 at gmail.com>
Date: Wed, 22 Jul 2026 18:10:06 +0530
Subject: [PATCH 1/2] [MLIR][Python] Do not install ExecutionEngine wrapper
 when disabled

---
 mlir/python/CMakeLists.txt | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/mlir/python/CMakeLists.txt b/mlir/python/CMakeLists.txt
index 802f8c126512e..693701ef50c13 100644
--- a/mlir/python/CMakeLists.txt
+++ b/mlir/python/CMakeLists.txt
@@ -41,15 +41,23 @@ declare_mlir_python_sources(MLIRPythonSources.Core.Python.Extras
     extras/meta.py
 )
 
+set(_execution_engine_python_sources)
+if(MLIR_ENABLE_EXECUTION_ENGINE)
+  list(APPEND _execution_engine_python_sources
+    execution_engine.py
+    _mlir_libs/_mlirExecutionEngine.pyi
+  )
+endif()
+
 declare_mlir_python_sources(MLIRPythonSources.ExecutionEngine
   ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir"
   ADD_TO_PARENT MLIRPythonSources
   SOURCES
-    execution_engine.py
-    _mlir_libs/_mlirExecutionEngine.pyi
+    ${_execution_engine_python_sources}
   SOURCES_GLOB
     runtime/*.py
 )
+unset(_execution_engine_python_sources)
 
 declare_mlir_python_sources(MLIRPythonCAPI.HeaderSources
   ROOT_DIR "${MLIR_SOURCE_DIR}/include"

>From a5e88cb89932a70a1d11f332e56e2798e114973c Mon Sep 17 00:00:00 2001
From: anutosh491 <andersonbhat491 at gmail.com>
Date: Thu, 23 Jul 2026 12:32:44 +0530
Subject: [PATCH 2/2] Add comment as per review

---
 mlir/python/CMakeLists.txt | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mlir/python/CMakeLists.txt b/mlir/python/CMakeLists.txt
index 693701ef50c13..54d915fac3d48 100644
--- a/mlir/python/CMakeLists.txt
+++ b/mlir/python/CMakeLists.txt
@@ -41,9 +41,12 @@ declare_mlir_python_sources(MLIRPythonSources.Core.Python.Extras
     extras/meta.py
 )
 
+# Keep this source group unconditional because runtime/*.py contains generic
+# memref helpers that do not depend on the ExecutionEngine extension. Only the
+# wrapper and type stub require _mlirExecutionEngine.
 set(_execution_engine_python_sources)
 if(MLIR_ENABLE_EXECUTION_ENGINE)
-  list(APPEND _execution_engine_python_sources
+  set(_execution_engine_python_sources
     execution_engine.py
     _mlir_libs/_mlirExecutionEngine.pyi
   )



More information about the Mlir-commits mailing list