Skip to content

Commit f9a11b2

Browse files
committed
test PyOperationBase method call
1 parent b779d77 commit f9a11b2

File tree

5 files changed

+7
-2
lines changed

5 files changed

+7
-2
lines changed

mlir/include/mlir/Bindings/Python/IRModule.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ class PyOperationBase {
571571

572572
/// Verify the operation. Throws `MLIRError` if verification fails, and
573573
/// returns `true` otherwise.
574-
bool verify();
574+
MLIR_CAPI_EXPORTED bool verify();
575575

576576
/// Each must provide access to the raw Operation.
577577
virtual PyOperation &getOperation() = 0;

mlir/lib/Bindings/Python/DialectGPU.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "mlir-c/Dialect/GPU.h"
1010
#include "mlir-c/IR.h"
1111
#include "mlir-c/Support.h"
12+
#include "mlir/Bindings/Python/IRModule.h"
1213
#include "mlir/Bindings/Python/Nanobind.h"
1314
#include "mlir/Bindings/Python/NanobindAdaptors.h"
1415

@@ -28,6 +29,7 @@ NB_MODULE(_mlirDialectsGPU, m) {
2829
//===-------------------------------------------------------------------===//
2930
// AsyncTokenType
3031
//===-------------------------------------------------------------------===//
32+
m.def("blahblah", [](PyOperationBase &op) { op.verify(); });
3133

3234
auto mlirGPUAsyncTokenType =
3335
mlir_type_subclass(m, "AsyncTokenType", mlirTypeIsAGPUAsyncTokenType);

mlir/python/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,3 +881,4 @@ add_mlir_python_modules(MLIRPythonModules
881881
COMMON_CAPI_LINK_LIBS
882882
MLIRPythonCAPI
883883
)
884+
add_dependencies(MLIRPythonModules.extension._mlirDialectsGPU.dso MLIRPythonModules.extension._mlir.dso)

mlir/python/mlir/dialects/gpu/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# See https://llvm.org/LICENSE.txt for license information.
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5+
from ..._mlir_libs import _mlir
56
from .._gpu_ops_gen import *
67
from .._gpu_enum_gen import *
78
from ..._mlir_libs._mlirDialectsGPU import *

mlir/test/python/dialects/gpu/dialect.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ def testGPUPass():
2626
def testMMAElementWiseAttr():
2727
module = Module.create()
2828
with InsertionPoint(module.body):
29-
gpu.BlockDimOp(gpu.Dimension.y)
29+
b = gpu.BlockDimOp(gpu.Dimension.y)
30+
gpu.blahblah(b)
3031
# CHECK: %block_dim_y = gpu.block_dim y
3132
print(module)
3233
pass

0 commit comments

Comments
 (0)