[llvm] [Bazel] Add Bazel build files for Python bindings of the GPU dialect (PR #73256)

Adam Paszke via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 23 09:30:46 PST 2023


https://github.com/apaszke created https://github.com/llvm/llvm-project/pull/73256

None

>From 9cdf7872f5f81d07b13630f3885de358818db99b Mon Sep 17 00:00:00 2001
From: Adam Paszke <apaszke at google.com>
Date: Thu, 23 Nov 2023 17:02:35 +0000
Subject: [PATCH] [Bazel] Add Bazel build files for Python bindings of the GPU
 dialect

---
 .../mlir/python/BUILD.bazel                   | 56 +++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/utils/bazel/llvm-project-overlay/mlir/python/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/python/BUILD.bazel
index 348ee2beabeb061..a2f270b0ebb7958 100644
--- a/utils/bazel/llvm-project-overlay/mlir/python/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/python/BUILD.bazel
@@ -699,6 +699,62 @@ filegroup(
     ],
 )
 
+##---------------------------------------------------------------------------##
+# GPU dialect.
+##---------------------------------------------------------------------------##
+
+td_library(
+    name = "GPUOpsPyTdFiles",
+    srcs = [],
+    includes = ["../include"],
+    deps = [
+        "//mlir:GPUOpsTdFiles",
+        "//mlir:OpBaseTdFiles",
+    ],
+)
+
+gentbl_filegroup(
+    name = "GPUOpsPyGen",
+    tbl_outs = [
+        (
+            [
+                "-gen-python-enum-bindings",
+                "-bind-dialect=gpu",
+            ],
+            "mlir/dialects/_gpu_enum_gen.py",
+        ),
+        (
+            [
+                "-gen-python-op-bindings",
+                "-bind-dialect=gpu",
+            ],
+            "mlir/dialects/_gpu_ops_gen.py",
+        ),
+    ],
+    tblgen = "//mlir:mlir-tblgen",
+    td_file = "mlir/dialects/GPUOps.td",
+    deps = [
+        ":GPUOpsPyTdFiles",
+    ],
+)
+
+filegroup(
+    name = "GPUOpsPyFiles",
+    srcs = [
+        ":GPUOpsPyGen",
+    ],
+)
+
+filegroup(
+    name = "GPUOpsPackagePyFiles",
+    srcs = glob(["mlir/dialects/gpu/*.py"]),
+)
+
+filegroup(
+    name = "GPUOpsPackagePassesPyFiles",
+    srcs = glob(["mlir/dialects/gpu/passes/*.py"]),
+)
+
 ##---------------------------------------------------------------------------##
 # NVGPU dialect.
 ##---------------------------------------------------------------------------##



More information about the llvm-commits mailing list