Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
35d8e436
Unverified
Commit
35d8e436
authored
Jan 23, 2020
by
Sang Ik Lee
Committed by
GitHub
Jan 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[MLIR] Enable MLIR ninja build (#4200)
* Temp save. * Enable MLIR ninja build. * Fix issues.
parent
033be233
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
23 deletions
+30
-23
CMakeLists.txt
CMakeLists.txt
+0
-4
external_llvm.cmake
cmake/external_llvm.cmake
+6
-3
external_mlir.cmake
cmake/external_mlir.cmake
+4
-1
llvm_fetch.cmake.in
cmake/llvm_fetch.cmake.in
+10
-10
mlir_fetch.cmake.in
cmake/mlir_fetch.cmake.in
+10
-5
No files found.
CMakeLists.txt
View file @
35d8e436
...
...
@@ -270,10 +270,6 @@ if (NGRAPH_CPU_ENABLE)
message
(
STATUS
"NGRAPH_TBB_ENABLE:
${
NGRAPH_TBB_ENABLE
}
"
)
endif
()
if
(
"
${
CMAKE_GENERATOR
}
"
STREQUAL
"Ninja"
AND NGRAPH_MLIR_ENABLE
)
message
(
FATAL_ERROR
"Ninja generator not supported."
)
endif
()
if
(
NGRAPH_CPU_ENABLE AND NGRAPH_MLIR_ENABLE
)
#MLIR uses the latest version of LLVM which requires C++14.
set
(
NGRAPH_CXX_STANDARD 14
)
...
...
cmake/external_llvm.cmake
View file @
35d8e436
...
...
@@ -19,17 +19,20 @@ set(LLVM_INSTALL_ROOT ${EXTERNAL_PROJECTS_ROOT}/llvm)
configure_file
(
${
CMAKE_SOURCE_DIR
}
/cmake/llvm_fetch.cmake.in
${
LLVM_PROJECT_ROOT
}
/CMakeLists.txt @ONLY
)
execute_process
(
COMMAND
"
${
CMAKE_COMMAND
}
"
-G
"
${
CMAKE_GENERATOR
}
"
-DCMAKE_CXX_FLAGS:STRING=
${
CMAKE_ORIGINAL_CXX_FLAGS
}
.
execute_process
(
COMMAND
"
${
CMAKE_COMMAND
}
"
-G
"
${
CMAKE_GENERATOR
}
"
-DCMAKE_GENERATOR_PLATFORM:STRING=
${
CMAKE_GENERATOR_PLATFORM
}
-DCMAKE_GENERATOR_TOOLSET:STRING=
${
CMAKE_GENERATOR_TOOLSET
}
-DCMAKE_CXX_FLAGS:STRING=
${
CMAKE_ORIGINAL_CXX_FLAGS
}
.
WORKING_DIRECTORY
"
${
LLVM_PROJECT_ROOT
}
"
)
# clone and build llvm
include
(
ProcessorCount
)
ProcessorCount
(
N
)
if
((
"
${
CMAKE_GENERATOR
}
"
STREQUAL
"Unix Makefiles"
)
AND
(
NOT N EQUAL 0
))
execute_process
(
COMMAND
"
${
CMAKE_COMMAND
}
"
--build . --
target ext_llvm --
-j
${
N
}
execute_process
(
COMMAND
"
${
CMAKE_COMMAND
}
"
--build . -- -j
${
N
}
WORKING_DIRECTORY
"
${
LLVM_PROJECT_ROOT
}
"
)
else
()
execute_process
(
COMMAND
"
${
CMAKE_COMMAND
}
"
--build .
--target ext_llvm
execute_process
(
COMMAND
"
${
CMAKE_COMMAND
}
"
--build .
WORKING_DIRECTORY
"
${
LLVM_PROJECT_ROOT
}
"
)
endif
()
...
...
cmake/external_mlir.cmake
View file @
35d8e436
...
...
@@ -45,10 +45,13 @@ set(NGRAPH_LIT_TEST_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/test/mlir)
if
(
NOT NGRAPH_USE_PREBUILT_MLIR
)
configure_file
(
${
CMAKE_SOURCE_DIR
}
/cmake/mlir_fetch.cmake.in
${
MLIR_PROJECT_ROOT
}
/CMakeLists.txt @ONLY
)
execute_process
(
COMMAND
"
${
CMAKE_COMMAND
}
"
-G
"
${
CMAKE_GENERATOR
}
"
.
-DCMAKE_GENERATOR_PLATFORM:STRING=
${
CMAKE_GENERATOR_PLATFORM
}
-DCMAKE_GENERATOR_TOOLSET:STRING=
${
CMAKE_GENERATOR_TOOLSET
}
-DCMAKE_CXX_FLAGS:STRING=
${
CMAKE_ORIGINAL_CXX_FLAGS
}
.
WORKING_DIRECTORY
"
${
MLIR_PROJECT_ROOT
}
"
)
# Clone and build llvm + mlir.
execute_process
(
COMMAND
"
${
CMAKE_COMMAND
}
"
--build .
--target ext_mlir_llvm
execute_process
(
COMMAND
"
${
CMAKE_COMMAND
}
"
--build .
WORKING_DIRECTORY
"
${
MLIR_PROJECT_ROOT
}
"
)
endif
()
...
...
cmake/llvm_fetch.cmake.in
View file @
35d8e436
...
...
@@ -65,13 +65,15 @@ if(NGRAPH_USE_PREBUILT_LLVM)
PREFIX llvm
URL ${LLVM_TARBALL_URL}
URL_HASH SHA1=${LLVM_SHA1_HASH}
CMAKE_GENERATOR "${CMAKE_GENERATOR}"
CMAKE_GENERATOR_PLATFORM "${CMAKE_GENERATOR_PLATFORM}"
CMAKE_GENERATOR_TOOLSET "${CMAKE_GENERATOR_TOOLSET}"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
UPDATE_COMMAND ""
SOURCE_DIR @LLVM_INSTALL_ROOT@
DOWNLOAD_NO_PROGRESS TRUE
EXCLUDE_FROM_ALL TRUE
)
else()
...
...
@@ -108,15 +110,14 @@ else()
PREFIX llvm
GIT_REPOSITORY https://github.com/llvm/llvm-project.git
GIT_TAG llvmorg-8.0.0
CMAKE_GENERATOR "
@CMAKE_GENERATOR@
"
CMAKE_GENERATOR_PLATFORM
@CMAKE_GENERATOR_PLATFORM@
CMAKE_GENERATOR_TOOLSET
@CMAKE_GENERATOR_TOOLSET@
CMAKE_GENERATOR "
${CMAKE_GENERATOR}
"
CMAKE_GENERATOR_PLATFORM
"${CMAKE_GENERATOR_PLATFORM}"
CMAKE_GENERATOR_TOOLSET
"${CMAKE_GENERATOR_TOOLSET}"
UPDATE_COMMAND ""
CONFIGURE_COMMAND ${CMAKE_COMMAND} ../ext_llvm/llvm -G "@CMAKE_GENERATOR@" ${LLVM_CMAKE_ARGS} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
CONFIGURE_COMMAND ${CMAKE_COMMAND} ../ext_llvm/llvm -G "@CMAKE_GENERATOR@"
-DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} -DCMAKE_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET}
${LLVM_CMAKE_ARGS} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
PATCH_COMMAND ${LLVM_PATCH_REVERT_COMMAND}
COMMAND git apply --ignore-space-change --ignore-whitespace @CMAKE_CURRENT_SOURCE_DIR@/cmake/llvm.patch
DOWNLOAD_NO_PROGRESS TRUE
EXCLUDE_FROM_ALL TRUE
)
else()
ExternalProject_Add(
...
...
@@ -125,16 +126,15 @@ else()
GIT_REPOSITORY https://github.com/llvm/llvm-project.git
GIT_TAG llvmorg-8.0.0
GIT_SHALLOW 1
CMAKE_GENERATOR "
@CMAKE_GENERATOR@
"
CMAKE_GENERATOR_PLATFORM
@CMAKE_GENERATOR_PLATFORM@
CMAKE_GENERATOR_TOOLSET
@CMAKE_GENERATOR_TOOLSET@
CMAKE_GENERATOR "
${CMAKE_GENERATOR}
"
CMAKE_GENERATOR_PLATFORM
"${CMAKE_GENERATOR_PLATFORM}"
CMAKE_GENERATOR_TOOLSET
"${CMAKE_GENERATOR_TOOLSET}"
CMAKE_ARGS ${LLVM_CMAKE_ARGS} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
UPDATE_COMMAND ""
PATCH_COMMAND ${LLVM_PATCH_REVERT_COMMAND}
COMMAND git apply --ignore-space-change --ignore-whitespace @CMAKE_CURRENT_SOURCE_DIR@/cmake/llvm.patch
SOURCE_SUBDIR llvm
DOWNLOAD_NO_PROGRESS TRUE
EXCLUDE_FROM_ALL TRUE
)
endif()
endif()
cmake/mlir_fetch.cmake.in
View file @
35d8e436
...
...
@@ -20,6 +20,12 @@ include(ExternalProject)
project(mlir-fetch NONE)
set(MLIR_LLVM_CMAKE_ARGS @NGRAPH_FORWARD_CMAKE_ARGS@
-DLLVM_ENABLE_RTTI=ON
-DLLVM_ENABLE_PROJECTS:STRING=mlir
-DLLVM_BUILD_EXAMPLES=ON
-DLLVM_TARGETS_TO_BUILD=host)
include(ProcessorCount)
ProcessorCount(N)
if(N EQUAL 0)
...
...
@@ -31,15 +37,14 @@ ExternalProject_Add(
PREFIX mlir_llvm
GIT_REPOSITORY @MLIR_LLVM_REPO_URL@
GIT_TAG @MLIR_LLVM_COMMIT_ID@
CMAKE_GENERATOR
@CMAKE_GENERATOR@
CMAKE_GENERATOR_PLATFORM
@CMAKE_GENERATOR_PLATFORM@
CMAKE_GENERATOR_TOOLSET
@CMAKE_GENERATOR_TOOLSET@
CONFIGURE_COMMAND @CMAKE_COMMAND@ @MLIR_LLVM_SOURCE_DIR@ -
DLLVM_ENABLE_PROJECTS=mlir -DLLVM_BUILD_EXAMPLES=ON -DLLVM_TARGETS_TO_BUILD=host -DLLVM_ENABLE_RTTI=ON -DCMAKE_BUILD_TYPE=@CMAKE_BUILD_TYPE@
CMAKE_GENERATOR
"${CMAKE_GENERATOR}"
CMAKE_GENERATOR_PLATFORM
"${CMAKE_GENERATOR_PLATFORM}"
CMAKE_GENERATOR_TOOLSET
"${CMAKE_GENERATOR_TOOLSET}"
CONFIGURE_COMMAND @CMAKE_COMMAND@ @MLIR_LLVM_SOURCE_DIR@ -
G "@CMAKE_GENERATOR@" -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} -DCMAKE_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET} ${MLIR_LLVM_CMAKE_ARGS} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
BUILD_COMMAND @CMAKE_COMMAND@ --build . --target check-mlir -- -j${N}
INSTALL_COMMAND ""
SOURCE_DIR @MLIR_LLVM_ROOT@
BINARY_DIR @MLIR_LLVM_BUILD_DIR@
STAMP_DIR "@MLIR_PROJECT_ROOT@/mlir/stamp"
DOWNLOAD_NO_PROGRESS TRUE
EXCLUDE_FROM_ALL TRUE
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment