[Mlir-commits] [mlir] [MLIR] Tweak standalone example `smoketest.py` (PR #112448)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Oct 15 15:36:17 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Mateusz Sokół (mtsokol)

<details>
<summary>Changes</summary>

Hi!
While working with MLIR standalone example it took me some time to figure out how to access dialects and execution engine from MLIR Python package.

I think it might be useful to include them in the standalone build already. WDYT?


---
Full diff: https://github.com/llvm/llvm-project/pull/112448.diff


2 Files Affected:

- (modified) mlir/examples/standalone/python/CMakeLists.txt (+2) 
- (modified) mlir/examples/standalone/test/python/smoketest.py (+7-1) 


``````````diff
diff --git a/mlir/examples/standalone/python/CMakeLists.txt b/mlir/examples/standalone/python/CMakeLists.txt
index a8c43827a5a375..b948f4d524e0b5 100644
--- a/mlir/examples/standalone/python/CMakeLists.txt
+++ b/mlir/examples/standalone/python/CMakeLists.txt
@@ -43,7 +43,9 @@ add_mlir_python_common_capi_library(StandalonePythonCAPI
     # TODO: Remove this in favor of showing fine grained registration once
     # available.
     MLIRPythonExtension.RegisterEverything
+    MLIRPythonExtension.ExecutionEngine
     MLIRPythonSources.Core
+    MLIRPythonSources.Dialects
 )
 
 ################################################################################
diff --git a/mlir/examples/standalone/test/python/smoketest.py b/mlir/examples/standalone/test/python/smoketest.py
index 08e08cbd2fe24c..3ea4283f8f41c2 100644
--- a/mlir/examples/standalone/test/python/smoketest.py
+++ b/mlir/examples/standalone/test/python/smoketest.py
@@ -1,7 +1,13 @@
 # RUN: %python %s | FileCheck %s
 
 from mlir_standalone.ir import *
-from mlir_standalone.dialects import builtin as builtin_d, standalone as standalone_d
+from mlir_standalone import execution_engine, passmanager
+from mlir_standalone.dialects import (
+    builtin as builtin_d,
+    linalg as linalg_d,
+    sparse_tensor as sparse_tensor_d,
+    standalone as standalone_d,
+)
 
 with Context():
     standalone_d.register_dialect()

``````````

</details>


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


More information about the Mlir-commits mailing list