File tree Expand file tree Collapse file tree 5 files changed +79
-0
lines changed
utils/bazel/llvm-project-overlay/mlir/python Expand file tree Collapse file tree 5 files changed +79
-0
lines changed Original file line number Diff line number Diff line change @@ -213,6 +213,15 @@ declare_mlir_dialect_extension_python_bindings(
213
213
"../../include/mlir/Dialect/Linalg/TransformOps/LinalgTransformEnums.td"
214
214
)
215
215
216
+ declare_mlir_dialect_extension_python_bindings (
217
+ ADD_TO_PARENT MLIRPythonSources.Dialects
218
+ ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR} /mlir"
219
+ TD_FILE dialects/SparseTensorTransformOps.td
220
+ SOURCES
221
+ dialects/transform/sparse_tensor.py
222
+ DIALECT_NAME transform
223
+ EXTENSION_NAME sparse_tensor_transform )
224
+
216
225
declare_mlir_dialect_extension_python_bindings (
217
226
ADD_TO_PARENT MLIRPythonSources.Dialects
218
227
ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR} /mlir"
Original file line number Diff line number Diff line change
1
+ //===-- SparseTensorTransformOps.td ------------------------*- tablegen -*-===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ //
7
+ //===----------------------------------------------------------------------===//
8
+
9
+ #ifndef PYTHON_BINDINGS_SPARSE_TENSOR_TRANSFORM_OPS
10
+ #define PYTHON_BINDINGS_SPARSE_TENSOR_TRANSFORM_OPS
11
+
12
+ include "mlir/Dialect/SparseTensor/TransformOps/SparseTensorTransformOps.td"
13
+
14
+ #endif
Original file line number Diff line number Diff line change
1
+ # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2
+ # See https://llvm.org/LICENSE.txt for license information.
3
+ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
+
5
+ from .._sparse_tensor_transform_ops_gen import *
Original file line number Diff line number Diff line change
1
+ # RUN: %PYTHON %s | FileCheck %s
2
+
3
+ from mlir .ir import *
4
+ from mlir .dialects import transform
5
+ from mlir .dialects .transform import sparse_tensor
6
+
7
+
8
+ def run (f ):
9
+ with Context (), Location .unknown ():
10
+ module = Module .create ()
11
+ with InsertionPoint (module .body ):
12
+ sequence = transform .SequenceOp (
13
+ transform .FailurePropagationMode .Propagate ,
14
+ [],
15
+ transform .AnyOpType .get (),
16
+ )
17
+ with InsertionPoint (sequence .body ):
18
+ f (sequence .bodyTarget )
19
+ transform .YieldOp ()
20
+ print ("\n TEST:" , f .__name__ )
21
+ print (module )
22
+ return f
23
+
24
+
25
+ @run
26
+ def testMatchSparseInOut (target ):
27
+ sparse_tensor .MatchSparseInOut (transform .AnyOpType .get (), target )
28
+ # CHECK-LABEL: TEST: testMatchSparseInOut
29
+ # CHECK: transform.sequence
30
+ # CHECK-NEXT: ^{{.*}}(%[[ARG0:.*]]: !transform.any_op):
31
+ # CHECK-NEXT: transform.sparse_tensor.match.sparse_inout %[[ARG0]]
Original file line number Diff line number Diff line change @@ -1232,6 +1232,25 @@ gentbl_filegroup(
1232
1232
],
1233
1233
)
1234
1234
1235
+ gentbl_filegroup (
1236
+ name = "SparseTensorTransformOpsPyGen" ,
1237
+ tbl_outs = [
1238
+ (
1239
+ [
1240
+ "-gen-python-op-bindings" ,
1241
+ "-bind-dialect=transform" ,
1242
+ "-dialect-extension=sparse_tensor_transform" ,
1243
+ ],
1244
+ "mlir/dialects/_sparse_tensor_transform_ops_gen.py" ,
1245
+ ),
1246
+ ],
1247
+ tblgen = "//mlir:mlir-tblgen" ,
1248
+ td_file = "mlir/dialects/SparseTensorTransformOps.td" ,
1249
+ deps = [
1250
+ "//mlir:SparseTensorTransformOpsTdFiles" ,
1251
+ ],
1252
+ )
1253
+
1235
1254
gentbl_filegroup (
1236
1255
name = "TensorTransformOpsPyGen" ,
1237
1256
tbl_outs = [
@@ -1309,6 +1328,7 @@ filegroup(
1309
1328
":LoopTransformOpsPyGen" ,
1310
1329
":MemRefTransformOpsPyGen" ,
1311
1330
":PDLTransformOpsPyGen" ,
1331
+ ":SparseTensorTransformOpsPyGen" ,
1312
1332
":StructureTransformEnumPyGen" ,
1313
1333
":StructuredTransformOpsPyGen" ,
1314
1334
":TensorTransformOpsPyGen" ,
You can’t perform that action at this time.
0 commit comments