From dd04cf0c9d97a6d73c832ceb6cd060ec3589876e Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Fri, 4 Oct 2024 12:13:06 -0400 Subject: [PATCH] MLIR BUILD.bazel: fold `BasicPtxBuilderInterface` into `NVVMDialect` (#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. Signed-off-by: Benoit Jacob --- .../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 da1dc002f5782..1c91ede63d0e9 100644 --- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel @@ -6302,11 +6302,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", @@ -6507,21 +6513,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"],