[Mlir-commits] [mlir] d5c29b2 - [mlir][sparse] Inline the definition of LLVM_ATTRIBUTE_WEAK
Benjamin Kramer
llvmlistbot at llvm.org
Fri Jun 17 13:41:16 PDT 2022
Author: Benjamin Kramer
Date: 2022-06-17T22:41:10+02:00
New Revision: d5c29b23e1d483d7f0309b444e6043a9149ea36e
URL: https://github.com/llvm/llvm-project/commit/d5c29b23e1d483d7f0309b444e6043a9149ea36e
DIFF: https://github.com/llvm/llvm-project/commit/d5c29b23e1d483d7f0309b444e6043a9149ea36e.diff
LOG: [mlir][sparse] Inline the definition of LLVM_ATTRIBUTE_WEAK
This library is supposed not to have a dependency on LLVM, and linking
LLVMSupport into it breaks its shared library setup.
Added:
Modified:
mlir/lib/ExecutionEngine/Float16bits.cpp
utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
Removed:
################################################################################
diff --git a/mlir/lib/ExecutionEngine/Float16bits.cpp b/mlir/lib/ExecutionEngine/Float16bits.cpp
index c376022c69dc..6ee2e41b0497 100644
--- a/mlir/lib/ExecutionEngine/Float16bits.cpp
+++ b/mlir/lib/ExecutionEngine/Float16bits.cpp
@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===//
#include "mlir/ExecutionEngine/Float16bits.h"
-#include "llvm/Support/Compiler.h"
namespace {
@@ -145,13 +144,23 @@ std::ostream &operator<<(std::ostream &os, const bf16 &d) {
// Provide a float->bfloat conversion routine in case the runtime doesn't have
// one.
-extern "C" uint16_t LLVM_ATTRIBUTE_WEAK __truncsfbf2(float f) {
+extern "C" uint16_t
+#if defined(__has_attribute) && __has_attribute(weak) && \
+ !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(_WIN32)
+ __attribute__((__weak__))
+#endif
+ __truncsfbf2(float f) {
return float2bfloat(f);
}
// Provide a double->bfloat conversion routine in case the runtime doesn't have
// one.
-extern "C" uint16_t LLVM_ATTRIBUTE_WEAK __truncdfbf2(double d) {
+extern "C" uint16_t
+#if defined(__has_attribute) && __has_attribute(weak) && \
+ !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(_WIN32)
+ __attribute__((__weak__))
+#endif
+ __truncdfbf2(double d) {
// This does a double rounding step, but it's precise enough for our use
// cases.
return __truncsfbf2(static_cast<float>(d));
diff --git a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
index 0ce55210ed31..cdcac1e8b417 100644
--- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
@@ -2226,14 +2226,14 @@ cc_library(
"lib/Dialect/NVGPU/Transforms/PassDetail.h",
],
hdrs = [
- "include/mlir/Dialect/NVGPU/Transforms/Transforms.h",
"include/mlir/Dialect/NVGPU/Passes.h",
+ "include/mlir/Dialect/NVGPU/Transforms/Transforms.h",
],
includes = ["include"],
deps = [
- ":FuncDialect",
":AffineDialect",
":ArithmeticDialect",
+ ":FuncDialect",
":GPUDialect",
":IR",
":MemRefDialect",
@@ -6264,8 +6264,8 @@ cc_library(
":MemRefTransforms",
":NVGPUDialect",
":NVGPUPassIncGen",
- ":NVGPUTransforms",
":NVGPUToNVVM",
+ ":NVGPUTransforms",
":NVVMDialect",
":OpenACCDialect",
":OpenMPDialect",
@@ -6409,9 +6409,6 @@ cc_library(
"include/mlir/ExecutionEngine/SparseTensorUtils.h",
],
includes = ["include"],
- deps = [
- "//llvm:Support",
- ],
)
cc_library(
More information about the Mlir-commits
mailing list