[Mlir-commits] [mlir] 6206692 - [mlir][sparse] Renaming mlir_sparse_tensor_utils library to SparseTensorRuntime
wren romano
llvmlistbot at llvm.org
Tue Oct 11 15:00:22 PDT 2022
Author: wren romano
Date: 2022-10-11T15:00:11-07:00
New Revision: 62066929310fc95bea1bacf8ec26acbb4f216d4c
URL: https://github.com/llvm/llvm-project/commit/62066929310fc95bea1bacf8ec26acbb4f216d4c
DIFF: https://github.com/llvm/llvm-project/commit/62066929310fc95bea1bacf8ec26acbb4f216d4c.diff
LOG: [mlir][sparse] Renaming mlir_sparse_tensor_utils library to SparseTensorRuntime
The "mlir_xxx_utils" naming scheme is reserved/intended for shared libraries, whereas this library must be static due to issues of linking DLLs on Windows. So we rename the library to avoid any potential confusion. In addition we also rename the ExecutionEngine/SparseTensorUtils.{h,cpp} files to match the new library name.
Reviewed By: aartbik, stella.stamenova
Differential Revision: https://reviews.llvm.org/D135613
Added:
mlir/include/mlir/ExecutionEngine/SparseTensorRuntime.h
mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp
Modified:
mlir/lib/ExecutionEngine/CMakeLists.txt
mlir/lib/ExecutionEngine/SparseTensor/CMakeLists.txt
utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
Removed:
mlir/include/mlir/ExecutionEngine/SparseTensorUtils.h
mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
################################################################################
diff --git a/mlir/include/mlir/ExecutionEngine/SparseTensorUtils.h b/mlir/include/mlir/ExecutionEngine/SparseTensorRuntime.h
similarity index 97%
rename from mlir/include/mlir/ExecutionEngine/SparseTensorUtils.h
rename to mlir/include/mlir/ExecutionEngine/SparseTensorRuntime.h
index 865e9816acade..94022b64fca79 100644
--- a/mlir/include/mlir/ExecutionEngine/SparseTensorUtils.h
+++ b/mlir/include/mlir/ExecutionEngine/SparseTensorRuntime.h
@@ -1,4 +1,4 @@
-//===- SparseTensorUtils.h - SparseTensor runtime support lib ---*- C++ -*-===//
+//===- SparseTensorRuntime.h - SparseTensor runtime support lib -*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -7,13 +7,13 @@
//===----------------------------------------------------------------------===//
//
// This header file provides the enums and functions which comprise the
-// public API of the `ExecutionEngine/SparseTensorUtils.cpp` runtime
+// public API of the `ExecutionEngine/SparseTensorRuntime.cpp` runtime
// support library for the SparseTensor dialect.
//
//===----------------------------------------------------------------------===//
-#ifndef MLIR_EXECUTIONENGINE_SPARSETENSORUTILS_H
-#define MLIR_EXECUTIONENGINE_SPARSETENSORUTILS_H
+#ifndef MLIR_EXECUTIONENGINE_SPARSETENSORRUNTIME_H
+#define MLIR_EXECUTIONENGINE_SPARSETENSORRUNTIME_H
#include "mlir/ExecutionEngine/CRunnerUtils.h"
#include "mlir/ExecutionEngine/SparseTensor/Enums.h"
@@ -214,4 +214,4 @@ MLIR_SPARSETENSOR_FOREVERY_V(DECL_CONVERTFROMMLIRSPARSETENSOR)
} // extern "C"
-#endif // MLIR_EXECUTIONENGINE_SPARSETENSORUTILS_H
+#endif // MLIR_EXECUTIONENGINE_SPARSETENSORRUNTIME_H
diff --git a/mlir/lib/ExecutionEngine/CMakeLists.txt b/mlir/lib/ExecutionEngine/CMakeLists.txt
index 8aeb539c0e4a5..1449bdffd7a23 100644
--- a/mlir/lib/ExecutionEngine/CMakeLists.txt
+++ b/mlir/lib/ExecutionEngine/CMakeLists.txt
@@ -5,7 +5,7 @@ set(LLVM_OPTIONAL_SOURCES
AsyncRuntime.cpp
CRunnerUtils.cpp
CudaRuntimeWrappers.cpp
- SparseTensorUtils.cpp
+ SparseTensorRuntime.cpp
ExecutionEngine.cpp
Float16bits.cpp
RocmRuntimeWrappers.cpp
@@ -132,12 +132,12 @@ add_subdirectory(SparseTensor)
add_mlir_library(mlir_c_runner_utils
SHARED
CRunnerUtils.cpp
- SparseTensorUtils.cpp
+ SparseTensorRuntime.cpp
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
index cf18a8c50ee08..3e8993c1af192 100644
--- 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 @@ add_mlir_library(mlir_sparse_tensor_utils
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:
# <https://llvm.org/docs/CodingStandards.html#provide-a-virtual-method-anchor-for-classes-in-headers>
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/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp b/mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp
similarity index 99%
rename from mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
rename to mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp
index 2174af2822342..3ae6d8d011e38 100644
--- a/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
+++ b/mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp
@@ -1,4 +1,4 @@
-//===- SparseTensorUtils.cpp - Sparse Tensor Utils for MLIR execution -----===//
+//===- SparseTensorRuntime.cpp - SparseTensor runtime support lib ---------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -46,7 +46,7 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/ExecutionEngine/SparseTensorUtils.h"
+#include "mlir/ExecutionEngine/SparseTensorRuntime.h"
#ifdef MLIR_CRUNNERUTILS_DEFINE_FUNCTIONS
diff --git a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
index 76625a91969d9..6646ce018252a 100644
--- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
@@ -2129,12 +2129,12 @@ cc_library(
":SCFTransforms",
":SparseTensorDialect",
":SparseTensorPassIncGen",
+ ":SparseTensorRuntime",
":SparseTensorUtils",
":Support",
":TensorDialect",
":Transforms",
":VectorDialect",
- ":mlir_sparse_tensor_utils",
"//llvm:Support",
],
)
@@ -6716,14 +6716,18 @@ cc_binary(
)
# 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",
@@ -6742,22 +6746,22 @@ cc_library(
deps = [":mlir_float16_utils"],
)
-# We relist Enums.h because SparseTensorUtils.h includes/reexports it
+# We relist Enums.h because SparseTensorRuntime.h includes/reexports it
# as part of the public API.
cc_library(
name = "_mlir_c_runner_utils",
srcs = [
"lib/ExecutionEngine/CRunnerUtils.cpp",
- "lib/ExecutionEngine/SparseTensorUtils.cpp",
+ "lib/ExecutionEngine/SparseTensorRuntime.cpp",
],
hdrs = [
"include/mlir/ExecutionEngine/CRunnerUtils.h",
"include/mlir/ExecutionEngine/Msan.h",
"include/mlir/ExecutionEngine/SparseTensor/Enums.h",
- "include/mlir/ExecutionEngine/SparseTensorUtils.h",
+ "include/mlir/ExecutionEngine/SparseTensorRuntime.h",
],
includes = ["include"],
- deps = [":mlir_sparse_tensor_utils"],
+ deps = [":SparseTensorRuntime"],
)
# Indirection to avoid 'libmlir_c_runner_utils.so' filename clash.
More information about the Mlir-commits
mailing list