[Mlir-commits] [mlir] c6f3fc4 - Revert "[MLIR] Add support for libMLIR.so"

Stephen Neuendorffer llvmlistbot at llvm.org
Fri Feb 28 12:17:50 PST 2020


Author: Stephen Neuendorffer
Date: 2020-02-28T12:17:39-08:00
New Revision: c6f3fc49998503fbe769260150ca441e49a0819e

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

LOG: Revert "[MLIR] Add support for libMLIR.so"

This reverts commit 1246e867164b06fc3f0de6bfaaa0922d99cb5ce9.

Added: 
    

Modified: 
    mlir/CMakeLists.txt
    mlir/cmake/modules/AddMLIR.cmake
    mlir/lib/Analysis/CMakeLists.txt
    mlir/lib/Dialect/CMakeLists.txt
    mlir/lib/EDSC/CMakeLists.txt
    mlir/lib/ExecutionEngine/CMakeLists.txt
    mlir/lib/IR/CMakeLists.txt
    mlir/lib/Parser/CMakeLists.txt
    mlir/lib/Pass/CMakeLists.txt
    mlir/lib/Quantizer/CMakeLists.txt
    mlir/lib/Support/CMakeLists.txt
    mlir/lib/Target/CMakeLists.txt
    mlir/lib/Transforms/CMakeLists.txt
    mlir/lib/Transforms/Utils/CMakeLists.txt
    mlir/lib/Translation/CMakeLists.txt
    mlir/tools/CMakeLists.txt
    mlir/tools/mlir-opt/CMakeLists.txt

Removed: 
    mlir/tools/mlir-shlib/CMakeLists.txt
    mlir/tools/mlir-shlib/mlir-shlib.cpp


################################################################################
diff  --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt
index 50c1223a4a10..5afb039bff35 100644
--- a/mlir/CMakeLists.txt
+++ b/mlir/CMakeLists.txt
@@ -34,11 +34,9 @@ include_directories( ${MLIR_INCLUDE_DIR})
 
 add_subdirectory(include/mlir)
 add_subdirectory(lib)
+add_subdirectory(tools)
 add_subdirectory(unittests)
 add_subdirectory(test)
-# Tools needs to come late to ensure that MLIR_ALL_LIBS is populated.
-# Generally things after this point may depend on MLIR_ALL_LIBS or libMLIR.so.
-add_subdirectory(tools)
 
 if( LLVM_INCLUDE_EXAMPLES )
   add_subdirectory(examples)

diff  --git a/mlir/cmake/modules/AddMLIR.cmake b/mlir/cmake/modules/AddMLIR.cmake
index cd7860ca2fe3..d8944532c6ff 100644
--- a/mlir/cmake/modules/AddMLIR.cmake
+++ b/mlir/cmake/modules/AddMLIR.cmake
@@ -49,41 +49,14 @@ function(add_mlir_dialect dialect dialect_doc_filename)
   add_dependencies(mlir-doc ${dialect_doc_filename}DocGen)
 endfunction()
 
-# Declare a library which can be compiled in libMLIR.so
-macro(add_mlir_library name)
-  cmake_parse_arguments(ARG
-    "SHARED;INSTALL_WITH_TOOLCHAIN"
-    ""
-    "ADDITIONAL_HEADERS"
-    ${ARGN})
-  set(srcs)
-  if(ARG_SHARED)
-    set(LIBTYPE SHARED)
-  else()
-    # llvm_add_library ignores BUILD_SHARED_LIBS if STATIC is explicitly set,
-    # so we need to handle it here.
-    if(BUILD_SHARED_LIBS)
-      set(LIBTYPE SHARED)
-    else()
-      set(LIBTYPE STATIC)
-    endif()
-    if(NOT XCODE)
-      # The Xcode generator doesn't handle object libraries correctly.
-      list(APPEND LIBTYPE OBJECT)
-    endif()
-    set_property(GLOBAL APPEND PROPERTY MLIR_ALL_LIBS ${name})
-  endif()
-  add_llvm_library(${name} ${LIBTYPE} ${ARG_UNPARSED_ARGUMENTS} ${srcs})
-endmacro(add_mlir_library)
-
 # Declare the library associated with a dialect.
 function(add_mlir_dialect_library name)
   set_property(GLOBAL APPEND PROPERTY MLIR_DIALECT_LIBS ${name})
-  add_mlir_library(${ARGV})
+  add_llvm_library(${ARGV})
 endfunction(add_mlir_dialect_library)
 
 # Declare the library associated with a conversion.
 function(add_mlir_conversion_library name)
   set_property(GLOBAL APPEND PROPERTY MLIR_CONVERSION_LIBS ${name})
-  add_mlir_library(${ARGV})
+  add_llvm_library(${ARGV})
 endfunction(add_mlir_conversion_library)

