From: wren romano <2998727+wrengr@users.noreply.github.com> Date: Sat, 8 Oct 2022 01:17:27 +0000 (-0700) Subject: [mlir][sparse] Removing DLL attributes from ExecutionEngine/SparseTensor/Enums.h X-Git-Tag: upstream/17.0.6~31060 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1aa06aeb1a00c8e486a4993cfe56711468b3c5b0;p=platform%2Fupstream%2Fllvm.git [mlir][sparse] Removing DLL attributes from ExecutionEngine/SparseTensor/Enums.h This differential attempts to resolve certain issues on Windows (e.g., https://reviews.llvm.org/D134933#3843372 and https://reviews.llvm.org/D133462#3844195). Reviewed By: stella.stamenova, aganea Differential Revision: https://reviews.llvm.org/D135502 --- diff --git a/mlir/include/mlir/ExecutionEngine/SparseTensor/Enums.h b/mlir/include/mlir/ExecutionEngine/SparseTensor/Enums.h index 14f52a5..1ead713 100644 --- a/mlir/include/mlir/ExecutionEngine/SparseTensor/Enums.h +++ b/mlir/include/mlir/ExecutionEngine/SparseTensor/Enums.h @@ -31,18 +31,6 @@ #include #include -#ifdef _WIN32 -#ifdef mlir_sparse_tensor_utils_EXPORTS // We are building this library -#define MLIR_SPARSETENSOR_EXPORT __declspec(dllexport) -#define MLIR_SPARSETENSOR_DEFINE_FUNCTIONS -#else // We are using this library -#define MLIR_SPARSETENSOR_EXPORT __declspec(dllimport) -#endif // mlir_sparse_tensor_utils_EXPORTS -#else // Non-windows: use visibility attributes. -#define MLIR_SPARSETENSOR_EXPORT __attribute__((visibility("default"))) -#define MLIR_SPARSETENSOR_DEFINE_FUNCTIONS -#endif // _WIN32 - namespace mlir { namespace sparse_tensor { @@ -55,7 +43,7 @@ using index_type = uint64_t; /// Encoding of overhead types (both pointer overhead and indices /// overhead), for "overloading" @newSparseTensor. -enum class MLIR_SPARSETENSOR_EXPORT OverheadType : uint32_t { +enum class OverheadType : uint32_t { kIndex = 0, kU64 = 1, kU32 = 2, @@ -86,7 +74,7 @@ using complex64 = std::complex; using complex32 = std::complex; /// Encoding of the elemental type, for "overloading" @newSparseTensor. -enum class MLIR_SPARSETENSOR_EXPORT PrimaryType : uint32_t { +enum class PrimaryType : uint32_t { kF64 = 1, kF32 = 2, kF16 = 3, @@ -112,27 +100,24 @@ enum class MLIR_SPARSETENSOR_EXPORT PrimaryType : uint32_t { DO(C64, complex64) \ DO(C32, complex32) -constexpr MLIR_SPARSETENSOR_EXPORT bool -isFloatingPrimaryType(PrimaryType valTy) { +constexpr bool isFloatingPrimaryType(PrimaryType valTy) { return PrimaryType::kF64 <= valTy && valTy <= PrimaryType::kBF16; } -constexpr MLIR_SPARSETENSOR_EXPORT bool -isIntegralPrimaryType(PrimaryType valTy) { +constexpr bool isIntegralPrimaryType(PrimaryType valTy) { return PrimaryType::kI64 <= valTy && valTy <= PrimaryType::kI8; } -constexpr MLIR_SPARSETENSOR_EXPORT bool isRealPrimaryType(PrimaryType valTy) { +constexpr bool isRealPrimaryType(PrimaryType valTy) { return PrimaryType::kF64 <= valTy && valTy <= PrimaryType::kI8; } -constexpr MLIR_SPARSETENSOR_EXPORT bool -isComplexPrimaryType(PrimaryType valTy) { +constexpr bool isComplexPrimaryType(PrimaryType valTy) { return PrimaryType::kC64 <= valTy && valTy <= PrimaryType::kC32; } /// The actions performed by @newSparseTensor. -enum class MLIR_SPARSETENSOR_EXPORT Action : uint32_t { +enum class Action : uint32_t { kEmpty = 0, kFromFile = 1, kFromCOO = 2, @@ -145,7 +130,7 @@ enum class MLIR_SPARSETENSOR_EXPORT Action : uint32_t { /// This enum mimics `SparseTensorEncodingAttr::DimLevelType` for /// breaking dependency cycles. `SparseTensorEncodingAttr::DimLevelType` /// is the source of truth and this enum should be kept consistent with it. -enum class MLIR_SPARSETENSOR_EXPORT DimLevelType : uint8_t { +enum class DimLevelType : uint8_t { kDense = 4, // 0b001_00 kCompressed = 8, // 0b010_00 kCompressedNu = 9, // 0b010_01 @@ -158,29 +143,29 @@ enum class MLIR_SPARSETENSOR_EXPORT DimLevelType : uint8_t { }; /// Check if the `DimLevelType` is dense. -constexpr MLIR_SPARSETENSOR_EXPORT bool isDenseDLT(DimLevelType dlt) { +constexpr bool isDenseDLT(DimLevelType dlt) { return dlt == DimLevelType::kDense; } /// Check if the `DimLevelType` is compressed (regardless of properties). -constexpr MLIR_SPARSETENSOR_EXPORT bool isCompressedDLT(DimLevelType dlt) { +constexpr bool isCompressedDLT(DimLevelType dlt) { return static_cast(dlt) & static_cast(DimLevelType::kCompressed); } /// Check if the `DimLevelType` is singleton (regardless of properties). -constexpr MLIR_SPARSETENSOR_EXPORT bool isSingletonDLT(DimLevelType dlt) { +constexpr bool isSingletonDLT(DimLevelType dlt) { return static_cast(dlt) & static_cast(DimLevelType::kSingleton); } /// Check if the `DimLevelType` is ordered (regardless of storage format). -constexpr MLIR_SPARSETENSOR_EXPORT bool isOrderedDLT(DimLevelType dlt) { +constexpr bool isOrderedDLT(DimLevelType dlt) { return !(static_cast(dlt) & 2); } /// Check if the `DimLevelType` is unique (regardless of storage format). -constexpr MLIR_SPARSETENSOR_EXPORT bool isUniqueDLT(DimLevelType dlt) { +constexpr bool isUniqueDLT(DimLevelType dlt) { return !(static_cast(dlt) & 1); } diff --git a/mlir/lib/ExecutionEngine/SparseTensor/CMakeLists.txt b/mlir/lib/ExecutionEngine/SparseTensor/CMakeLists.txt index 89b1b2d..cf18a8c 100644 --- a/mlir/lib/ExecutionEngine/SparseTensor/CMakeLists.txt +++ b/mlir/lib/ExecutionEngine/SparseTensor/CMakeLists.txt @@ -11,7 +11,6 @@ add_mlir_library(mlir_sparse_tensor_utils mlir_float16_utils ) set_property(TARGET mlir_sparse_tensor_utils PROPERTY CXX_STANDARD 17) -target_compile_definitions(mlir_sparse_tensor_utils PRIVATE mlir_sparse_tensor_utils_EXPORTS) # To make sure we adhere to the style guide: # diff --git a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel index 301d5fb..39014d6 100644 --- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel @@ -6721,7 +6721,6 @@ cc_library( "include/mlir/ExecutionEngine/SparseTensor/File.h", "include/mlir/ExecutionEngine/SparseTensor/Storage.h", ], - copts = ["-Dmlir_sparse_tensor_utils_EXPORTS"], includes = ["include"], deps = [":mlir_float16_utils"], )