Commit d38e160a authored by Nagy Mostafa's avatar Nagy Mostafa Committed by Sang Ik Lee

Revert MLIR core lib creation (#4161)

Co-authored-by: 's avatarDiego Caballero <diego.caballero@intel.com>
Co-authored-by: 's avatarScott Cyphers <diyessi@users.noreply.github.com>
parent d32259c8
...@@ -18,27 +18,34 @@ include_directories( ...@@ -18,27 +18,34 @@ include_directories(
${NGRAPH_INCLUDE_PATH} ${NGRAPH_INCLUDE_PATH}
${MLIR_LLVM_INCLUDE_PATH} ${MLIR_LLVM_INCLUDE_PATH}
${MLIR_INCLUDE_PATHS} ${MLIR_INCLUDE_PATHS}
${CMAKE_CURRENT_BINARY_DIR}
) )
add_subdirectory(tools/ngraph-opt) add_subdirectory(tools/ngraph-opt)
add_subdirectory(core)
set(SRC set(SRC
backend/cpu/cpu_backend.cpp backend/cpu/cpu_backend.cpp
backend/pass/affine_lowerer.cpp backend/pass/affine_lowerer.cpp
backend/pass/memory_optimization.cpp backend/pass/memory_optimization.cpp
core/compiler.cpp
core/ngraph_dialect/dialect.cpp
core/ngraph_dialect/type.cpp
core/ngraph_dialect/ops.cpp
core/pass/mlir_subgraph_extraction.cpp
core/pass/mlir_subgraph_extraction.hpp
core/pass/ng_dialect_builder.cpp
core/pass/ng_dialect_builder.hpp
runtime/cpu/memory_manager.cpp runtime/cpu/memory_manager.cpp
runtime/cpu/cpu_runtime.cpp runtime/cpu/cpu_runtime.cpp
utils.cpp utils.cpp
) )
add_library(mlir_cpu_backend SHARED ${SRC}) add_library(mlir_backend SHARED ${SRC})
llvm_map_components_to_libnames(llvm_libs support core irreader) llvm_map_components_to_libnames(llvm_libs support core irreader)
# Link MLIR libs # Link MLIR libs
target_link_libraries( target_link_libraries(
mlir_cpu_backend PRIVATE mlir_backend PRIVATE
MLIRAffineToStandard MLIRAffineToStandard
MLIRAnalysis MLIRAnalysis
MLIREDSC MLIREDSC
...@@ -52,11 +59,6 @@ target_link_libraries( ...@@ -52,11 +59,6 @@ target_link_libraries(
MLIRTransforms MLIRTransforms
MLIRSupport MLIRSupport
) )
target_link_libraries(
mlir_cpu_backend PUBLIC
mlir_core
)
# some libs need whole archive linkage because of Globals static initialization # some libs need whole archive linkage because of Globals static initialization
function(whole_archive_link target) function(whole_archive_link target)
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
...@@ -80,15 +82,15 @@ set(LIBS ...@@ -80,15 +82,15 @@ set(LIBS
${LLVM_BUILD_LIBRARY_DIR}/libMLIRAffineOps.a ${LLVM_BUILD_LIBRARY_DIR}/libMLIRAffineOps.a
${LLVM_BUILD_LIBRARY_DIR}/libMLIRStandardOps.a ${LLVM_BUILD_LIBRARY_DIR}/libMLIRStandardOps.a
) )
whole_archive_link(mlir_cpu_backend ${LIBS}) whole_archive_link(mlir_backend ${LIBS})
# Link LLVM libs # Link LLVM libs
target_link_libraries( target_link_libraries(
mlir_cpu_backend PRIVATE mlir_backend PRIVATE
${llvm_libs} ${llvm_libs}
) )
# Link ngraph # Link ngraph
target_link_libraries(mlir_cpu_backend PUBLIC ngraph) target_link_libraries(mlir_backend PUBLIC ngraph)
# table-gen dialect ops # table-gen dialect ops
# include table-gen helpers # include table-gen helpers
...@@ -120,6 +122,8 @@ ngraph_tablegen(ops_attributes.h.inc -gen-enum-decls) ...@@ -120,6 +122,8 @@ ngraph_tablegen(ops_attributes.h.inc -gen-enum-decls)
ngraph_tablegen(ops_attributes.cpp.inc -gen-enum-defs) ngraph_tablegen(ops_attributes.cpp.inc -gen-enum-defs)
add_public_tablegen_target(ngraph_ops_attributes_gen) add_public_tablegen_target(ngraph_ops_attributes_gen)
add_dependencies(mlir_cpu_backend ngraph_ops_gen ngraph_ops_interfaces_gen ngraph_ops_attributes_gen) add_dependencies(mlir_backend ngraph_ops_gen ngraph_ops_interfaces_gen ngraph_ops_attributes_gen)
target_include_directories(mlir_backend PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
install(TARGETS mlir_cpu_backend DESTINATION ${NGRAPH_INSTALL_LIB}) install(TARGETS mlir_backend DESTINATION ${NGRAPH_INSTALL_LIB})
# ******************************************************************************
# Copyright 2017-2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ******************************************************************************
include_directories(
${NGRAPH_INCLUDE_PATH}
${MLIR_LLVM_INCLUDE_PATH}
${MLIR_INCLUDE_PATHS}
)
set(SRC
compiler.cpp
ngraph_dialect/dialect.cpp
ngraph_dialect/type.cpp
ngraph_dialect/ops.cpp
pass/mlir_subgraph_extraction.cpp
pass/mlir_subgraph_extraction.hpp
pass/ng_dialect_builder.cpp
pass/ng_dialect_builder.hpp
)
add_library(mlir_core SHARED ${SRC})
install(TARGETS mlir_core DESTINATION ${NGRAPH_INSTALL_LIB})
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
# ****************************************************************************** # ******************************************************************************
set(LIBS set(LIBS
mlir_cpu_backend mlir_backend
MLIROptMain MLIROptMain
MLIRPass MLIRPass
MLIRParser MLIRParser
......
...@@ -276,9 +276,9 @@ if (NGRAPH_CPU_ENABLE) ...@@ -276,9 +276,9 @@ if (NGRAPH_CPU_ENABLE)
DEFINITION MLIR_LLVM_INCLUDEPATH) DEFINITION MLIR_LLVM_INCLUDEPATH)
message(STATUS "Building CPU backend with MLIR") message(STATUS "Building CPU backend with MLIR")
add_dependencies(cpu_backend mlir_cpu_backend) add_dependencies(cpu_backend mlir_backend)
target_include_directories(cpu_backend PUBLIC ${MLIR_INCLUDE_PATHS} ${MLIR_LLVM_INCLUDE_PATH}) target_include_directories(cpu_backend PUBLIC ${MLIR_INCLUDE_PATHS} ${MLIR_LLVM_INCLUDE_PATH})
target_link_libraries(cpu_backend PUBLIC mlir_cpu_backend) target_link_libraries(cpu_backend PUBLIC mlir_backend)
# TODO: Get rid of the compile time def, and move all MLIR code to separate src files # TODO: Get rid of the compile time def, and move all MLIR code to separate src files
# and add them to cpu_backend here instead. # and add them to cpu_backend here instead.
target_compile_definitions(cpu_backend PRIVATE "NGRAPH_MLIR_ENABLE") target_compile_definitions(cpu_backend PRIVATE "NGRAPH_MLIR_ENABLE")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment