-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BYOC][TensorRT] TensorRT BYOC integration (#6395)
* TensorRT integration using JSONRuntime Support input nodes with multiple data entries Fix failing tests Support layout transform, add engine caching Add comment Add PruneSubgraph pass Use prune_subgraph pass, make params member of trt runtime class Hide deprecation warnings coming from TRT headers Remove general prune subgraph Save/load use_implicit_batch and workspace size Clean up Fix cpp lint Addressing review comments Refactor tests Use relay.bind instead of VarReplacer. Improve some annotation functions Add TRT docs Use DLOG, formatting Use logging.info instead of print also refactor integ tests also refactor integ tests Formatting Formatting Format python fix python format Fix pylint Fix sphinx precheck Add tensorrt.rst to toctree Allow codegen to be tested when TRT runtime is not available. Enable TRT codegen in CI linty Address more comments Formatting Formatting * Documentation changes * Address comments * Rename USE_TENSORRT->USE_TENSORRT_CODEGEN and USE_TENSORRT_GRAPH_RUNTIME->USE_TENSORRT_RUNTIME * Fix comment typo * Test CI without TRT codegen enabled * formatting * Enable USE_TENSORRT_CODEGEN in CI * Change file_util.h -> file_utils.h
- Loading branch information
Trevor Morris
authored
Oct 19, 2020
1 parent
28e9ab7
commit af8636a
Showing
17 changed files
with
4,403 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
# TensorRT Codegen only. This can be enabled independently of USE_TENSORRT_RUNTIME to enable | ||
# compilation of TensorRT modules without requiring TensorRT to be installed. The compiled modules | ||
# will only be able to be executed using a TVM built with USE_TENSORRT_RUNTIME=ON. | ||
if(USE_TENSORRT_CODEGEN) | ||
message(STATUS "Build with TensorRT codegen") | ||
file(GLOB COMPILER_TENSORRT_SRCS src/relay/backend/contrib/tensorrt/*.cc) | ||
set_source_files_properties(${COMPILER_TENSORRT_SRCS} PROPERTIES COMPILE_FLAGS "-Wno-deprecated-declarations") | ||
file(GLOB RUNTIME_TENSORRT_SRCS src/runtime/contrib/tensorrt/tensorrt_runtime.cc) | ||
set_source_files_properties(${RUNTIME_TENSORRT_SRCS} PROPERTIES COMPILE_FLAGS "-Wno-deprecated-declarations") | ||
list(APPEND COMPILER_SRCS ${COMPILER_TENSORRT_SRCS}) | ||
list(APPEND COMPILER_SRCS ${RUNTIME_TENSORRT_SRCS}) | ||
endif() | ||
|
||
# TensorRT Runtime | ||
if(USE_TENSORRT_RUNTIME) | ||
if(IS_DIRECTORY ${USE_TENSORRT_RUNTIME}) | ||
set(TENSORRT_ROOT_DIR ${USE_TENSORRT_RUNTIME}) | ||
message(STATUS "Custom TensorRT path: " ${TENSORRT_ROOT_DIR}) | ||
endif() | ||
find_path(TENSORRT_INCLUDE_DIR NvInfer.h HINTS ${TENSORRT_ROOT_DIR} PATH_SUFFIXES include) | ||
find_library(TENSORRT_LIB_DIR nvinfer HINTS ${TENSORRT_ROOT_DIR} PATH_SUFFIXES lib) | ||
find_package_handle_standard_args(TENSORRT DEFAULT_MSG TENSORRT_INCLUDE_DIR TENSORRT_LIB_DIR) | ||
if(NOT TENSORRT_FOUND) | ||
message(ERROR "Could not find TensorRT.") | ||
endif() | ||
message(STATUS "TENSORRT_LIB_DIR: " ${TENSORRT_LIB_DIR}) | ||
include_directories(${TENSORRT_INCLUDE_DIR}) | ||
list(APPEND TVM_RUNTIME_LINKER_LIBS ${TENSORRT_LIB_DIR}) | ||
|
||
# TRT runtime sources | ||
file(GLOB RUNTIME_TENSORRT_SRCS src/runtime/contrib/tensorrt/*.cc) | ||
set_source_files_properties(${RUNTIME_TENSORRT_SRCS} PROPERTIES COMPILE_FLAGS "-Wno-deprecated-declarations") | ||
list(APPEND RUNTIME_SRCS ${RUNTIME_TENSORRT_SRCS}) | ||
|
||
# Set defines | ||
add_definitions(-DTVM_GRAPH_RUNTIME_TENSORRT) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.