Skip to content

Commit ad7e6e9

Browse files
committed
update bazel for python binding
1 parent 8ce75ac commit ad7e6e9

File tree

6 files changed

+233
-11
lines changed

6 files changed

+233
-11
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//===-- BufferizationEnums.td - Entry point for BufferizationEnums bindings ---===//
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_BUFFERIZATION_ENUMS
10+
#define PYTHON_BINDINGS_BUFFERIZATION_ENUMS
11+
12+
include "mlir/Dialect/Bufferization/IR/BufferizationEnums.td"
13+
14+
#endif // PYTHON_BINDINGS_BUFFERIZATION_ENUMS
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//===-- LinalgStructuredTransformEnums.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+
// Entry point of the Python bindings generator for the structured transform ops
10+
// provided by Linalg (and other dialects).
11+
//
12+
//===----------------------------------------------------------------------===//
13+
14+
15+
#ifndef PYTHON_BINDINGS_LINALG_STRUCTURED_TRANSFORM_ENUMS
16+
#define PYTHON_BINDINGS_LINALG_STRUCTURED_TRANSFORM_ENUMS
17+
18+
include "mlir/Dialect/Linalg/TransformOps/LinalgTransformEnums.td"
19+
20+
#endif // PYTHON_BINDINGS_LINALG_STRUCTURED_TRANSFORM_ENUMS
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//===-- SparseTensorAttrDefs.td - Entry point for bindings ------*- 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_ATTR_DEFS
10+
#define PYTHON_BINDINGS_SPARSE_TENSOR_ATTR_DEFS
11+
12+
include "mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td"
13+
14+
#endif // PYTHON_BINDINGS_SPARSE_TENSOR_ATTR_DEFS
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//===-- TransformAttrs.td - Transform attrs bind entry point ---*- 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_TRANSFORM_ATTRS
10+
#define PYTHON_BINDINGS_TRANSFORM_ATTRS
11+
12+
include "mlir/Dialect/Transform/IR/TransformAttrs.td"
13+
14+
#endif // PYTHON_BINDINGS_TRANSFORM_ATTRS
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//===-- VectorTransformsBase.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+
// Entry point of the Python bindings generator for the vector transform ops.
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
14+
#ifndef PYTHON_BINDINGS_VECTORTRANSFORMBASE
15+
#define PYTHON_BINDINGS_VECTORTRANSFORMBASE
16+
17+
include "mlir/Dialect/Vector/Transforms/VectorTransformsBase.td"
18+
19+
#endif // PYTHON_BINDINGS_VECTORTRANSFORMBASE

utils/bazel/llvm-project-overlay/mlir/python/BUILD.bazel

