[mlir][bazel] filegroups for Python CF, PDL, Tensor dialects
authorAlex Zinenko <zinenko@google.com>
Mon, 21 Mar 2022 14:28:11 +0000 (15:28 +0100)
committerAlex Zinenko <zinenko@google.com>
Mon, 21 Mar 2022 14:46:36 +0000 (15:46 +0100)
These dialects have Python bindings and are tested, but were not
previously exposed through Bazel filegroups.

Differential Revision: https://reviews.llvm.org/D122138

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

index f322f3d..261bf53 100644 (file)
@@ -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.
 ##---------------------------------------------------------------------------##