[llvm] [mlir] Forward **kwargs through gentbl_shard_rule (PR #144001)

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 12 17:18:05 PDT 2025


https://github.com/rnk created https://github.com/llvm/llvm-project/pull/144001

This allows clients to pass additional cc_library arguments through this
macro to the build rules it calls.


>From d7763fb2038e79bd7cf27857b992f3057c712240 Mon Sep 17 00:00:00 2001
From: Reid Kleckner <rnk at google.com>
Date: Fri, 13 Jun 2025 00:17:29 +0000
Subject: [PATCH] [mlir] Forward **kwargs through gentbl_shard_rule

This allows clients to pass additional cc_library arguments through this
macro to the build rules it calls.
---
 utils/bazel/llvm-project-overlay/mlir/tblgen.bzl | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/utils/bazel/llvm-project-overlay/mlir/tblgen.bzl b/utils/bazel/llvm-project-overlay/mlir/tblgen.bzl
index 16a7ecadeaffa..884d6f381b02d 100644
--- a/utils/bazel/llvm-project-overlay/mlir/tblgen.bzl
+++ b/utils/bazel/llvm-project-overlay/mlir/tblgen.bzl
@@ -484,7 +484,8 @@ def gentbl_sharded_ops(
         test = False,
         includes = [],
         strip_include_prefix = None,
-        deps = []):
+        deps = [],
+        **kwargs):
     """Generate sharded op declarations and definitions.
 
     This special build rule shards op definitions in a TableGen file and generates multiple copies
@@ -524,6 +525,7 @@ def gentbl_sharded_ops(
         td_file = td_file,
         test = test,
         deps = deps,
+        **kwargs,
     )
     all_files = [hdr_out, src_out]
     for i in range(0, shard_count):
@@ -535,9 +537,14 @@ def gentbl_sharded_ops(
             out = out_file,
             sharder = sharder,
             src_file = src_file,
+            **kwargs,
         )
         all_files.append(out_file)
-    native.filegroup(name = name, srcs = all_files)
+    native.filegroup(
+        name = name,
+        srcs = all_files,
+        **kwargs,
+    )
 
 def gentbl_sharded_op_defs(name, source_file, shard_count):
     """Generates multiple copies of a source file that includes sharded op definitions.



More information about the llvm-commits mailing list