Lines changed: 152 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,13 @@ td_library(
142142
gentbl_filegroup(
143143
name = "AMDGPUOpsPyGen",
144144
tbl_outs = [
145+
(
146+
[
147+
"-gen-python-enum-bindings",
148+
"-bind-dialect=amdgpu",
149+
],
150+
"mlir/dialects/_amdgpu_enum_gen.py",
151+
),
145152
(
146153
[
147154
"-gen-python-op-bindings",
@@ -184,6 +191,13 @@ td_library(
184191
gentbl_filegroup(
185192
name = "LinalgOpsPyGen",
186193
tbl_outs = [
194+
(
195+
[
196+
"-gen-python-enum-bindings",
197+
"-bind-dialect=linalg",
198+
],
199+
"mlir/dialects/_linalg_enum_gen.py",
200+
),
187201
(
188202
[
189203
"-gen-python-op-bindings",
@@ -232,13 +246,58 @@ filegroup(
232246
srcs = glob(["mlir/dialects/linalg/passes/*.py"]),
233247
)
234248

249+
##---------------------------------------------------------------------------##
250+
# LLVM dialect.
251+
##---------------------------------------------------------------------------##
252+
253+
gentbl_filegroup(
254+
name = "LLVMOpsPyGen",
255+
tbl_outs = [
256+
(
257+
[
258+
"-gen-python-enum-bindings",
259+
"-bind-dialect=llvm",
260+
],
261+
"mlir/dialects/_llvm_enum_gen.py",
262+
),
263+
(
264+
[
265+
"-gen-python-op-bindings",
266+
"-bind-dialect=llvm",
267+
],
268+
"mlir/dialects/_llvm_ops_gen.py",
269+
),
270+
],
271+
tblgen = "//mlir:mlir-tblgen",
272+
td_file = "mlir/dialects/LLVMOps.td",
273+
deps = [
274+
"//mlir:LLVMOpsTdFiles",
275+
"//mlir:OpBaseTdFiles",
276+
],
277+
)
278+
279+
filegroup(
280+
name = "LLVMOpsPyFiles",
281+
srcs = [
282+
"mlir/dialects/llvm.py",
283+
":LLVMOpsPyGen",
284+
],
285+
)
286+
235287
##---------------------------------------------------------------------------##
236288
# Arith dialect.
237289
##---------------------------------------------------------------------------##
238290

239291
gentbl_filegroup(
240292
name = "ArithOpsPyGen",
241293
tbl_outs = [
294+
(
295+
[
296+
"-gen-python-enum-bindings",
297+
"-bind-dialect=arith",
298+
],
299+
"mlir/dialects/_arith_enum_gen.py",
300+
),
242301
(
243302
[
244303
"-gen-python-op-bindings",
@@ -274,11 +333,30 @@ td_library(
274333
includes = ["../include"],
275334
deps = [
276335
"//mlir:BufferizableOpInterfaceTdFiles",
336+
"//mlir:BufferizationEnumsTdFiles
277337
"//mlir:BufferizationOpsTdFiles",
278338
"//mlir:OpBaseTdFiles",
279339
],
280340
)
281341

342+
gentbl_filegroup(
343+
name = "BufferizationEnumPyGen",
344+
tbl_outs = [
345+
(
346+
[
347+
"-gen-python-enum-bindings",
348+
"-bind-dialect=bufferization",
349+
],
350+
"mlir/dialects/_bufferization_enum_gen.py",
351+
),
352+
],
353+
tblgen = "//mlir:mlir-tblgen",
354+
td_file = "mlir/dialects/BufferizationEnums.td",
355+
deps = [
356+
":BufferizationOpsPyTdFiles",
357+
],
358+
)
359+
282360
gentbl_filegroup(
283361
name = "BufferizationOpsPyGen",
284362
tbl_outs = [
@@ -302,6 +380,7 @@ filegroup(
302380
srcs = [
303381
"mlir/dialects/_bufferization_ops_ext.py",
304382
"mlir/dialects/bufferization.py",
383+
":BufferizationEnumPyGen",
305384
":BufferizationOpsPyGen",
306385
],
307386
)
@@ -568,6 +647,13 @@ td_library(
568647
gentbl_filegroup(
569648
name = "NVGPUOpsPyGen",
570649
tbl_outs = [
650+
(
651+
[
652+
"-gen-python-enum-bindings",
653+
"-bind-dialect=nvgpu",
654+
],
655+
"mlir/dialects/_nvgpu_enum_gen.py",
656+
),
571657
(
572658
[
573659
"-gen-python-op-bindings",
@@ -608,6 +694,13 @@ td_library(
608694
gentbl_filegroup(
609695
name = "NVVMOpsPyGen",
610696
tbl_outs = [
697+
(
698+
[
699+
"-gen-python-enum-bindings",
700+
"-bind-dialect=nvvm",
701+
],
702+
"mlir/dialects/_nvvm_enum_gen.py",
703+
),
611704
(
612705
[
613706
"-gen-python-op-bindings",
@@ -790,6 +883,24 @@ td_library(
790883
],
791884
)
792885

886+
gentbl_filegroup(
887+
name = "SparseTensorEnumPyGen",
888+
tbl_outs = [
889+
(
890+
[
891+
"-gen-python-enum-bindings",
892+
"-bind-dialect=sparse_tensor",
893+
],
894+
"mlir/dialects/_sparse_tensor_enum_gen.py",
895+
),
896+
],
897+
tblgen = "//mlir:mlir-tblgen",
898+
td_file = "mlir/dialects/SparseTensorAttrDefs.td",
899+
deps = [
900+
":SparseTensorOpsPyTdFiles",
901+
],
902+
)
903+
793904
gentbl_filegroup(
794905
name = "SparseTensorOpsPyGen",
795906
tbl_outs = [
@@ -812,6 +923,7 @@ filegroup(
812923
name = "SparseTensorOpsPyFiles",
813924
srcs = [
814925
"mlir/dialects/sparse_tensor.py",
926+
":SparseTensorEnumPyGen",
815927
":SparseTensorOpsPyGen",
816928
],
817929
)
@@ -897,12 +1009,15 @@ gentbl_filegroup(
8971009
name = "TransformEnumPyGen",
8981010
tbl_outs = [
8991011
(
900-
["-gen-python-enum-bindings"],
1012+
[
1013+
"-gen-python-enum-bindings",
1014+
"-bind-dialect=transform",
1015+
],
9011016
"mlir/dialects/_transform_enum_gen.py",
9021017
),
9031018
],
9041019
tblgen = "//mlir:mlir-tblgen",
905-
td_file = "mlir/dialects/TransformOps.td",
1020+
td_file = "mlir/dialects/TransformAttrs.td",
9061021
deps = [
9071022
"//mlir:CallInterfacesTdFiles",
9081023
"//mlir:FunctionInterfacesTdFiles",
@@ -935,13 +1050,6 @@ gentbl_filegroup(
9351050
gentbl_filegroup(
9361051
name = "BufferizationTransformOpsPyGen",
9371052
tbl_outs = [
938-
(
939-
[
940-
"-gen-python-enum-bindings",
941-
"-bind-dialect=transform",
942-
],
943-
"mlir/dialects/_bufferization_transform_enum_gen.py",
944-
),
9451053
(
9461054
[
9471055
"-gen-python-op-bindings",
@@ -981,6 +1089,28 @@ gentbl_filegroup(
9811089
],
9821090
)
9831091

1092+
gentbl_filegroup(
1093+
name = "StructureTransformEnumPyGen",
1094+
tbl_outs = [
1095+
(
1096+
[
1097+
"-gen-python-enum-bindings",
1098+
"-bind-dialect=transform",
1099+
],
1100+
"mlir/dialects/_structure_transform_enum_gen.py",
1101+
),
1102+
],
1103+
tblgen = "//mlir:mlir-tblgen",
1104+
td_file = "mlir/dialects/LinalgStructuredTransformEnums.td",
1105+
deps = [
1106+
"//mlir:CallInterfacesTdFiles",
1107+
"//mlir:FunctionInterfacesTdFiles",
1108+
"//mlir:LinalgTransformOpsTdFiles",
1109+
"//mlir:OpBaseTdFiles",
1110+
"//mlir:TransformDialectTdFiles",
1111+
],
1112+
)
1113+
9841114
gentbl_filegroup(
9851115
name = "StructuredTransformOpsPyGen",
9861116
tbl_outs = [
@@ -1092,12 +1222,15 @@ gentbl_filegroup(
10921222
name = "VectorTransformEnumPyGen",
10931223
tbl_outs = [
10941224
(
1095-
["-gen-python-enum-bindings"],
1225+
[
1226+
"-gen-python-enum-bindings",
1227+
"-bind-dialect=transform",
1228+
],
10961229
"mlir/dialects/_vector_transform_enum_gen.py",
10971230
),
10981231
],
10991232
tblgen = "//mlir:mlir-tblgen",
1100-
td_file = "mlir/dialects/VectorTransformOps.td",
1233+
td_file = "mlir/dialects/VectorTransformsBase.td",
11011234
deps = [
11021235
"//mlir:OpBaseTdFiles",
11031236
"//mlir:TransformDialectTdFiles",
@@ -1143,6 +1276,7 @@ filegroup(
11431276
":LoopTransformOpsPyGen",
11441277
":MemRefTransformOpsPyGen",
11451278
":PDLTransformOpsPyGen",
1279+
":StructureTransformEnumPyGen",
11461280
":StructuredTransformOpsPyGen",
11471281
":TensorTransformOpsPyGen",
11481282
":TransformEnumPyGen",
@@ -1164,6 +1298,13 @@ filegroup(
11641298
gentbl_filegroup(
11651299
name = "VectorOpsPyGen",
11661300
tbl_outs = [
1301+
(
1302+
[
1303+
"-gen-python-enum-bindings",
1304+
"-bind-dialect=vector",
1305+
],
1306+
"mlir/dialects/_vector_enum_gen.py",
1307+
),
11671308
(
11681309
[
11691310
"-gen-python-op-bindings",

0 commit comments

Comments
 (0)