From cd482968dca4ab385a4298dfbf17e9d49ccae620 Mon Sep 17 00:00:00 2001 From: Christian Sigg Date: Thu, 22 Jun 2023 07:50:38 +0200 Subject: [PATCH] [Bazel][mlir] Avoid ODR violation introduced in 7ab749c. This change also prepares for 9119325 to land again. Adds `mlir_c_runner_utils_hdrs` and `mlir_runner_utils_hdrs` targets which do not depend on `//llvm::Support`. These can be used by other 'runner.so' targets if they are loaded along with the 'runner_utils.so' without calling `__mlir_execution_engine_init()` twice. --- .../llvm-project-overlay/mlir/BUILD.bazel | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel index 4282bd82e150..479e04e7df68 100644 --- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel @@ -7928,6 +7928,7 @@ cc_library( ":SparseTensorEnums", ":SparseTensorRuntime", ":mlir_float16_utils", + "//llvm:Support", ], ) @@ -7937,6 +7938,11 @@ alias( actual = "_mlir_c_runner_utils", ) +cc_headers_only( + name = "mlir_c_runner_utils_hdrs", + src = ":mlir_c_runner_utils", +) + cc_binary( name = "libmlir_c_runner_utils.so", linkshared = True, @@ -7961,6 +7967,11 @@ alias( actual = "_mlir_runner_utils", ) +cc_headers_only( + name = "mlir_runner_utils_hdrs", + src = ":mlir_runner_utils", +) + cc_binary( name = "libmlir_runner_utils.so", linkshared = True, @@ -8019,7 +8030,7 @@ cc_library( ], deps = [ ":LLVMSupportHeaders", - ":mlir_c_runner_utils", + ":mlir_c_runner_utils_hdrs", "@cuda//:cuda_headers", "@cuda//:cusparse_static", "@cuda//:libcuda", @@ -8071,13 +8082,11 @@ cc_binary( name = "libvulkan-runtime-wrappers.so", srcs = ["tools/mlir-vulkan-runner/vulkan-runtime-wrappers.cpp"], linkshared = True, + linkstatic = False, tags = [ "manual", # External dependency ], - deps = [ - ":VulkanRuntime", - "//llvm:Support", - ], + deps = [":VulkanRuntime"], ) cc_binary(