diff --git a/mlir/lib/ExecutionEngine/CMakeLists.txt b/mlir/lib/ExecutionEngine/CMakeLists.txt --- a/mlir/lib/ExecutionEngine/CMakeLists.txt +++ b/mlir/lib/ExecutionEngine/CMakeLists.txt @@ -137,7 +137,7 @@ EXCLUDE_FROM_LIBMLIR LINK_LIBS PUBLIC - mlir_sparse_tensor_utils + MLIRSparseTensorRuntime ) set_property(TARGET mlir_c_runner_utils PROPERTY CXX_STANDARD 17) target_compile_definitions(mlir_c_runner_utils PRIVATE mlir_c_runner_utils_EXPORTS) diff --git a/mlir/lib/ExecutionEngine/SparseTensor/CMakeLists.txt b/mlir/lib/ExecutionEngine/SparseTensor/CMakeLists.txt --- a/mlir/lib/ExecutionEngine/SparseTensor/CMakeLists.txt +++ b/mlir/lib/ExecutionEngine/SparseTensor/CMakeLists.txt @@ -1,6 +1,11 @@ # Unlike mlir_float16_utils, mlir_c_runner_utils, etc, we do *not* make -# this a shared library: because doing so causes issues building on Windows. -add_mlir_library(mlir_sparse_tensor_utils +# this a shared library: because doing so causes issues when building +# on Windows. In particular, various functions take/return `std::vector` +# but that class is not designed with dllimport/dllexport pragma, +# therefore it cannot be safely/correctly used across DLL boundaries. +# Consequently, we avoid using the "mlir_xxx_utils" naming scheme, since +# that is reserved/intended for shared libraries only. +add_mlir_library(MLIRSparseTensorRuntime File.cpp NNZ.cpp Storage.cpp @@ -10,13 +15,13 @@ LINK_LIBS PUBLIC mlir_float16_utils ) -set_property(TARGET mlir_sparse_tensor_utils PROPERTY CXX_STANDARD 17) +set_property(TARGET MLIRSparseTensorRuntime PROPERTY CXX_STANDARD 17) # To make sure we adhere to the style guide: # check_cxx_compiler_flag(-Wweak-vtables COMPILER_SUPPORTS_WARNING_WEAK_VTABLES) if(COMPILER_SUPPORTS_WARNING_WEAK_VTABLES) - target_compile_options(mlir_sparse_tensor_utils PUBLIC + target_compile_options(MLIRSparseTensorRuntime PUBLIC "-Wweak-vtables") endif() diff --git a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel --- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel @@ -2113,12 +2113,12 @@ ":SCFTransforms", ":SparseTensorDialect", ":SparseTensorPassIncGen", + ":SparseTensorRuntime", ":SparseTensorUtils", ":Support", ":TensorDialect", ":Transforms", ":VectorDialect", - ":mlir_sparse_tensor_utils", "//llvm:Support", ], ) @@ -6699,14 +6699,18 @@ ) # Unlike mlir_float16_utils, mlir_c_runner_utils, etc, we do *not* make -# this a shared library: because on the CMake side, doing so causes -# issues when building on Windows. +# this a shared library: because on the CMake side, doing so causes issues +# when building on Windows. In particular, various functions take/return +# `std::vector` but that class is not designed with dllimport/dllexport +# pragma, therefore it cannot be safely/correctly used across DLL boundaries. +# Consequently, we avoid using the "mlir_xxx_utils" naming scheme, +# since that is reserved/intended for shared libraries only. # # We relist Float16bits.h because Enums.h includes it; rather than # forcing all direct-dependants state that they also directly-depend # on :mlir_float16_utils (to satisfy the layering_check). cc_library( - name = "mlir_sparse_tensor_utils", + name = "SparseTensorRuntime", srcs = [ "lib/ExecutionEngine/SparseTensor/File.cpp", "lib/ExecutionEngine/SparseTensor/NNZ.cpp", @@ -6740,7 +6744,7 @@ "include/mlir/ExecutionEngine/SparseTensorUtils.h", ], includes = ["include"], - deps = [":mlir_sparse_tensor_utils"], + deps = [":SparseTensorRuntime"], ) # Indirection to avoid 'libmlir_c_runner_utils.so' filename clash.