Skip to content

Commit

Permalink
Update the mainline to include Release 1.7.0 rc (#312)
Browse files Browse the repository at this point in the history
* Use TVM 1.7

* Use release-1.7.0-rc branch from neo-ai/tvm

* Adding #7027 in TVM Submodule

* Adding #183 in TVM Submodule

Co-authored-by: Trevor Morris <[email protected]>
Co-authored-by: Tushar Dey <[email protected]>
  • Loading branch information
3 people authored Dec 15, 2020
1 parent 9a0cf82 commit d363c08
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 77 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/tvm
Submodule tvm updated 1373 files
70 changes: 8 additions & 62 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required (VERSION 3.6)
include(cmake/Utils.cmake)
include(3rdparty/tvm/cmake/util/Util.cmake)
include(3rdparty/tvm/cmake/util/FindCUDA.cmake)
include(3rdparty/tvm/cmake/utils/Utils.cmake)
include(3rdparty/tvm/cmake/utils/FindCUDA.cmake)

# Option for Android on Arm --- has to come before project() function
option(ANDROID_BUILD "Build for Android target" OFF)
Expand Down Expand Up @@ -213,68 +213,14 @@ if(USE_TENSORRT)
include_directories(${TENSORRT_INCLUDE_DIR})
list(APPEND DLR_LINKER_LIBS ${TENSORRT_LIB_DIR})

# NNVM TRT Integration
file(GLOB TENSORRT_SRCS ${TVM_SRC}/src/contrib/subgraph/*.cc)
list(APPEND DLR_SRC ${TENSORRT_SRCS})
# TRT runtime sources
file(GLOB RUNTIME_TENSORRT_SRCS ${TVM_SRC}/src/runtime/contrib/tensorrt/*.cc)
set_source_files_properties(${RUNTIME_TENSORRT_SRCS} PROPERTIES COMPILE_FLAGS "-Wno-deprecated-declarations")
list(APPEND DLR_SRC ${RUNTIME_TENSORRT_SRCS})

# Set defines
add_definitions(-DTVM_GRAPH_RUNTIME_TENSORRT)

# TRT Relay sources
file(GLOB TENSORRT_RELAY_SRCS ${TVM_SRC}/src/runtime/contrib/tensorrt/*.cc)
list(APPEND DLR_SRC ${TENSORRT_RELAY_SRCS})
# Additional TVM compiler sources
include_directories("${TVM_SRC}/3rdparty/rang/include")
include_directories("${TVM_SRC}/3rdparty/compiler-rt")
include_directories("${TVM_SRC}/topi/include")
file(GLOB_RECURSE COMPILER_SRCS
${TVM_SRC}/src/auto_scheduler/*.cc
${TVM_SRC}/src/node/*.cc
${TVM_SRC}/src/ir/*.cc
${TVM_SRC}/src/arith/*.cc
${TVM_SRC}/src/te/*.cc
${TVM_SRC}/src/autotvm/*.cc
${TVM_SRC}/src/tir/*.cc
${TVM_SRC}/src/topi/*.cc
${TVM_SRC}/src/driver/*.cc
${TVM_SRC}/src/parser/*.cc
${TVM_SRC}/src/printer/*.cc
${TVM_SRC}/src/support/*.cc
)
file(GLOB CODEGEN_SRCS
${TVM_SRC}/src/target/*.cc
${TVM_SRC}/src/target/source/*.cc
)
list(APPEND COMPILER_SRCS ${CODEGEN_SRCS})
file(GLOB_RECURSE RELAY_OP_SRCS
${TVM_SRC}/src/relay/op/*.cc
)
file(GLOB_RECURSE RELAY_PASS_SRCS
${TVM_SRC}/src/relay/analysis/*.cc
${TVM_SRC}/src/relay/transforms/*.cc
${TVM_SRC}/src/relay/quantize/*.cc
)
file(GLOB RELAY_BACKEND_SRCS
${TVM_SRC}/src/relay/backend/*.cc
${TVM_SRC}/src/relay/backend/vm/*.cc
)
file(GLOB_RECURSE RELAY_IR_SRCS
${TVM_SRC}/src/relay/ir/*.cc
)
file(GLOB_RECURSE RELAY_QNN_SRCS
${TVM_SRC}/src/relay/qnn/*.cc
)
list(APPEND COMPILER_SRCS ${RELAY_OP_SRCS})
list(APPEND COMPILER_SRCS ${RELAY_PASS_SRCS})
list(APPEND COMPILER_SRCS ${RELAY_BACKEND_SRCS})
list(APPEND COMPILER_SRCS ${RELAY_IR_SRCS})
list(APPEND COMPILER_SRCS ${RELAY_QNN_SRCS})
file(GLOB DATATYPE_SRCS ${TVM_SRC}/src/target/datatype/*.cc)
list(APPEND COMPILER_SRCS ${DATATYPE_SRCS})
list(APPEND COMPILER_SRCS ${TVM_SRC}/src/target/opt/build_metal_off.cc)
list(APPEND COMPILER_SRCS ${TVM_SRC}/src/target/opt/build_sdaccel_off.cc)
list(APPEND COMPILER_SRCS ${TVM_SRC}/src/target/opt/build_aocl_off.cc)
list(APPEND COMPILER_SRCS ${TVM_SRC}/src/target/opt/build_opencl_off.cc)
list(APPEND COMPILER_SRCS ${TVM_SRC}/src/runtime/container.cc)
list(APPEND DLR_SRC ${COMPILER_SRCS})
set(USE_TENSORRT OFF)
endif()
if(WITH_HEXAGON)
Expand Down
2 changes: 1 addition & 1 deletion include/dlr.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extern "C" { // Open extern "C" block
/*! \brief major version */
#define DLR_MAJOR 1
/*! \brief minor version */
#define DLR_MINOR 6
#define DLR_MINOR 7
/*! \brief patch version */
#define DLR_PATCH 0
/*! \brief DLR version */
Expand Down
2 changes: 1 addition & 1 deletion python/dlr/metadata.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
NAME = ['DLRModel']

VERSION = "1.6.0"
VERSION = "1.7.0"
16 changes: 12 additions & 4 deletions src/dlr_relayvm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,16 @@ void RelayVMModel::SetupVMModule(const std::vector<DLRModelElem>& model_elems) {
vm_module_ = std::make_shared<tvm::runtime::Module>(tvm::runtime::Module(vm));

tvm::runtime::PackedFunc init = vm_module_->GetFunction("init");
init(static_cast<int>(ctx_.device_type), ctx_.device_id,
static_cast<int>(tvm::runtime::vm::AllocatorType::kPooled));
if (ctx_.device_type == DLDeviceType::kDLCPU) {
init(static_cast<int>(ctx_.device_type), ctx_.device_id,
static_cast<int>(tvm::runtime::vm::AllocatorType::kPooled));
} else {
// CPU context also must be initialized because input/output data comes from CPU.
init(static_cast<int>(ctx_.device_type), ctx_.device_id,
static_cast<int>(tvm::runtime::vm::AllocatorType::kPooled),
static_cast<int>(DLDeviceType::kDLCPU), 0,
static_cast<int>(tvm::runtime::vm::AllocatorType::kPooled));
}
}

void RelayVMModel::FetchInputNodesData() {
Expand Down Expand Up @@ -268,7 +276,7 @@ void RelayVMModel::SetInput(const char* name, const int64_t* shape, const void*
DLDataType dtype = GetInputDLDataType(index);
DLTensor input_tensor;
input_tensor.data = const_cast<void*>(input);
input_tensor.ctx = ctx_;
input_tensor.ctx = DLContext{DLDeviceType::kDLCPU, 0};
input_tensor.ndim = dim;
input_tensor.shape = const_cast<int64_t*>(shape);
input_tensor.strides = nullptr;
Expand Down Expand Up @@ -357,7 +365,7 @@ void RelayVMModel::GetOutput(int index, void* output) {
}
DLTensor output_tensor;
output_tensor.data = output;
output_tensor.ctx = ctx_;
output_tensor.ctx = DLContext{DLDeviceType::kDLCPU, 0};
output_tensor.ndim = out_array->ndim;
output_tensor.dtype = out_array->dtype;
output_tensor.shape = out_array->shape;
Expand Down
2 changes: 1 addition & 1 deletion src/dlr_tvm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void TVMModel::SetupTVMModule(const std::vector<DLRModelElem>& model_elems) {
module = tvm::runtime::Module::LoadFromFile(model_lib_path);

tvm_graph_runtime_ = tvm::runtime::make_object<tvm::runtime::GraphRuntime>();
tvm_graph_runtime_->Init(graph_str, module, {ctx_});
tvm_graph_runtime_->Init(graph_str, module, {ctx_}, nullptr);
dmlc::MemoryFixedSizeStream strm(const_cast<char*>(params_data), params_size);
tvm_graph_runtime_->LoadParams(&strm);

Expand Down
7 changes: 0 additions & 7 deletions version.json

This file was deleted.

0 comments on commit d363c08

Please sign in to comment.