Skip to content

Commit b201380

Browse files
authored
[Plugin TRT EP] Complete GetCapability() implementation (#553)
* move code under src * add files for building wheel * rename * update README.md * update README.md * update README.md * add example for running inference using python * update README.md * remove unnecessary files * add GetCapability() implementation * update * remove unnecessary file * Use topo sort for nodes in GetCapability * update ORT to graph proto utils * add default initialization of OrtFactory in ctor * update * update * address reviewer's comments * address reviewer's comments * update
1 parent f1f800a commit b201380

34 files changed

+1067
-897
lines changed

plugin_execution_providers/tensorrt/CMakeLists.txt

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
cmake_minimum_required(VERSION 3.26)
66
project(TensorRTEp VERSION 1.0)
77
set(CMAKE_CXX_STANDARD 17)
8+
set(plugin_ep_common_dir ${CMAKE_SOURCE_DIR}/../common)
9+
include(${plugin_ep_common_dir}/cmake/onnxruntime_library_utils.cmake)
810

911
enable_language(CUDA) # via nvcc to get the CUDA tool kit
1012
file(TO_CMAKE_PATH "/usr/local/cuda" CUDAToolkit_ROOT)
@@ -28,12 +30,17 @@ endif()
2830
add_definitions(-DONNX_NAMESPACE=onnx)
2931
add_definitions(-DONNX_ML)
3032
add_definitions(-DNOMINMAX)
31-
file(GLOB tensorrt_src "./*.cc" "./utils/*.cc" "./cuda/unary_elementwise_ops_impl.cu" "./*.h")
33+
file(GLOB tensorrt_src "./src/*.cc" "./src/utils/*.cc" "./src/cuda/unary_elementwise_ops_impl.cu" "./src/*.h")
3234
add_library(TensorRTEp SHARED ${tensorrt_src})
3335

34-
if (NOT ORT_HOME)
35-
message(FATAL_ERROR "Please specify ORT_HOME, e.g. -DORT_HOME=/path/to/ort/")
36-
endif()
36+
set_onnxruntime_paths(
37+
ORT_HOME ${ORT_HOME}
38+
DEFAULT_ORT_VERSION "1.23.2"
39+
ORT_INCLUDE_DIR_VAR ORT_INCLUDE_DIR
40+
ORT_LIBRARY_DIR_VAR ORT_LIBRARY_DIR)
41+
42+
message(STATUS "ORT_LIBRARY_DIR: ${ORT_LIBRARY_DIR}")
43+
message(STATUS "ORT_INCLUDE_DIR: ${ORT_INCLUDE_DIR}")
3744

3845
if (NOT TENSORRT_HOME)
3946
message(FATAL_ERROR "Please specify TENSORRT_HOME, e.g. -DTENSORRT_HOME=/path/to/trt/")
@@ -111,7 +118,7 @@ if (WIN32) # Windows
111118
"${DEPS_PATH}/onnx-build/${CMAKE_BUILD_TYPE}/onnx_proto.lib")
112119

113120
set(TRT_EP_LIB_LINK_FLAG
114-
"-DEF:${CMAKE_SOURCE_DIR}/tensorrt_execution_provider.def")
121+
"-DEF:${CMAKE_SOURCE_DIR}/src/tensorrt_execution_provider.def")
115122

116123
else() # Linux
117124
set(ORT_LIB "${ORT_HOME}/lib/libonnxruntime.so")
@@ -142,7 +149,7 @@ set_property(TARGET TensorRTEp APPEND_STRING PROPERTY LINK_FLAGS
142149
${TRT_EP_LIB_LINK_FLAG})
143150

144151
target_include_directories(TensorRTEp PUBLIC "${ORT_HOME}/include"
145-
"./utils"
152+
"./src/utils"
146153
"/usr/local/cuda/include"
147154
"${TENSORRT_HOME}/include"
148155
"${DEPS_PATH}/flatbuffers-src/include"

plugin_execution_providers/tensorrt/cuda/cu_inc/unary_elementwise_impl.cuh renamed to plugin_execution_providers/tensorrt/src/cuda/cu_inc/unary_elementwise_impl.cuh

File renamed without changes.

plugin_execution_providers/tensorrt/cuda/unary_elementwise_ops_impl.cu renamed to plugin_execution_providers/tensorrt/src/cuda/unary_elementwise_ops_impl.cu

File renamed without changes.

plugin_execution_providers/tensorrt/cuda/unary_elementwise_ops_impl.h renamed to plugin_execution_providers/tensorrt/src/cuda/unary_elementwise_ops_impl.h

File renamed without changes.

plugin_execution_providers/tensorrt/cuda_allocator.cc renamed to plugin_execution_providers/tensorrt/src/cuda_allocator.cc

File renamed without changes.

plugin_execution_providers/tensorrt/cuda_allocator.h renamed to plugin_execution_providers/tensorrt/src/cuda_allocator.h

File renamed without changes.
File renamed without changes.

plugin_execution_providers/tensorrt/onnx_ctx_model_helper.cc renamed to plugin_execution_providers/tensorrt/src/onnx_ctx_model_helper.cc

File renamed without changes.

plugin_execution_providers/tensorrt/onnx_ctx_model_helper.h renamed to plugin_execution_providers/tensorrt/src/onnx_ctx_model_helper.h

File renamed without changes.

plugin_execution_providers/tensorrt/ort_trt_int8_cal_table.fbs.h renamed to plugin_execution_providers/tensorrt/src/ort_trt_int8_cal_table.fbs.h

File renamed without changes.

0 commit comments

Comments
 (0)