[AMDGPU] Make v8i16/v8f16 legal
[llvm-project.git] / utils / bazel / llvm-project-overlay / mlir / python / BUILD.bazel
blobbc8eaecff2855864e229ee763f8717a47912044f
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
5 # Description:
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")
13 package(
14     default_visibility = [
15         "//visibility:public",
16     ],
17     licenses = ["notice"],
20 ##---------------------------------------------------------------------------##
21 # Core IR modules.
22 ##---------------------------------------------------------------------------##
24 filegroup(
25     name = "ConversionsPyFiles",
26     srcs = glob([
27         "mlir/conversions/*.py",
28     ]),
31 filegroup(
32     name = "DialectCorePyFiles",
33     srcs = [
34         "mlir/dialects/_ods_common.py",
35     ],
38 filegroup(
39     name = "ExecutionEnginePyFiles",
40     srcs = [
41         "mlir/execution_engine.py",
42     ],
45 filegroup(
46     name = "IRPyFiles",
47     srcs = [
48         "mlir/ir.py",
49     ],
52 filegroup(
53     name = "PassManagerPyFiles",
54     srcs = [
55         "mlir/passmanager.py",
56     ],
59 filegroup(
60     name = "RuntimePyFiles",
61     srcs = glob([
62         "mlir/runtime/*.py",
63     ]),
66 filegroup(
67     name = "TransformsPyFiles",
68     srcs = glob([
69         "mlir/transforms/*.py",
70     ]),
73 filegroup(
74     name = "AllPassesRegistrationPyFiles",
75     srcs = glob([
76         "mlir/all_passes_registration/*.py",
77     ]),
80 ##---------------------------------------------------------------------------##
81 # Builtin dialect.
82 ##---------------------------------------------------------------------------##
84 td_library(
85     name = "BuiltinOpsPyTdFiles",
86     srcs = [
87         "mlir/dialects/BuiltinOps.td",
88         "//mlir:include/mlir/Bindings/Python/Attributes.td",
89     ],
90     deps = [
91         "//mlir:BuiltinDialectTdFiles",
92         "//mlir:FunctionInterfacesTdFiles",
93         "//mlir:OpBaseTdFiles",
94     ],
97 gentbl_filegroup(
98     name = "BuiltinOpsPyGen",
99     tbl_outs = [
100         (
101             [
102                 "-gen-python-op-bindings",
103                 "-bind-dialect=builtin",
104             ],
105             "mlir/dialects/_builtin_ops_gen.py",
106         ),
107     ],
108     tblgen = "//mlir:mlir-tblgen",
109     td_file = "mlir/dialects/BuiltinOps.td",
110     deps = [
111         ":BuiltinOpsPyTdFiles",
112     ],
115 filegroup(
116     name = "BuiltinOpsPyFiles",
117     srcs = [
118         "mlir/dialects/_builtin_ops_ext.py",
119         "mlir/dialects/builtin.py",
120         ":BuiltinOpsPyGen",
121     ],
124 ##---------------------------------------------------------------------------##
125 # Linalg dialect.
126 ##---------------------------------------------------------------------------##
128 td_library(
129     name = "LinalgOpsPyTdFiles",
130     srcs = [
131         "mlir/dialects/LinalgOps.td",
132         "//mlir:include/mlir/Bindings/Python/Attributes.td",
133     ],
134     deps = [
135         "//mlir:LinalgOpsTdFiles",
136         "//mlir:LinalgStructuredOpsTdFiles",
137         "//mlir:OpBaseTdFiles",
138     ],
141 gentbl_filegroup(
142     name = "LinalgOpsPyGen",
143     tbl_outs = [
144         (
145             [
146                 "-gen-python-op-bindings",
147                 "-bind-dialect=linalg",
148             ],
149             "mlir/dialects/_linalg_ops_gen.py",
150         ),
151     ],
152     tblgen = "//mlir:mlir-tblgen",
153     td_file = "mlir/dialects/LinalgOps.td",
154     deps = [
155         ":LinalgOpsPyTdFiles",
156     ],
159 filegroup(
160     name = "LinalgOpsPyFiles",
161     srcs = [
162         "mlir/dialects/_linalg_ops_ext.py",
163         ":LinalgOpsPyGen",
164     ],
167 filegroup(
168     name = "LinalgOpsPackagePyFiles",
169     srcs = glob(["mlir/dialects/linalg/*.py"]),
172 filegroup(
173     name = "LinalgOpsPackageOpDSLPyFiles",
174     srcs = glob(["mlir/dialects/linalg/opdsl/*.py"]),
177 filegroup(
178     name = "LinalgOpsPackageOpDSLLangPyFiles",
179     srcs = glob(["mlir/dialects/linalg/opdsl/lang/*.py"]),
182 filegroup(
183     name = "LinalgOpsPackageOpDSLOpsPyFiles",
184     srcs = glob(["mlir/dialects/linalg/opdsl/ops/*.py"]),
187 filegroup(
188     name = "LinalgOpsPackagePassesPyFiles",
189     srcs = glob(["mlir/dialects/linalg/passes/*.py"]),
192 ##---------------------------------------------------------------------------##
193 # Arithmetic dialect.
194 ##---------------------------------------------------------------------------##
196 td_library(
197     name = "ArithmeticOpsPyTdFiles",
198     srcs = [
199         "//mlir:include/mlir/Bindings/Python/Attributes.td",
200     ],
201     includes = ["../include"],
202     deps = [
203         "//mlir:ArithmeticOpsTdFiles",
204         "//mlir:OpBaseTdFiles",
205     ],
208 gentbl_filegroup(
209     name = "ArithmeticOpsPyGen",
210     tbl_outs = [
211         (
212             [
213                 "-gen-python-op-bindings",
214                 "-bind-dialect=arith",
215             ],
216             "mlir/dialects/_arith_ops_gen.py",
217         ),
218     ],
219     tblgen = "//mlir:mlir-tblgen",
220     td_file = "mlir/dialects/ArithmeticOps.td",
221     deps = [
222         ":ArithmeticOpsPyTdFiles",
223     ],
226 filegroup(
227     name = "ArithmeticOpsPyFiles",
228     srcs = [
229         "mlir/dialects/_arith_ops_ext.py",
230         "mlir/dialects/arith.py",
231         ":ArithmeticOpsPyGen",
232     ],
235 ##---------------------------------------------------------------------------##
236 # Math dialect.
237 ##---------------------------------------------------------------------------##
239 td_library(
240     name = "MathOpsPyTdFiles",
241     srcs = [
242         "//mlir:include/mlir/Bindings/Python/Attributes.td",
243     ],
244     includes = ["../include"],
245     deps = [
246         "//mlir:MathOpsTdFiles",
247         "//mlir:OpBaseTdFiles",
248     ],
251 gentbl_filegroup(
252     name = "MathOpsPyGen",
253     tbl_outs = [
254         (
255             [
256                 "-gen-python-op-bindings",
257                 "-bind-dialect=math",
258             ],
259             "mlir/dialects/_math_ops_gen.py",
260         ),
261     ],
262     tblgen = "//mlir:mlir-tblgen",
263     td_file = "mlir/dialects/MathOps.td",
264     deps = [
265         ":MathOpsPyTdFiles",
266     ],
269 filegroup(
270     name = "MathOpsPyFiles",
271     srcs = [
272         "mlir/dialects/math.py",
273         ":MathOpsPyGen",
274     ],
277 ##---------------------------------------------------------------------------##
278 # MemRef dialect.
279 ##---------------------------------------------------------------------------##
281 td_library(
282     name = "MemRefOpsPyTdFiles",
283     srcs = [
284         "//mlir:include/mlir/Bindings/Python/Attributes.td",
285     ],
286     includes = ["../include"],
287     deps = [
288         "//mlir:MemRefOpsTdFiles",
289         "//mlir:OpBaseTdFiles",
290     ],
293 gentbl_filegroup(
294     name = "MemRefOpsPyGen",
295     tbl_outs = [
296         (
297             [
298                 "-gen-python-op-bindings",
299                 "-bind-dialect=memref",
300             ],
301             "mlir/dialects/_memref_ops_gen.py",
302         ),
303     ],
304     tblgen = "//mlir:mlir-tblgen",
305     td_file = "mlir/dialects/MemRefOps.td",
306     deps = [
307         ":MemRefOpsPyTdFiles",
308     ],
311 filegroup(
312     name = "MemRefOpsPyFiles",
313     srcs = [
314         "mlir/dialects/_memref_ops_ext.py",
315         "mlir/dialects/memref.py",
316         ":MemRefOpsPyGen",
317     ],
320 ##---------------------------------------------------------------------------##
321 # Quant dialect.
322 ##---------------------------------------------------------------------------##
324 filegroup(
325     name = "QuantPyFiles",
326     srcs = [
327         "mlir/dialects/quant.py",
328     ],
331 ##---------------------------------------------------------------------------##
332 # PythonTest dialect.
333 ##---------------------------------------------------------------------------##
335 td_library(
336     name = "PythonTestPyTdFiles",
337     srcs = [
338         "//mlir:include/mlir/Bindings/Python/Attributes.td",
339     ],
340     deps = [
341         "//mlir:InferTypeOpInterfaceTdFiles",
342         "//mlir:OpBaseTdFiles",
343     ],
346 gentbl_filegroup(
347     name = "PythonTestPyGen",
348     tbl_outs = [
349         (
350             [
351                 "-gen-python-op-bindings",
352                 "-bind-dialect=python_test",
353             ],
354             "mlir/dialects/_python_test_ops_gen.py",
355         ),
356     ],
357     tblgen = "//mlir:mlir-tblgen",
358     td_file = "//mlir/test/python:python_test_ops.td",
359     deps = [
360         ":PythonTestPyTdFiles",
361     ],
364 filegroup(
365     name = "PythonTestPyFiles",
366     srcs = [
367         "mlir/dialects/python_test.py",
368         ":PythonTestPyGen",
369     ],
372 ##---------------------------------------------------------------------------##
373 # SCF dialect.
374 ##---------------------------------------------------------------------------##
376 td_library(
377     name = "SCFPyTdFiles",
378     srcs = [
379         "//mlir:include/mlir/Bindings/Python/Attributes.td",
380     ],
381     includes = ["../include"],
382     deps = [
383         "//mlir:OpBaseTdFiles",
384         "//mlir:SCFTdFiles",
385     ],
388 gentbl_filegroup(
389     name = "SCFPyGen",
390     tbl_outs = [
391         (
392             [
393                 "-gen-python-op-bindings",
394                 "-bind-dialect=scf",
395             ],
396             "mlir/dialects/_scf_ops_gen.py",
397         ),
398     ],
399     tblgen = "//mlir:mlir-tblgen",
400     td_file = "mlir/dialects/SCFOps.td",
401     deps = [
402         ":SCFPyTdFiles",
403     ],
406 filegroup(
407     name = "SCFPyFiles",
408     srcs = [
409         "mlir/dialects/_scf_ops_ext.py",
410         "mlir/dialects/scf.py",
411         ":SCFPyGen",
412     ],
415 ##---------------------------------------------------------------------------##
416 # Shape dialect.
417 ##---------------------------------------------------------------------------##
419 td_library(
420     name = "ShapeOpsPyTdFiles",
421     srcs = [
422         "//mlir:include/mlir/Bindings/Python/Attributes.td",
423     ],
424     includes = ["../include"],
425     deps = [
426         "//mlir:OpBaseTdFiles",
427         "//mlir:ShapeOpsTdFiles",
428     ],
431 gentbl_filegroup(
432     name = "ShapeOpsPyGen",
433     tbl_outs = [
434         (
435             [
436                 "-gen-python-op-bindings",
437                 "-bind-dialect=shape",
438             ],
439             "mlir/dialects/_shape_ops_gen.py",
440         ),
441     ],
442     tblgen = "//mlir:mlir-tblgen",
443     td_file = "mlir/dialects/ShapeOps.td",
444     deps = [
445         ":ShapeOpsPyTdFiles",
446     ],
449 filegroup(
450     name = "ShapeOpsPyFiles",
451     srcs = [
452         "mlir/dialects/shape.py",
453         ":ShapeOpsPyGen",
454     ],
457 ##---------------------------------------------------------------------------##
458 # Standard dialect.
459 ##---------------------------------------------------------------------------##
461 td_library(
462     name = "StandardOpsPyTdFiles",
463     srcs = [
464         "//mlir:include/mlir/Bindings/Python/Attributes.td",
465     ],
466     deps = [
467         "//mlir:OpBaseTdFiles",
468         "//mlir:StdOpsTdFiles",
469     ],
472 gentbl_filegroup(
473     name = "StandardOpsPyGen",
474     tbl_outs = [
475         (
476             [
477                 "-gen-python-op-bindings",
478                 "-bind-dialect=std",
479             ],
480             "mlir/dialects/_std_ops_gen.py",
481         ),
482     ],
483     tblgen = "//mlir:mlir-tblgen",
484     td_file = "mlir/dialects/StandardOps.td",
485     deps = [
486         ":StandardOpsPyTdFiles",
487     ],
490 filegroup(
491     name = "StandardOpsPyFiles",
492     srcs = [
493         "mlir/dialects/_std_ops_ext.py",
494         "mlir/dialects/std.py",
495         ":StandardOpsPyGen",
496     ],
499 ##---------------------------------------------------------------------------##
500 # SparseTensor dialect.
501 ##---------------------------------------------------------------------------##
503 td_library(
504     name = "SparseTensorOpsPyTdFiles",
505     srcs = [
506         "//mlir:include/mlir/Bindings/Python/Attributes.td",
507     ],
508     deps = [
509         "//mlir:OpBaseTdFiles",
510         "//mlir:SparseTensorTdFiles",
511     ],
514 gentbl_filegroup(
515     name = "SparseTensorOpsPyGen",
516     tbl_outs = [
517         (
518             [
519                 "-gen-python-op-bindings",
520                 "-bind-dialect=sparse_tensor",
521             ],
522             "mlir/dialects/_sparse_tensor_ops_gen.py",
523         ),
524     ],
525     tblgen = "//mlir:mlir-tblgen",
526     td_file = "mlir/dialects/SparseTensorOps.td",
527     deps = [
528         ":SparseTensorOpsPyTdFiles",
529     ],
532 filegroup(
533     name = "SparseTensorOpsPyFiles",
534     srcs = [
535         "mlir/dialects/sparse_tensor.py",
536         ":SparseTensorOpsPyGen",
537     ],
540 ##---------------------------------------------------------------------------##
541 # Tosa dialect.
542 ##---------------------------------------------------------------------------##
544 td_library(
545     name = "TosaOpsPyTdFiles",
546     srcs = [
547         "//mlir:include/mlir/Bindings/Python/Attributes.td",
548     ],
549     deps = [
550         "//mlir:OpBaseTdFiles",
551         "//mlir:TosaDialectTdFiles",
552     ],
555 gentbl_filegroup(
556     name = "TosaOpsPyGen",
557     tbl_outs = [
558         (
559             [
560                 "-gen-python-op-bindings",
561                 "-bind-dialect=tosa",
562             ],
563             "mlir/dialects/_tosa_ops_gen.py",
564         ),
565     ],
566     tblgen = "//mlir:mlir-tblgen",
567     td_file = "mlir/dialects/TosaOps.td",
568     deps = [
569         ":TosaOpsPyTdFiles",
570     ],
573 filegroup(
574     name = "TosaOpsPyFiles",
575     srcs = [
576         "mlir/dialects/tosa.py",
577         ":TosaOpsPyGen",
578     ],
581 ##---------------------------------------------------------------------------##
582 # Vector dialect.
583 ##---------------------------------------------------------------------------##
585 td_library(
586     name = "VectorOpsPyTdFiles",
587     srcs = [
588         "//mlir:include/mlir/Bindings/Python/Attributes.td",
589     ],
590     includes = ["../include"],
591     deps = [
592         "//mlir:OpBaseTdFiles",
593         "//mlir:VectorOpsTdFiles",
594     ],
597 gentbl_filegroup(
598     name = "VectorOpsPyGen",
599     tbl_outs = [
600         (
601             [
602                 "-gen-python-op-bindings",
603                 "-bind-dialect=vector",
604             ],
605             "mlir/dialects/_vector_ops_gen.py",
606         ),
607     ],
608     tblgen = "//mlir:mlir-tblgen",
609     td_file = "mlir/dialects/VectorOps.td",
610     deps = [
611         ":VectorOpsPyTdFiles",
612     ],
615 filegroup(
616     name = "VectorOpsPyFiles",
617     srcs = [
618         "mlir/dialects/vector.py",
619         ":VectorOpsPyGen",
620     ],