onnx-mlir/CMakeLists.txt

43 lines
1.2 KiB
CMake
Raw Normal View History

# TODO: remove for release.
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "build type")
endif()
# Require 3.3 and set policy CMP0057 for IN_LIST operator support
cmake_minimum_required(VERSION 3.3)
cmake_policy(SET CMP0057 NEW)
project(onnx-mlir)
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
set(ONNX_MLIR_SRC_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
set(ONNX_MLIR_BIN_ROOT "${CMAKE_CURRENT_BINARY_DIR}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
2019-12-23 09:33:33 +08:00
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
include(CTest)
include(MLIR.cmake)
if (MSVC)
# Disable warnings that prevent building of dependencies
# like onnx
set(CMAKE_CXX_FLAGS "-wd4244 -wd4267 -wd4530 -wd4624 /bigobj")
endif()
2019-12-20 03:24:37 +08:00
add_subdirectory(third_party/onnx)
add_subdirectory(third_party/googletest)
Cleanup rtmemref api (#238) * Detect llvm-project commit change in utils/clone-mlir.sh and rebuild llvm-project for zLinux Jenkins build bot * Cleanup RtMemRef API - use forward declaration to hide private data fields - RtMemRef.h: external user header, C/C++ - _RtMemRef.h: internal user header, C++ only - RtMemRef.hpp and RtMemRef.cpp: implementation header and file - add external APIs OrderedRtMemRefDict *ormrd_create(RtMemRef **rmrs, int n) RtMemRef **ormrd_getRmrs(OrderedRtMemRefDict *ormrd) int ormrd_getNumOfRmrs(OrderedRtMemRefDict *ormrd) for creating and querying OrderedRtMemRefDict with RtMemRef arrays - data buffer installed by rmr_setData() will be managed by user - unique_ptr<RtMemRef> must use custom deleter <RtMemRef,decltype(&rmr_destroy)> * See if I have write access. * Remove test CMake code. * Use new API. * Format code. * Format code & rename variables for readability. * Remove used API spec. * Rename OrderedRtMemRefDict -> RtMemRefList, _dataMalloc -> _owningData. * OrderedRtMemRefDict -> RtMemRefList * Update KrnlToLLVM.cpp * Trigger Jenkins * Restart Jenkins * OrderedRtMemRefDict -> RtRmrRefList * More OrderedRtMemRefDict -> RtMemRefList. * Format jni wrapper. * Rename API functions to maintain stylistic consistency. * Bug fix. * Bug fix. * Format code. * Fix RtMemRefUtils. * Format code. * Using llvm function naming scheme. * Rename runtime api file name to project name (onnx-mlir) as per convention. * Include the new runtime header file. * Reflect api header file name change in build script. * Bug fix. * Remove C++ code. * Revert "Remove C++ code." This reverts commit b217dfabae99e42db30721600cb5507866d4dc98. * Clarify memory management responsibility. * Add constructor to specify name & data ownership. * Include stdbool. * Remove dictionary semantics from RtMemRefList * Bug fix. * Format code. * Format code. * Use macro to define database of metadata. * Prevent formatter from acting on metadata decl. * Nit. * Restore backend unit tests. * Use spaces instead of tabs for better formatting. * Use explicit template instantiation. * Update RtMemRef struct doc. * Make runtime compilable both in c and c++ mode. Build two versions of the runtime library, one c version as the user-facing c runtime, and one c++ version as the one used inside this project. * Bug fix, avoid stack allocation for output rmr list. * Change _dyn_entry_point_main_graph -> run_main_graph for better memorability. * Write a complete introductory tutorial on c99 Runtime and a test for it. * Add onnx installation as dependency. * Use target_include_directory to avoid installation. * Format code. * Fix cmake target_include_directories. * Address compiler warning. * First pass of RtMemRef->OMTensor. * Second pass of RtMemRef -> OMTensor. * nit, omtList -> omTensorList. * omt -> omTensor for clarity. * Rename OnnxMlirInternal.h -> OnnxMlirRuntime.hpp because there's no internal/external API, only C/C++ API. * Format code. * Restructure Runtime source code and move header -> /include and test -> /test/unit. * Bugfix. * Format code. * Add unit test for OMTensor ctor. * Update JNI CMake include directory. * Bugfix. * No need to re-declare ONNX types. * Disable runtime doc test on non-x86 platforms. * Rename OMTensor fields to be more sensible. * Fix data type mismatch. * size_t -> int64_t, prefer fixed width integers. * Use consistent header guard style. * Further tweak OMTensor API. * Bugfix. * Bugfix. * Format code. * Add doxygen config file. * Tweak OMTensor API. * Tweak API doc, hide OMTensorList implementation. * Format code. * Add new documentation item for Runtime API. * Hide internal use only API declarations, move their comments to their implementations. * Clarify ownership semantics in relevant API documentations. * Fix PyRuntime. * Remove alignment concerns from public API and include explaination of alignment issue in struct OMTensor definition. * Print out unsupported numpy dtype. * Use preferred way of type comparison in pybind11. * Debug s390x issue. * Remove debug code. * Clarify semantics of strides/shape setter/getter, use \brief to include short description of API function. * Improve documentation. * Single out unpolished C++ API declarations. * Clarify OMTensorList API. * Bugfix. * Bugfix. * Assert after malloc. * Handle malloc failures. * Nit. * Tweak legal notices. * Format code. * Remove doxygen generated files. * Tweak legal notice format. * Upgrade Cython Numpy installation depends on Cython. Co-authored-by: Tian Jin <tjingrant@gmail.com>
2020-10-10 22:32:09 +08:00
SET(BENCHMARK_ENABLE_GTEST_TESTS OFF)
2019-12-20 03:24:37 +08:00
add_subdirectory(third_party/benchmark)
add_subdirectory(third_party/pybind11)
add_subdirectory(third_party/variant)
add_subdirectory(third_party/rapidcheck)
2019-12-20 03:24:37 +08:00
set(CMAKE_CXX_STANDARD 14)
add_subdirectory(utils)
Cleanup rtmemref api (#238) * Detect llvm-project commit change in utils/clone-mlir.sh and rebuild llvm-project for zLinux Jenkins build bot * Cleanup RtMemRef API - use forward declaration to hide private data fields - RtMemRef.h: external user header, C/C++ - _RtMemRef.h: internal user header, C++ only - RtMemRef.hpp and RtMemRef.cpp: implementation header and file - add external APIs OrderedRtMemRefDict *ormrd_create(RtMemRef **rmrs, int n) RtMemRef **ormrd_getRmrs(OrderedRtMemRefDict *ormrd) int ormrd_getNumOfRmrs(OrderedRtMemRefDict *ormrd) for creating and querying OrderedRtMemRefDict with RtMemRef arrays - data buffer installed by rmr_setData() will be managed by user - unique_ptr<RtMemRef> must use custom deleter <RtMemRef,decltype(&rmr_destroy)> * See if I have write access. * Remove test CMake code. * Use new API. * Format code. * Format code & rename variables for readability. * Remove used API spec. * Rename OrderedRtMemRefDict -> RtMemRefList, _dataMalloc -> _owningData. * OrderedRtMemRefDict -> RtMemRefList * Update KrnlToLLVM.cpp * Trigger Jenkins * Restart Jenkins * OrderedRtMemRefDict -> RtRmrRefList * More OrderedRtMemRefDict -> RtMemRefList. * Format jni wrapper. * Rename API functions to maintain stylistic consistency. * Bug fix. * Bug fix. * Format code. * Fix RtMemRefUtils. * Format code. * Using llvm function naming scheme. * Rename runtime api file name to project name (onnx-mlir) as per convention. * Include the new runtime header file. * Reflect api header file name change in build script. * Bug fix. * Remove C++ code. * Revert "Remove C++ code." This reverts commit b217dfabae99e42db30721600cb5507866d4dc98. * Clarify memory management responsibility. * Add constructor to specify name & data ownership. * Include stdbool. * Remove dictionary semantics from RtMemRefList * Bug fix. * Format code. * Format code. * Use macro to define database of metadata. * Prevent formatter from acting on metadata decl. * Nit. * Restore backend unit tests. * Use spaces instead of tabs for better formatting. * Use explicit template instantiation. * Update RtMemRef struct doc. * Make runtime compilable both in c and c++ mode. Build two versions of the runtime library, one c version as the user-facing c runtime, and one c++ version as the one used inside this project. * Bug fix, avoid stack allocation for output rmr list. * Change _dyn_entry_point_main_graph -> run_main_graph for better memorability. * Write a complete introductory tutorial on c99 Runtime and a test for it. * Add onnx installation as dependency. * Use target_include_directory to avoid installation. * Format code. * Fix cmake target_include_directories. * Address compiler warning. * First pass of RtMemRef->OMTensor. * Second pass of RtMemRef -> OMTensor. * nit, omtList -> omTensorList. * omt -> omTensor for clarity. * Rename OnnxMlirInternal.h -> OnnxMlirRuntime.hpp because there's no internal/external API, only C/C++ API. * Format code. * Restructure Runtime source code and move header -> /include and test -> /test/unit. * Bugfix. * Format code. * Add unit test for OMTensor ctor. * Update JNI CMake include directory. * Bugfix. * No need to re-declare ONNX types. * Disable runtime doc test on non-x86 platforms. * Rename OMTensor fields to be more sensible. * Fix data type mismatch. * size_t -> int64_t, prefer fixed width integers. * Use consistent header guard style. * Further tweak OMTensor API. * Bugfix. * Bugfix. * Format code. * Add doxygen config file. * Tweak OMTensor API. * Tweak API doc, hide OMTensorList implementation. * Format code. * Add new documentation item for Runtime API. * Hide internal use only API declarations, move their comments to their implementations. * Clarify ownership semantics in relevant API documentations. * Fix PyRuntime. * Remove alignment concerns from public API and include explaination of alignment issue in struct OMTensor definition. * Print out unsupported numpy dtype. * Use preferred way of type comparison in pybind11. * Debug s390x issue. * Remove debug code. * Clarify semantics of strides/shape setter/getter, use \brief to include short description of API function. * Improve documentation. * Single out unpolished C++ API declarations. * Clarify OMTensorList API. * Bugfix. * Bugfix. * Assert after malloc. * Handle malloc failures. * Nit. * Tweak legal notices. * Format code. * Remove doxygen generated files. * Tweak legal notice format. * Upgrade Cython Numpy installation depends on Cython. Co-authored-by: Tian Jin <tjingrant@gmail.com>
2020-10-10 22:32:09 +08:00
add_subdirectory(include)
2019-12-20 03:24:37 +08:00
add_subdirectory(src)
add_subdirectory(docs)
add_subdirectory(test)