diff  --git a/mlir/lib/Analysis/CMakeLists.txt b/mlir/lib/Analysis/CMakeLists.txt
index 77bae1de024f..5df7fcecd37c 100644
--- a/mlir/lib/Analysis/CMakeLists.txt
+++ b/mlir/lib/Analysis/CMakeLists.txt
@@ -12,7 +12,7 @@ set(LLVM_OPTIONAL_SOURCES
   Verifier.cpp
   )
 
-add_mlir_library(MLIRAnalysis
+add_llvm_library(MLIRAnalysis
   CallGraph.cpp
   InferTypeOpInterface.cpp
   Liveness.cpp
@@ -35,7 +35,7 @@ add_mlir_library(MLIRAnalysis
   LLVMSupport
   )
 
-add_mlir_library(MLIRLoopAnalysis
+add_llvm_library(MLIRLoopAnalysis
   AffineAnalysis.cpp
   AffineStructures.cpp
   LoopAnalysis.cpp

diff  --git a/mlir/lib/Dialect/CMakeLists.txt b/mlir/lib/Dialect/CMakeLists.txt
index 180ab07c21d7..d9d91b9bb717 100644
--- a/mlir/lib/Dialect/CMakeLists.txt
+++ b/mlir/lib/Dialect/CMakeLists.txt
@@ -12,11 +12,12 @@ add_subdirectory(SPIRV)
 add_subdirectory(StandardOps)
 add_subdirectory(VectorOps)
 
+
 set(LLVM_OPTIONAL_SOURCES
   Traits.cpp
 )
 
-add_mlir_library(MLIRDialect
+add_llvm_library(MLIRDialect
   Traits.cpp
 
   ADDITIONAL_HEADER_DIRS

diff  --git a/mlir/lib/EDSC/CMakeLists.txt b/mlir/lib/EDSC/CMakeLists.txt
index 0a4f2754345c..660efc5bccee 100644
--- a/mlir/lib/EDSC/CMakeLists.txt
+++ b/mlir/lib/EDSC/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_OPTIONAL_SOURCES
   CoreAPIs.cpp
   )
 
-add_mlir_library(MLIREDSC
+add_llvm_library(MLIREDSC
   Builders.cpp
 
   ADDITIONAL_HEADER_DIRS
@@ -15,7 +15,7 @@ add_mlir_library(MLIREDSC
   LLVMSupport
   )
 
-add_mlir_library(MLIREDSCInterface
+add_llvm_library(MLIREDSCInterface
   CoreAPIs.cpp
 
   ADDITIONAL_HEADER_DIRS

diff  --git a/mlir/lib/ExecutionEngine/CMakeLists.txt b/mlir/lib/ExecutionEngine/CMakeLists.txt
index 92673dabd232..c24917c11a96 100644
--- a/mlir/lib/ExecutionEngine/CMakeLists.txt
+++ b/mlir/lib/ExecutionEngine/CMakeLists.txt
@@ -6,7 +6,7 @@ set(LLVM_OPTIONAL_SOURCES
   )
 
 llvm_map_components_to_libnames(outlibs "nativecodegen" "IPO")
-add_mlir_library(MLIRExecutionEngine
+add_llvm_library(MLIRExecutionEngine
   ExecutionEngine.cpp
   OptUtils.cpp
 

diff  --git a/mlir/lib/IR/CMakeLists.txt b/mlir/lib/IR/CMakeLists.txt
index 61313c52f37c..80a9e4f12b9b 100644
--- a/mlir/lib/IR/CMakeLists.txt
+++ b/mlir/lib/IR/CMakeLists.txt
@@ -1,5 +1,5 @@
 file(GLOB globbed *.c *.cpp)
-add_mlir_library(MLIRIR
+add_llvm_library(MLIRIR
   ${globbed}
 
   ADDITIONAL_HEADER_DIRS

diff  --git a/mlir/lib/Parser/CMakeLists.txt b/mlir/lib/Parser/CMakeLists.txt
index 14d64b351f5d..978a6748f22e 100644
--- a/mlir/lib/Parser/CMakeLists.txt
+++ b/mlir/lib/Parser/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_mlir_library(MLIRParser
+add_llvm_library(MLIRParser
   Lexer.cpp
   Parser.cpp
   Token.cpp

diff  --git a/mlir/lib/Pass/CMakeLists.txt b/mlir/lib/Pass/CMakeLists.txt
index df116bf4c2ba..9df404c36536 100644
--- a/mlir/lib/Pass/CMakeLists.txt
+++ b/mlir/lib/Pass/CMakeLists.txt
@@ -1,5 +1,5 @@
 file(GLOB globbed *.c *.cpp)
-add_mlir_library(MLIRPass
+add_llvm_library(MLIRPass
   ${globbed}
 
   ADDITIONAL_HEADER_DIRS

diff  --git a/mlir/lib/Quantizer/CMakeLists.txt b/mlir/lib/Quantizer/CMakeLists.txt
index f646f6ab6894..5b52b2a9a170 100644
--- a/mlir/lib/Quantizer/CMakeLists.txt
+++ b/mlir/lib/Quantizer/CMakeLists.txt
@@ -1,5 +1,5 @@
 # Support.
-add_mlir_library(MLIRQuantizerSupport
+add_llvm_library(MLIRQuantizerSupport
   Support/Configuration.cpp
   Support/ConstraintAnalysisGraph.cpp
   Support/Metadata.cpp
@@ -19,7 +19,7 @@ add_mlir_library(MLIRQuantizerSupport
   )
 
 # Configurations.
-add_mlir_library(MLIRQuantizerFxpMathConfig
+add_llvm_library(MLIRQuantizerFxpMathConfig
   Configurations/FxpMathConfig.cpp
 
   ADDITIONAL_HEADER_DIRS
@@ -38,7 +38,7 @@ add_mlir_library(MLIRQuantizerFxpMathConfig
   )
 
 # Transforms.
-add_mlir_library(MLIRQuantizerTransforms
+add_llvm_library(MLIRQuantizerTransforms
   Transforms/AddDefaultStatsTestPass.cpp
   Transforms/InferQuantizedTypesPass.cpp
   Transforms/RemoveInstrumentationPass.cpp

diff  --git a/mlir/lib/Support/CMakeLists.txt b/mlir/lib/Support/CMakeLists.txt
index ae686014deb3..140c2ce721a7 100644
--- a/mlir/lib/Support/CMakeLists.txt
+++ b/mlir/lib/Support/CMakeLists.txt
@@ -7,7 +7,7 @@ set(LLVM_OPTIONAL_SOURCES
   TranslateClParser.cpp
 )
 
-add_mlir_library(MLIRSupport
+add_llvm_library(MLIRSupport
   FileUtilities.cpp
   StorageUniquer.cpp
   ToolUtilities.cpp
@@ -20,7 +20,7 @@ add_mlir_library(MLIRSupport
   ${LLVM_PTHREAD_LIB}
   )
 
-add_mlir_library(MLIROptLib
+add_llvm_library(MLIROptLib
   MlirOptMain.cpp
 
   ADDITIONAL_HEADER_DIRS
@@ -34,7 +34,7 @@ add_mlir_library(MLIROptLib
   LLVMSupport
   )
 
-add_mlir_library(MLIRTranslateClParser
+add_llvm_library(MLIRTranslateClParser
   TranslateClParser.cpp
 
   ADDITIONAL_HEADER_DIRS

diff  --git a/mlir/lib/Target/CMakeLists.txt b/mlir/lib/Target/CMakeLists.txt
index f5cfa916a790..93f997f0876d 100644
--- a/mlir/lib/Target/CMakeLists.txt
+++ b/mlir/lib/Target/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_mlir_library(MLIRTargetLLVMIRModuleTranslation
+add_llvm_library(MLIRTargetLLVMIRModuleTranslation
   LLVMIR/DebugTranslation.cpp
   LLVMIR/ModuleTranslation.cpp
 
@@ -19,7 +19,7 @@ add_mlir_library(MLIRTargetLLVMIRModuleTranslation
   MLIRTranslation
   )
 
-add_mlir_library(MLIRTargetLLVMIR
+add_llvm_library(MLIRTargetLLVMIR
   LLVMIR/ConvertFromLLVMIR.cpp
   LLVMIR/ConvertToLLVMIR.cpp
 
@@ -36,8 +36,7 @@ add_mlir_library(MLIRTargetLLVMIR
   LLVMIRReader
   LLVMSupport
   )
-
-add_mlir_library(MLIRTargetNVVMIR
+add_llvm_library(MLIRTargetNVVMIR
   LLVMIR/ConvertToNVVMIR.cpp
 
   ADDITIONAL_HEADER_DIRS
@@ -57,7 +56,7 @@ add_mlir_library(MLIRTargetNVVMIR
   LLVMSupport
   )
 
-add_mlir_library(MLIRTargetROCDLIR
+add_llvm_library(MLIRTargetROCDLIR
   LLVMIR/ConvertToROCDLIR.cpp
 
   ADDITIONAL_HEADER_DIRS

diff  --git a/mlir/lib/Transforms/CMakeLists.txt b/mlir/lib/Transforms/CMakeLists.txt
index 8a1c53b23e8b..980a357ed751 100644
--- a/mlir/lib/Transforms/CMakeLists.txt
+++ b/mlir/lib/Transforms/CMakeLists.txt
@@ -1,6 +1,6 @@
 add_subdirectory(Utils)
 
-add_mlir_library(MLIRTransforms
+add_llvm_library(MLIRTransforms
   AffineDataCopyGeneration.cpp
   AffineLoopInvariantCodeMotion.cpp
   Canonicalizer.cpp

diff  --git a/mlir/lib/Transforms/Utils/CMakeLists.txt b/mlir/lib/Transforms/Utils/CMakeLists.txt
index f58f0850f473..de3351133165 100644
--- a/mlir/lib/Transforms/Utils/CMakeLists.txt
+++ b/mlir/lib/Transforms/Utils/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_mlir_library(MLIRTransformUtils
+add_llvm_library(MLIRTransformUtils
   FoldUtils.cpp
   GreedyPatternRewriteDriver.cpp
   InliningUtils.cpp

diff  --git a/mlir/lib/Translation/CMakeLists.txt b/mlir/lib/Translation/CMakeLists.txt
index feb94a24491a..b8e809f40129 100644
--- a/mlir/lib/Translation/CMakeLists.txt
+++ b/mlir/lib/Translation/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_mlir_library(MLIRTranslation
+add_llvm_library(MLIRTranslation
   Translation.cpp
 
   ADDITIONAL_HEADER_DIRS

diff  --git a/mlir/tools/CMakeLists.txt b/mlir/tools/CMakeLists.txt
index 1fd89450f3f9..e3faaca49232 100644
--- a/mlir/tools/CMakeLists.txt
+++ b/mlir/tools/CMakeLists.txt
@@ -4,4 +4,3 @@ add_subdirectory(mlir-opt)
 add_subdirectory(mlir-tblgen)
 add_subdirectory(mlir-translate)
 add_subdirectory(mlir-vulkan-runner)
-add_subdirectory(mlir-shlib)

diff  --git a/mlir/tools/mlir-opt/CMakeLists.txt b/mlir/tools/mlir-opt/CMakeLists.txt
index d419e104b9c8..0eaed46521d8 100644
--- a/mlir/tools/mlir-opt/CMakeLists.txt
+++ b/mlir/tools/mlir-opt/CMakeLists.txt
@@ -4,7 +4,6 @@ set(LLVM_OPTIONAL_SOURCES
 
 set(LIB_LIBS
   MLIRAnalysis
-  MLIRIR
   MLIRLLVMIR
   MLIROptLib
   MLIRParser

diff  --git a/mlir/tools/mlir-shlib/CMakeLists.txt b/mlir/tools/mlir-shlib/CMakeLists.txt
deleted file mode 100644
index e9b2963d8bb8..000000000000
--- a/mlir/tools/mlir-shlib/CMakeLists.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-# Building libmlir-cpp.so fails if LLVM_ENABLE_PIC=Off
-if (NOT LLVM_ENABLE_PIC)
-  return()
-endif()
-
-# Building libmlir-cpp.so may not work on MSVC
-if (MSVC)
-  return()
-endif()
-
-get_property(mlir_libs GLOBAL PROPERTY MLIR_ALL_LIBS)
-list(REMOVE_DUPLICATES mlir_libs)
-
-foreach (lib ${mlir_libs})
-  if(XCODE)
-    # Xcode doesn't support object libraries, so we have to trick it into
-    # linking the static libraries instead.
-    list(APPEND _DEPS "-force_load" ${lib})
-  else()
-    list(APPEND _OBJECTS $<TARGET_OBJECTS:obj.${lib}>)
-  endif()
-  list(APPEND _DEPS $<TARGET_PROPERTY:${lib},LINK_LIBRARIES>)
-endforeach ()
-
-if(MLIR_LINK_MLIR_DYLIB)
-  set(INSTALL_WITH_TOOLCHAIN INSTALL_WITH_TOOLCHAIN)
-endif()
-
-# libMLIR.so depends on LLVM components.  To avoid multiple
-# copies of those LLVM components, libMLIR.so depends on libLLVM.so.
-# This probably won't work if some LLVM components are not included
-# in libLLVM.so.
-if(LLVM_BUILD_LLVM_DYLIB)
-  add_llvm_library(MLIR
-    SHARED
-    ${INSTALL_WITH_TOOLCHAIN}
-
-    mlir-shlib.cpp
-    )
-  target_link_libraries(MLIR PRIVATE LLVM ${LLVM_PTHREAD_LIB})
-  whole_archive_link(MLIR ${mlir_libs})
-endif()

diff  --git a/mlir/tools/mlir-shlib/mlir-shlib.cpp b/mlir/tools/mlir-shlib/mlir-shlib.cpp
deleted file mode 100644
index 0093622e6a14..000000000000
--- a/mlir/tools/mlir-shlib/mlir-shlib.cpp
+++ /dev/null
@@ -1 +0,0 @@
-// Intentionally empty source file to make CMake happy


        


More information about the Mlir-commits mailing list