diff options
| author | Maksim Levental <maksim.levental@gmail.com> | 2025-09-08 22:52:27 -0400 |
|---|---|---|
| committer | Maksim Levental <maksim.levental@gmail.com> | 2025-09-09 00:47:56 -0400 |
| commit | f9a11b25bd114feb03eb1df0c743c101120795fc (patch) | |
| tree | 24560c2ced0fe4877d77b4eda611d7cc55691662 | |
| parent | b779d77a6e7cd9c402c50c6be727be583cbf69fc (diff) | |
test PyOperationBase method callusers/makslevental/move-py-types
| -rw-r--r-- | mlir/include/mlir/Bindings/Python/IRModule.h | 2 | ||||
| -rw-r--r-- | mlir/lib/Bindings/Python/DialectGPU.cpp | 2 | ||||
| -rw-r--r-- | mlir/python/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | mlir/python/mlir/dialects/gpu/__init__.py | 1 | ||||
| -rw-r--r-- | mlir/test/python/dialects/gpu/dialect.py | 3 |
5 files changed, 7 insertions, 2 deletions
diff --git a/mlir/include/mlir/Bindings/Python/IRModule.h b/mlir/include/mlir/Bindings/Python/IRModule.h index 1d1ff29533f9..b886e8db1369 100644 --- a/mlir/include/mlir/Bindings/Python/IRModule.h +++ b/mlir/include/mlir/Bindings/Python/IRModule.h @@ -571,7 +571,7 @@ public: /// Verify the operation. Throws `MLIRError` if verification fails, and /// returns `true` otherwise. - bool verify(); + MLIR_CAPI_EXPORTED bool verify(); /// Each must provide access to the raw Operation. virtual PyOperation &getOperation() = 0; diff --git a/mlir/lib/Bindings/Python/DialectGPU.cpp b/mlir/lib/Bindings/Python/DialectGPU.cpp index 2568d535edb5..85df2ae2ad99 100644 --- a/mlir/lib/Bindings/Python/DialectGPU.cpp +++ b/mlir/lib/Bindings/Python/DialectGPU.cpp @@ -9,6 +9,7 @@ #include "mlir-c/Dialect/GPU.h" #include "mlir-c/IR.h" #include "mlir-c/Support.h" +#include "mlir/Bindings/Python/IRModule.h" #include "mlir/Bindings/Python/Nanobind.h" #include "mlir/Bindings/Python/NanobindAdaptors.h" @@ -28,6 +29,7 @@ NB_MODULE(_mlirDialectsGPU, m) { //===-------------------------------------------------------------------===// // AsyncTokenType //===-------------------------------------------------------------------===// + m.def("blahblah", [](PyOperationBase &op) { op.verify(); }); auto mlirGPUAsyncTokenType = mlir_type_subclass(m, "AsyncTokenType", mlirTypeIsAGPUAsyncTokenType); diff --git a/mlir/python/CMakeLists.txt b/mlir/python/CMakeLists.txt index 6d61d891fc65..95d81f8eca9d 100644 --- a/mlir/python/CMakeLists.txt +++ b/mlir/python/CMakeLists.txt @@ -881,3 +881,4 @@ add_mlir_python_modules(MLIRPythonModules COMMON_CAPI_LINK_LIBS MLIRPythonCAPI ) +add_dependencies(MLIRPythonModules.extension._mlirDialectsGPU.dso MLIRPythonModules.extension._mlir.dso) diff --git a/mlir/python/mlir/dialects/gpu/__init__.py b/mlir/python/mlir/dialects/gpu/__init__.py index 4cd80aa8b7ca..460957cc3756 100644 --- a/mlir/python/mlir/dialects/gpu/__init__.py +++ b/mlir/python/mlir/dialects/gpu/__init__.py @@ -2,6 +2,7 @@ # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +from ..._mlir_libs import _mlir from .._gpu_ops_gen import * from .._gpu_enum_gen import * from ..._mlir_libs._mlirDialectsGPU import * diff --git a/mlir/test/python/dialects/gpu/dialect.py b/mlir/test/python/dialects/gpu/dialect.py index 26ee9f34cb33..6454b9c99978 100644 --- a/mlir/test/python/dialects/gpu/dialect.py +++ b/mlir/test/python/dialects/gpu/dialect.py @@ -26,7 +26,8 @@ def testGPUPass(): def testMMAElementWiseAttr(): module = Module.create() with InsertionPoint(module.body): - gpu.BlockDimOp(gpu.Dimension.y) + b = gpu.BlockDimOp(gpu.Dimension.y) + gpu.blahblah(b) # CHECK: %block_dim_y = gpu.block_dim y print(module) pass |
