[llvm] MLIR BUILD.bazel: fold `BasicPtxBuilderInterface` into `NVVMDialect` (PR #111172)

Benoit Jacob via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 4 08:25:59 PDT 2024


https://github.com/bjacob created https://github.com/llvm/llvm-project/pull/111172

While doing an integrate into downstream https://github.com/iree-org/iree, I ran into a typical Bazel error with `BasicPtxBuilderInterface.cpp` including `NVVMDialect.h` which was not exposed as a header by a declared dependency.  I tried fixing this the straightforward way, by letting `:BasicPtxBuilderInterface` depend on `:NVVMDialect` , but that caused another Bazel error: circular dependency between these two targets, as `:NVVMDialect` was already depending on `:BasicPtxBuilderInterface`. I tried breaking that circle by dropping the latter dependency, but it was a real dependency in the code, specifically in the TableGen-generated code. So in the end it seems that these two targets just need to be fused, which this PR does.

>From d2fbfeece681bf561f9baf27b920ff83a6d4c9f8 Mon Sep 17 00:00:00 2001
From: Benoit Jacob <jacob.benoit.1 at gmail.com>
Date: Fri, 4 Oct 2024 11:17:09 -0400
Subject: [PATCH] bazel-fix

Signed-off-by: Benoit Jacob <jacob.benoit.1 at gmail.com>
---
 .../llvm-project-overlay/mlir/BUILD.bazel     | 27 +++++++------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
index 0321052225ad45..25e36993e74a4b 100644
--- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
@@ -6301,11 +6301,17 @@ gentbl_cc_library(
 
 cc_library(
     name = "NVVMDialect",
-    srcs = ["lib/Dialect/LLVMIR/IR/NVVMDialect.cpp"],
-    hdrs = ["include/mlir/Dialect/LLVMIR/NVVMDialect.h"],
+    srcs = [
+        "lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp",
+        "lib/Dialect/LLVMIR/IR/NVVMDialect.cpp",
+    ],
+    hdrs = [
+        "include/mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.h",
+        "include/mlir/Dialect/LLVMIR/NVVMDialect.h",
+    ],
     includes = ["include"],
     deps = [
-        ":BasicPtxBuilderInterface",
+        ":BasicPtxBuilderIntGen",
         ":BytecodeOpInterface",
         ":ConvertToLLVMInterface",
         ":DialectUtils",
@@ -6506,21 +6512,6 @@ gentbl_cc_library(
     deps = [":NVVMOpsTdFiles"],
 )
 
-cc_library(
-    name = "BasicPtxBuilderInterface",
-    srcs = ["lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp"],
-    hdrs = [
-        "include/mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.h",
-    ],
-    includes = ["include"],
-    deps = [
-        ":BasicPtxBuilderIntGen",
-        ":IR",
-        ":LLVMDialect",
-        ":Support",
-    ],
-)
-
 cc_library(
     name = "NVVMToLLVM",
     srcs = ["lib/Conversion/NVVMToLLVM/NVVMToLLVM.cpp"],



More information about the llvm-commits mailing list