Unverified Commit 321f32f5 authored by Scott Cyphers's avatar Scott Cyphers Committed by GitHub

Merge branch 'master' into cyphers/typename

parents d41a8b19 f6425cbd
......@@ -47,10 +47,23 @@ execute_process(COMMAND "${CMAKE_COMMAND}" --build . --target ext_mlir_llvm
execute_process(COMMAND "${CMAKE_COMMAND}" --build . --target ext_mlir
WORKING_DIRECTORY "${MLIR_PROJECT_ROOT}")
# point find_package to the pre-built libs
set(LLVM_DIR ${MLIR_LLVM_ROOT}/build/lib/cmake/llvm)
# Enable modules for LLVM.
set(LLVM_DIR "${MLIR_BUILD_DIR}/lib/cmake/llvm"
CACHE PATH "Path to LLVM cmake modules")
list(APPEND CMAKE_MODULE_PATH "${LLVM_DIR}")
include(AddLLVM)
# Enable LLVM package, definitions and env vars.
find_package(LLVM REQUIRED CONFIG)
add_definitions(${LLVM_DEFINITIONS})
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using modules in: ${LLVM_DIR}")
message(STATUS "LLVM RTTI is ${LLVM_ENABLE_RTTI}")
set(MLIR_SRC_INCLUDE_PATH ${MLIR_SOURCE_DIR}/include)
set(MLIR_BIN_INCLUDE_PATH ${MLIR_BUILD_DIR}/projects/mlir/include)
set(MLIR_INCLUDE_PATHS ${MLIR_SRC_INCLUDE_PATH};${MLIR_BIN_INCLUDE_PATH})
set(MLIR_INCLUDE_PATHS ${MLIR_SRC_INCLUDE_PATH};${MLIR_BIN_INCLUDE_PATH})
set(MLIR_LLVM_INCLUDE_PATH ${LLVM_INCLUDE_DIRS})
message(STATUS "MLIR headers at: ${MLIR_INCLUDE_PATHS}")
message(STATUS "LLVM headers at: ${MLIR_LLVM_INCLUDE_PATH}")
......@@ -14,4 +14,12 @@
# limitations under the License.
# ******************************************************************************
# Common MLIR/LLVM setup for the sub-directories below
include_directories(
${NGRAPH_INCLUDE_PATH}
${MLIR_LLVM_INCLUDE_PATH}
${MLIR_INCLUDE_PATHS}
)
add_subdirectory(compiler)
......@@ -27,24 +27,6 @@ set(SRC
add_library(mlir_backend SHARED ${SRC})
message(STATUS "LLVM Directory: ${LLVM_DIR}")
# Link LLVM and MLIR
find_package(LLVM REQUIRED CONFIG)
set(MLIR_LLVM_INCLUDEPATH ${LLVM_INCLUDE_DIRS})
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
message(STATUS "LLVM RTTI is ${LLVM_ENABLE_RTTI}")
add_definitions(${LLVM_DEFINITIONS})
target_include_directories(mlir_backend PRIVATE ${LLVM_INCLUDE_DIRS})
message(STATUS "MLIR Headers at : ${MLIR_INCLUDE_PATHS}")
message(STATUS "LLVM Headers at : ${MLIR_LLVM_INCLUDEPATH}")
target_include_directories(mlir_backend PRIVATE ${MLIR_INCLUDE_PATHS})
llvm_map_components_to_libnames(llvm_libs support core irreader)
# Link MLIR libs
......
......@@ -233,10 +233,8 @@ if (NGRAPH_CPU_ENABLE)
DEFINITION MLIR_LLVM_INCLUDEPATH)
message(STATUS "Building CPU backend with MLIR")
message(STATUS "MLIR INCLUDE DIRS: ${MLIR_INCLUDE_PATHS}")
message(STATUS "LLVM INCLUDE DIRS: ${MLIR_LLVM_INCLUDEPATH}")
add_dependencies(cpu_backend mlir_backend)
target_include_directories(cpu_backend PUBLIC ${MLIR_INCLUDE_PATHS} ${MLIR_LLVM_INCLUDEPATH})
target_include_directories(cpu_backend PUBLIC ${MLIR_INCLUDE_PATHS} ${MLIR_LLVM_INCLUDE_PATH})
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
# and add them to cpu_backend here instead.
......
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