Skip to content

Commit

Permalink
MLIR BUILD.bazel: fold BasicPtxBuilderInterface into NVVMDialect (l…
Browse files Browse the repository at this point in the history
…lvm#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 <jacob.benoit.1@gmail.com>
  • Loading branch information
bjacob authored Oct 4, 2024
1 parent 87c799a commit dd04cf0
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"],
Expand Down

0 comments on commit dd04cf0

Please sign in to comment.