[Mlir-commits] [mlir] 7b4ea67 - Revert "[mlir][CRunnerUtils] Use explicit execution engine symbol registration."

Mehdi Amini llvmlistbot at llvm.org
Wed Jun 21 08:51:11 PDT 2023


Author: Mehdi Amini
Date: 2023-06-21T17:50:18+02:00
New Revision: 7b4ea67f3152cca17a39bad8aa38b24b222deb30

URL: https://github.com/llvm/llvm-project/commit/7b4ea67f3152cca17a39bad8aa38b24b222deb30
DIFF: https://github.com/llvm/llvm-project/commit/7b4ea67f3152cca17a39bad8aa38b24b222deb30.diff

LOG: Revert "[mlir][CRunnerUtils] Use explicit execution engine symbol registration."

This reverts commit 9119325a5666e557a19f38a05525578b556c215b.

A buildbot is broken, probably because of this change breaking the
SHARED_LIBS=ON build more.

Added: 
    

Modified: 
    mlir/include/mlir/ExecutionEngine/Float16bits.h
    mlir/lib/ExecutionEngine/CMakeLists.txt
    mlir/lib/ExecutionEngine/CRunnerUtils.cpp
    mlir/lib/ExecutionEngine/Float16bits.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/ExecutionEngine/Float16bits.h b/mlir/include/mlir/ExecutionEngine/Float16bits.h
index be9c77b99d74f..6bf1589aa13a2 100644
--- a/mlir/include/mlir/ExecutionEngine/Float16bits.h
+++ b/mlir/include/mlir/ExecutionEngine/Float16bits.h
@@ -48,4 +48,5 @@ MLIR_FLOAT16_EXPORT std::ostream &operator<<(std::ostream &os, const f16 &f);
 // Outputs a bfloat value.
 MLIR_FLOAT16_EXPORT std::ostream &operator<<(std::ostream &os, const bf16 &d);
 
+#undef MLIR_FLOAT16_EXPORT
 #endif // MLIR_EXECUTIONENGINE_FLOAT16BITS_H_

diff  --git a/mlir/lib/ExecutionEngine/CMakeLists.txt b/mlir/lib/ExecutionEngine/CMakeLists.txt
index 6377a9d1793ae..ab33fb5b430fb 100644
--- a/mlir/lib/ExecutionEngine/CMakeLists.txt
+++ b/mlir/lib/ExecutionEngine/CMakeLists.txt
@@ -147,15 +147,8 @@ if(LLVM_ENABLE_PIC)
     MLIRSparseTensorEnums
     MLIRSparseTensorRuntime
     )
-  set_property(TARGET mlir_c_runner_utils PROPERTY CXX_VISIBILITY_PRESET hidden)
   set_property(TARGET mlir_c_runner_utils PROPERTY CXX_STANDARD 17)
   target_compile_definitions(mlir_c_runner_utils PRIVATE mlir_c_runner_utils_EXPORTS)
-  if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
-    # Don't export symbols from link-time dependencies, these are internal
-    # implementation details.
-    # FIXME: Add a similar fix for Windows.
-    target_link_options(mlir_c_runner_utils PRIVATE "-Wl,-exclude-libs,ALL")
-  endif()
 
   add_mlir_library(mlir_runner_utils
     SHARED

diff  --git a/mlir/lib/ExecutionEngine/CRunnerUtils.cpp b/mlir/lib/ExecutionEngine/CRunnerUtils.cpp
index 1be41c9d6df12..7f800e8ea96ff 100644
--- a/mlir/lib/ExecutionEngine/CRunnerUtils.cpp
+++ b/mlir/lib/ExecutionEngine/CRunnerUtils.cpp
@@ -14,7 +14,6 @@
 
 #include "mlir/ExecutionEngine/CRunnerUtils.h"
 #include "mlir/ExecutionEngine/Msan.h"
-#include "llvm/ADT/StringMap.h"
 
 #ifndef _WIN32
 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
@@ -188,45 +187,4 @@ IMPL_STDSORT(F64, double)
 IMPL_STDSORT(F32, float)
 #undef IMPL_STDSORT
 
-//===----------------------------------------------------------------------===//
-// MLIR ExecutionEngine dynamic library integration.
-//===----------------------------------------------------------------------===//
-
-// Visual Studio had a bug that fails to compile nested generic lambdas
-// inside an `extern "C"` function.
-//   https://developercommunity.visualstudio.com/content/problem/475494/clexe-error-with-lambda-inside-function-templates.html
-// The bug is fixed in VS2019 16.1. Separating the declaration and definition is
-// a work around for older versions of Visual Studio.
-extern "C" MLIR_CRUNNERUTILS_EXPORT void
-__mlir_execution_engine_init(llvm::StringMap<void *> &exportSymbols);
-
-void __mlir_execution_engine_init(llvm::StringMap<void *> &exportSymbols) {
-  auto exportSymbol = [&](llvm::StringRef name, auto ptr) {
-    assert(exportSymbols.count(name) == 0 && "symbol already exists");
-    exportSymbols[name] = reinterpret_cast<void *>(ptr);
-  };
-
-  exportSymbol("memrefCopy", &memrefCopy);
-  exportSymbol("printI64", &printI64);
-  exportSymbol("printU64", &printU64);
-  exportSymbol("printF32", &printF32);
-  exportSymbol("printF64", &printF64);
-  exportSymbol("printOpen", &printOpen);
-  exportSymbol("printClose", &printClose);
-  exportSymbol("printComma", &printComma);
-  exportSymbol("printNewline", &printNewline);
-  exportSymbol("printF16", &printF16);
-  exportSymbol("printBF16", &printBF16);
-  exportSymbol("printFlops", &printFlops);
-  exportSymbol("rtclock", &rtclock);
-  exportSymbol("*rtsrand", &*rtsrand);
-  exportSymbol("rtrand", &rtrand);
-  exportSymbol("rtdrand", &rtdrand);
-  exportSymbol("_mlir_ciface_stdSortI64", &_mlir_ciface_stdSortI64);
-  exportSymbol("_mlir_ciface_stdSortF64", &_mlir_ciface_stdSortF64);
-  exportSymbol("_mlir_ciface_stdSortF32", &_mlir_ciface_stdSortF32);
-}
-
-extern "C" MLIR_CRUNNERUTILS_EXPORT void __mlir_execution_engine_destroy() {}
-
 #endif // MLIR_CRUNNERUTILS_DEFINE_FUNCTIONS

diff  --git a/mlir/lib/ExecutionEngine/Float16bits.cpp b/mlir/lib/ExecutionEngine/Float16bits.cpp
index fa86b776f7fd1..38a05fe86bbdd 100644
--- a/mlir/lib/ExecutionEngine/Float16bits.cpp
+++ b/mlir/lib/ExecutionEngine/Float16bits.cpp
@@ -193,12 +193,12 @@ extern "C" BF16ABIType ATTR_WEAK __truncdfbf2(double d) {
 }
 
 // Provide these to the CRunner with the local float16 knowledge.
-extern "C" MLIR_FLOAT16_EXPORT void printF16(uint16_t bits) {
+extern "C" void printF16(uint16_t bits) {
   f16 f;
   std::memcpy(&f, &bits, sizeof(f16));
   std::cout << f;
 }
-extern "C" MLIR_FLOAT16_EXPORT void printBF16(uint16_t bits) {
+extern "C" void printBF16(uint16_t bits) {
   bf16 f;
   std::memcpy(&f, &bits, sizeof(bf16));
   std::cout << f;


        


More information about the Mlir-commits mailing list