From b9959590d42565cd9df8e6114075cf677aef8836 Mon Sep 17 00:00:00 2001 From: Alex Zinenko Date: Mon, 21 Mar 2022 15:28:11 +0100 Subject: [PATCH] [mlir][bazel] filegroups for Python CF, PDL, Tensor dialects These dialects have Python bindings and are tested, but were not previously exposed through Bazel filegroups. Differential Revision: https://reviews.llvm.org/D122138 --- .../llvm-project-overlay/mlir/python/BUILD.bazel | 87 +++++++++++++++++++++- 1 file changed, 83 insertions(+), 4 deletions(-) diff --git a/utils/bazel/llvm-project-overlay/mlir/python/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/python/BUILD.bazel index f322f3d..261bf53 100644 --- a/utils/bazel/llvm-project-overlay/mlir/python/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/mlir/python/BUILD.bazel @@ -11,9 +11,7 @@ load("//mlir:tblgen.bzl", "gentbl_filegroup", "td_library") package( - default_visibility = [ - "//visibility:public", - ], + default_visibility = ["//visibility:public"], licenses = ["notice"], ) @@ -255,6 +253,47 @@ filegroup( ) ##---------------------------------------------------------------------------## +# ControlFlow dialect. +##---------------------------------------------------------------------------## + +td_library( + name = "ControlFlowOpsPyTdFiles", + srcs = [ + "//mlir:include/mlir/Bindings/Python/Attributes.td", + ], + deps = [ + "//mlir:ControlFlowOpsTdFiles", + "//mlir:OpBaseTdFiles", + ], +) + +gentbl_filegroup( + name = "ControlFlowOpsPyGen", + tbl_outs = [ + ( + [ + "-gen-python-op-bindings", + "-bind-dialect=cf", + ], + "mlir/dialects/_cf_ops_gen.py", + ), + ], + tblgen = "//mlir:mlir-tblgen", + td_file = "mlir/dialects/ControlFlowOps.td", + deps = [ + ":ControlFlowOpsPyTdFiles", + ], +) + +filegroup( + name = "ControlFlowOpsPyFiles", + srcs = [ + "mlir/dialects/cf.py", + ":ControlFlowOpsPyGen", + ], +) + +##---------------------------------------------------------------------------## # Math dialect. ##---------------------------------------------------------------------------## @@ -449,7 +488,6 @@ filegroup( ], ) - ##---------------------------------------------------------------------------## # SCF dialect. ##---------------------------------------------------------------------------## @@ -619,6 +657,47 @@ filegroup( ) ##---------------------------------------------------------------------------## +# Tensor dialect. +##---------------------------------------------------------------------------## + +td_library( + name = "TensorOpsPyTdFiles", + srcs = [ + "//mlir:include/mlir/Bindings/Python/Attributes.td", + ], + deps = [ + "//mlir:OpBaseTdFiles", + "//mlir:TensorOpsTdFiles", + ], +) + +gentbl_filegroup( + name = "TensorOpsPyGen", + tbl_outs = [ + ( + [ + "-gen-python-op-bindings", + "-bind-dialect=tensor", + ], + "mlir/dialects/_tensor_ops_gen.py", + ), + ], + tblgen = "//mlir:mlir-tblgen", + td_file = "mlir/dialects/TensorOps.td", + deps = [ + ":TensorOpsPyTdFiles", + ], +) + +filegroup( + name = "TensorOpsPyFiles", + srcs = [ + "mlir/dialects/tensor.py", + ":TensorOpsPyGen", + ], +) + +##---------------------------------------------------------------------------## # Tosa dialect. ##---------------------------------------------------------------------------## -- 2.7.4