1 # This file is licensed 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
6 # Python bindings for MLIR.
8 # We define separate filegroups for files in different directories so
9 # that downstream users can mirror the tree in their own py_library() rules.
11 load("//mlir:tblgen.bzl", "gentbl_filegroup", "td_library")
14 default_visibility = [
15 "//visibility:public",
17 licenses = ["notice"],
20 ##---------------------------------------------------------------------------##
22 ##---------------------------------------------------------------------------##
25 name = "ConversionsPyFiles",
27 "mlir/conversions/*.py",
32 name = "DialectCorePyFiles",
34 "mlir/dialects/_ods_common.py",
39 name = "ExecutionEnginePyFiles",
41 "mlir/execution_engine.py",
53 name = "PassManagerPyFiles",
55 "mlir/passmanager.py",
60 name = "RuntimePyFiles",
67 name = "TransformsPyFiles",
69 "mlir/transforms/*.py",
74 name = "AllPassesRegistrationPyFiles",
76 "mlir/all_passes_registration/*.py",
80 ##---------------------------------------------------------------------------##
82 ##---------------------------------------------------------------------------##
85 name = "BuiltinOpsPyTdFiles",
87 "mlir/dialects/BuiltinOps.td",
88 "//mlir:include/mlir/Bindings/Python/Attributes.td",
91 "//mlir:BuiltinDialectTdFiles",
92 "//mlir:FunctionInterfacesTdFiles",
93 "//mlir:OpBaseTdFiles",
98 name = "BuiltinOpsPyGen",
102 "-gen-python-op-bindings",
103 "-bind-dialect=builtin",
105 "mlir/dialects/_builtin_ops_gen.py",
108 tblgen = "//mlir:mlir-tblgen",
109 td_file = "mlir/dialects/BuiltinOps.td",
111 ":BuiltinOpsPyTdFiles",
116 name = "BuiltinOpsPyFiles",
118 "mlir/dialects/_builtin_ops_ext.py",
119 "mlir/dialects/builtin.py",
124 ##---------------------------------------------------------------------------##
126 ##---------------------------------------------------------------------------##
129 name = "LinalgOpsPyTdFiles",
131 "mlir/dialects/LinalgOps.td",
132 "//mlir:include/mlir/Bindings/Python/Attributes.td",
135 "//mlir:LinalgOpsTdFiles",
136 "//mlir:LinalgStructuredOpsTdFiles",
137 "//mlir:OpBaseTdFiles",
142 name = "LinalgOpsPyGen",
146 "-gen-python-op-bindings",
147 "-bind-dialect=linalg",
149 "mlir/dialects/_linalg_ops_gen.py",
152 tblgen = "//mlir:mlir-tblgen",
153 td_file = "mlir/dialects/LinalgOps.td",
155 ":LinalgOpsPyTdFiles",
160 name = "LinalgOpsPyFiles",
162 "mlir/dialects/_linalg_ops_ext.py",
168 name = "LinalgOpsPackagePyFiles",
169 srcs = glob(["mlir/dialects/linalg/*.py"]),
173 name = "LinalgOpsPackageOpDSLPyFiles",
174 srcs = glob(["mlir/dialects/linalg/opdsl/*.py"]),
178 name = "LinalgOpsPackageOpDSLLangPyFiles",
179 srcs = glob(["mlir/dialects/linalg/opdsl/lang/*.py"]),
183 name = "LinalgOpsPackageOpDSLOpsPyFiles",
184 srcs = glob(["mlir/dialects/linalg/opdsl/ops/*.py"]),
188 name = "LinalgOpsPackagePassesPyFiles",
189 srcs = glob(["mlir/dialects/linalg/passes/*.py"]),
192 ##---------------------------------------------------------------------------##
193 # Arithmetic dialect.
194 ##---------------------------------------------------------------------------##
197 name = "ArithmeticOpsPyTdFiles",
199 "//mlir:include/mlir/Bindings/Python/Attributes.td",
201 includes = ["../include"],
203 "//mlir:ArithmeticOpsTdFiles",
204 "//mlir:OpBaseTdFiles",
209 name = "ArithmeticOpsPyGen",
213 "-gen-python-op-bindings",
214 "-bind-dialect=arith",
216 "mlir/dialects/_arith_ops_gen.py",
219 tblgen = "//mlir:mlir-tblgen",
220 td_file = "mlir/dialects/ArithmeticOps.td",
222 ":ArithmeticOpsPyTdFiles",
227 name = "ArithmeticOpsPyFiles",
229 "mlir/dialects/_arith_ops_ext.py",
230 "mlir/dialects/arith.py",
231 ":ArithmeticOpsPyGen",
235 ##---------------------------------------------------------------------------##
237 ##---------------------------------------------------------------------------##
240 name = "MathOpsPyTdFiles",
242 "//mlir:include/mlir/Bindings/Python/Attributes.td",
244 includes = ["../include"],
246 "//mlir:MathOpsTdFiles",
247 "//mlir:OpBaseTdFiles",
252 name = "MathOpsPyGen",
256 "-gen-python-op-bindings",
257 "-bind-dialect=math",
259 "mlir/dialects/_math_ops_gen.py",
262 tblgen = "//mlir:mlir-tblgen",
263 td_file = "mlir/dialects/MathOps.td",
270 name = "MathOpsPyFiles",
272 "mlir/dialects/math.py",
277 ##---------------------------------------------------------------------------##
279 ##---------------------------------------------------------------------------##
282 name = "MemRefOpsPyTdFiles",
284 "//mlir:include/mlir/Bindings/Python/Attributes.td",
286 includes = ["../include"],
288 "//mlir:MemRefOpsTdFiles",
289 "//mlir:OpBaseTdFiles",
294 name = "MemRefOpsPyGen",
298 "-gen-python-op-bindings",
299 "-bind-dialect=memref",
301 "mlir/dialects/_memref_ops_gen.py",
304 tblgen = "//mlir:mlir-tblgen",
305 td_file = "mlir/dialects/MemRefOps.td",
307 ":MemRefOpsPyTdFiles",
312 name = "MemRefOpsPyFiles",
314 "mlir/dialects/_memref_ops_ext.py",
315 "mlir/dialects/memref.py",
320 ##---------------------------------------------------------------------------##
322 ##---------------------------------------------------------------------------##
325 name = "QuantPyFiles",
327 "mlir/dialects/quant.py",
331 ##---------------------------------------------------------------------------##
332 # PythonTest dialect.
333 ##---------------------------------------------------------------------------##
336 name = "PythonTestPyTdFiles",
338 "//mlir:include/mlir/Bindings/Python/Attributes.td",
341 "//mlir:InferTypeOpInterfaceTdFiles",
342 "//mlir:OpBaseTdFiles",
347 name = "PythonTestPyGen",
351 "-gen-python-op-bindings",
352 "-bind-dialect=python_test",
354 "mlir/dialects/_python_test_ops_gen.py",
357 tblgen = "//mlir:mlir-tblgen",
358 td_file = "//mlir/test/python:python_test_ops.td",
360 ":PythonTestPyTdFiles",
365 name = "PythonTestPyFiles",
367 "mlir/dialects/python_test.py",
372 ##---------------------------------------------------------------------------##
374 ##---------------------------------------------------------------------------##
377 name = "SCFPyTdFiles",
379 "//mlir:include/mlir/Bindings/Python/Attributes.td",
381 includes = ["../include"],
383 "//mlir:OpBaseTdFiles",
393 "-gen-python-op-bindings",
396 "mlir/dialects/_scf_ops_gen.py",
399 tblgen = "//mlir:mlir-tblgen",
400 td_file = "mlir/dialects/SCFOps.td",
409 "mlir/dialects/_scf_ops_ext.py",
410 "mlir/dialects/scf.py",
415 ##---------------------------------------------------------------------------##
417 ##---------------------------------------------------------------------------##
420 name = "ShapeOpsPyTdFiles",
422 "//mlir:include/mlir/Bindings/Python/Attributes.td",
424 includes = ["../include"],
426 "//mlir:OpBaseTdFiles",
427 "//mlir:ShapeOpsTdFiles",
432 name = "ShapeOpsPyGen",
436 "-gen-python-op-bindings",
437 "-bind-dialect=shape",
439 "mlir/dialects/_shape_ops_gen.py",
442 tblgen = "//mlir:mlir-tblgen",
443 td_file = "mlir/dialects/ShapeOps.td",
445 ":ShapeOpsPyTdFiles",
450 name = "ShapeOpsPyFiles",
452 "mlir/dialects/shape.py",
457 ##---------------------------------------------------------------------------##
459 ##---------------------------------------------------------------------------##
462 name = "StandardOpsPyTdFiles",
464 "//mlir:include/mlir/Bindings/Python/Attributes.td",
467 "//mlir:OpBaseTdFiles",
468 "//mlir:StdOpsTdFiles",
473 name = "StandardOpsPyGen",
477 "-gen-python-op-bindings",
480 "mlir/dialects/_std_ops_gen.py",
483 tblgen = "//mlir:mlir-tblgen",
484 td_file = "mlir/dialects/StandardOps.td",
486 ":StandardOpsPyTdFiles",
491 name = "StandardOpsPyFiles",
493 "mlir/dialects/_std_ops_ext.py",
494 "mlir/dialects/std.py",
499 ##---------------------------------------------------------------------------##
500 # SparseTensor dialect.
501 ##---------------------------------------------------------------------------##
504 name = "SparseTensorOpsPyTdFiles",
506 "//mlir:include/mlir/Bindings/Python/Attributes.td",
509 "//mlir:OpBaseTdFiles",
510 "//mlir:SparseTensorTdFiles",
515 name = "SparseTensorOpsPyGen",
519 "-gen-python-op-bindings",
520 "-bind-dialect=sparse_tensor",
522 "mlir/dialects/_sparse_tensor_ops_gen.py",
525 tblgen = "//mlir:mlir-tblgen",
526 td_file = "mlir/dialects/SparseTensorOps.td",
528 ":SparseTensorOpsPyTdFiles",
533 name = "SparseTensorOpsPyFiles",
535 "mlir/dialects/sparse_tensor.py",
536 ":SparseTensorOpsPyGen",
540 ##---------------------------------------------------------------------------##
542 ##---------------------------------------------------------------------------##
545 name = "TosaOpsPyTdFiles",
547 "//mlir:include/mlir/Bindings/Python/Attributes.td",
550 "//mlir:OpBaseTdFiles",
551 "//mlir:TosaDialectTdFiles",
556 name = "TosaOpsPyGen",
560 "-gen-python-op-bindings",
561 "-bind-dialect=tosa",
563 "mlir/dialects/_tosa_ops_gen.py",
566 tblgen = "//mlir:mlir-tblgen",
567 td_file = "mlir/dialects/TosaOps.td",
574 name = "TosaOpsPyFiles",
576 "mlir/dialects/tosa.py",
581 ##---------------------------------------------------------------------------##
583 ##---------------------------------------------------------------------------##
586 name = "VectorOpsPyTdFiles",
588 "//mlir:include/mlir/Bindings/Python/Attributes.td",
590 includes = ["../include"],
592 "//mlir:OpBaseTdFiles",
593 "//mlir:VectorOpsTdFiles",
598 name = "VectorOpsPyGen",
602 "-gen-python-op-bindings",
603 "-bind-dialect=vector",
605 "mlir/dialects/_vector_ops_gen.py",
608 tblgen = "//mlir:mlir-tblgen",
609 td_file = "mlir/dialects/VectorOps.td",
611 ":VectorOpsPyTdFiles",
616 name = "VectorOpsPyFiles",
618 "mlir/dialects/vector.py",