Support LLVM trunk (#3907)
* support LLVM trunk * guard with USE_LLVM in if condition for c++14 * GREATER_EQUAL -> GREATER
This commit is contained in:
Родитель
6604593bef
Коммит
8c50469c6d
|
@ -90,15 +90,13 @@ if(MSVC)
|
|||
endforeach(flag_var)
|
||||
endif()
|
||||
else(MSVC)
|
||||
include(CheckCXXCompilerFlag)
|
||||
check_cxx_compiler_flag("-std=c++11" SUPPORT_CXX11)
|
||||
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||
message("Build in Debug mode")
|
||||
set(CMAKE_C_FLAGS "-O0 -g -Wall -fPIC ${CMAKE_C_FLAGS} -rdynamic")
|
||||
set(CMAKE_CXX_FLAGS "-O0 -g -Wall -fPIC -std=c++11 ${CMAKE_CXX_FLAGS} -rdynamic")
|
||||
set(CMAKE_CXX_FLAGS "-O0 -g -Wall -fPIC ${CMAKE_CXX_FLAGS} -rdynamic")
|
||||
else()
|
||||
set(CMAKE_C_FLAGS "-O2 -Wall -fPIC ${CMAKE_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "-O2 -Wall -fPIC -std=c++11 ${CMAKE_CXX_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "-O2 -Wall -fPIC ${CMAKE_CXX_FLAGS}")
|
||||
if (HIDE_PRIVATE_SYMBOLS)
|
||||
message("Hide private symbols...")
|
||||
set(CMAKE_C_FLAGS "-fvisibility=hidden ${CMAKE_C_FLAGS}")
|
||||
|
@ -245,6 +243,19 @@ include(cmake/modules/contrib/Sort.cmake)
|
|||
include(cmake/modules/contrib/NNPack.cmake)
|
||||
include(cmake/modules/contrib/HybridDump.cmake)
|
||||
|
||||
if(NOT MSVC)
|
||||
include(CheckCXXCompilerFlag)
|
||||
if(NOT USE_LLVM STREQUAL "OFF" AND TVM_LLVM_VERSION GREATER 91)
|
||||
check_cxx_compiler_flag("-std=c++14" SUPPORT_CXX14)
|
||||
message(STATUS "Build with c++14")
|
||||
set(CMAKE_CXX_FLAGS "-std=c++14 ${CMAKE_CXX_FLAGS}")
|
||||
else()
|
||||
check_cxx_compiler_flag("-std=c++11" SUPPORT_CXX11)
|
||||
message(STATUS "Build with c++11")
|
||||
set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(tvm SHARED ${COMPILER_SRCS} ${RUNTIME_SRCS})
|
||||
add_library(tvm_topi SHARED ${TOPI_SRCS})
|
||||
add_library(tvm_runtime SHARED ${RUNTIME_SRCS})
|
||||
|
|
|
@ -423,8 +423,13 @@ void CodeGenLLVM::GetAlignment(Type t,
|
|||
|
||||
std::unique_ptr<CodeGenLLVM::DebugInfo>
|
||||
CodeGenLLVM::CreateDebugInfo(llvm::Module* module) {
|
||||
#if TVM_LLVM_VERSION >= 100
|
||||
auto debug_info = std::make_unique<CodeGenLLVM::DebugInfo>();
|
||||
debug_info->di_builder_ = std::make_unique<llvm::DIBuilder>(*module);
|
||||
#else
|
||||
auto debug_info = llvm::make_unique<CodeGenLLVM::DebugInfo>();
|
||||
debug_info->di_builder_ = llvm::make_unique<llvm::DIBuilder>(*module);
|
||||
#endif
|
||||
// TODO(tulloch): pass this information through relay::Span classes to the LoweredFunc instance?
|
||||
debug_info->file_ = debug_info->di_builder_->createFile("model.tvm", "/tmp/");
|
||||
debug_info->compilation_unit_ = debug_info->di_builder_->createCompileUnit(
|
||||
|
|
Загрузка…
Ссылка в новой задаче