[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.
This commit is contained in:
parent
9d5e6ccd9b
commit
d5c29b23e1
|
|
@ -12,7 +12,6 @@
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "mlir/ExecutionEngine/Float16bits.h"
|
#include "mlir/ExecutionEngine/Float16bits.h"
|
||||||
#include "llvm/Support/Compiler.h"
|
|
||||||
|
|
||||||
namespace {
|
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
|
// Provide a float->bfloat conversion routine in case the runtime doesn't have
|
||||||
// one.
|
// 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);
|
return float2bfloat(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Provide a double->bfloat conversion routine in case the runtime doesn't have
|
// Provide a double->bfloat conversion routine in case the runtime doesn't have
|
||||||
// one.
|
// 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
|
// This does a double rounding step, but it's precise enough for our use
|
||||||
// cases.
|
// cases.
|
||||||
return __truncsfbf2(static_cast<float>(d));
|
return __truncsfbf2(static_cast<float>(d));
|
||||||
|
|
|
||||||
|
|
@ -2226,14 +2226,14 @@ cc_library(
|
||||||
"lib/Dialect/NVGPU/Transforms/PassDetail.h",
|
"lib/Dialect/NVGPU/Transforms/PassDetail.h",
|
||||||
],
|
],
|
||||||
hdrs = [
|
hdrs = [
|
||||||
"include/mlir/Dialect/NVGPU/Transforms/Transforms.h",
|
|
||||||
"include/mlir/Dialect/NVGPU/Passes.h",
|
"include/mlir/Dialect/NVGPU/Passes.h",
|
||||||
|
"include/mlir/Dialect/NVGPU/Transforms/Transforms.h",
|
||||||
],
|
],
|
||||||
includes = ["include"],
|
includes = ["include"],
|
||||||
deps = [
|
deps = [
|
||||||
":FuncDialect",
|
|
||||||
":AffineDialect",
|
":AffineDialect",
|
||||||
":ArithmeticDialect",
|
":ArithmeticDialect",
|
||||||
|
":FuncDialect",
|
||||||
":GPUDialect",
|
":GPUDialect",
|
||||||
":IR",
|
":IR",
|
||||||
":MemRefDialect",
|
":MemRefDialect",
|
||||||
|
|
@ -6264,8 +6264,8 @@ cc_library(
|
||||||
":MemRefTransforms",
|
":MemRefTransforms",
|
||||||
":NVGPUDialect",
|
":NVGPUDialect",
|
||||||
":NVGPUPassIncGen",
|
":NVGPUPassIncGen",
|
||||||
":NVGPUTransforms",
|
|
||||||
":NVGPUToNVVM",
|
":NVGPUToNVVM",
|
||||||
|
":NVGPUTransforms",
|
||||||
":NVVMDialect",
|
":NVVMDialect",
|
||||||
":OpenACCDialect",
|
":OpenACCDialect",
|
||||||
":OpenMPDialect",
|
":OpenMPDialect",
|
||||||
|
|
@ -6409,9 +6409,6 @@ cc_library(
|
||||||
"include/mlir/ExecutionEngine/SparseTensorUtils.h",
|
"include/mlir/ExecutionEngine/SparseTensorUtils.h",
|
||||||
],
|
],
|
||||||
includes = ["include"],
|
includes = ["include"],
|
||||||
deps = [
|
|
||||||
"//llvm:Support",
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue