Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TensorRT EP] revert oss parser to 10.7-GA #23710

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmake/deps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ microsoft_wil;https://github.com/microsoft/wil/archive/refs/tags/v1.0.230629.1.z
mimalloc;https://github.com/microsoft/mimalloc/archive/refs/tags/v2.1.1.zip;d5ee7d34223d0567892db5179849939c8769dc41
mp11;https://github.com/boostorg/mp11/archive/refs/tags/boost-1.82.0.zip;9bc9e01dffb64d9e0773b2e44d2f22c51aace063
onnx;https://github.com/onnx/onnx/archive/refs/tags/v1.17.0.zip;13a60ac5217c104139ce0fd024f48628e7bcf5bc
# Use the latest commit of 10.8-GA
onnx_tensorrt;https://github.com/onnx/onnx-tensorrt/archive/118ed0aea197fa9a7d3ea66180a1d5ddb9deecc3.zip;b78aed3728ad4daf6dc47ea10c1d243dee1d95b1
# Use the latest commit of 10.7-GA, with fix towards scatterND
onnx_tensorrt;https://github.com/onnx/onnx-tensorrt/archive/87a6fc947a7a07afcd45eb5adf96a2c57281d18e.zip;70b80ffadd4b79d4ee502a362a480fcc5ddffb45
protobuf;https://github.com/protocolbuffers/protobuf/archive/refs/tags/v21.12.zip;7cf2733949036c7d52fda017badcab093fe73bfa
protoc_win64;https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-win64.zip;b4521f7ada5b260380f94c4bd7f1b7684c76969a
protoc_win32;https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-win32.zip;3688010318192c46ce73213cdfb6b3e5656da874
Expand Down
35 changes: 25 additions & 10 deletions cmake/onnxruntime_providers_tensorrt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
HINTS ${TENSORRT_ROOT}
PATH_SUFFIXES include)


file(READ ${TENSORRT_INCLUDE_DIR}/NvInferVersion.h NVINFER_VER_CONTENT)
string(REGEX MATCH "define NV_TENSORRT_MAJOR * +([0-9]+)" NV_TENSORRT_MAJOR "${NVINFER_VER_CONTENT}")
string(REGEX REPLACE "define NV_TENSORRT_MAJOR * +([0-9]+)" "\\1" NV_TENSORRT_MAJOR "${NV_TENSORRT_MAJOR}")
Expand All @@ -57,16 +56,32 @@
MESSAGE(STATUS "Can't find NV_TENSORRT_MAJOR macro")
endif()

# Check TRT version >= 10.0.1.6
if ((NV_TENSORRT_MAJOR_INT GREATER 10) OR
(NV_TENSORRT_MAJOR_INT EQUAL 10 AND NV_TENSORRT_MINOR_INT GREATER 0) OR
(NV_TENSORRT_MAJOR_INT EQUAL 10 AND NV_TENSORRT_PATCH_INT GREATER 0))
set(TRT_GREATER_OR_EQUAL_TRT_10_GA ON)
endif()

# Check TRT version >= requirement
function(check_trt_version req_major req_minor req_patch out_var)
Copy link
Contributor

@chilo-ms chilo-ms Feb 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is much complex than the original check.
In additions to check 10.0.1, do we need to check other TRT version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far it's not needed. I will clean this

set(version_ok FALSE)
if(NV_TENSORRT_MAJOR_INT GREATER ${req_major})
set(version_ok TRUE)
elseif(NV_TENSORRT_MAJOR_INT EQUAL ${req_major})
if(NV_TENSORRT_MINOR_INT GREATER ${req_minor})
set(version_ok TRUE)
elseif(NV_TENSORRT_MINOR_INT EQUAL ${req_minor})
if(NV_TENSORRT_PATCH_INT GREATER_EQUAL ${req_patch})
set(version_ok TRUE)
endif()
endif()
endif()
set(${out_var} ${version_ok} PARENT_SCOPE)
if(version_ok)
message(STATUS "TensorRT ${NV_TENSORRT_MAJOR_INT}.${NV_TENSORRT_MINOR_INT}.${NV_TENSORRT_PATCH_INT} >= ${req_major}.${req_minor}.${req_patch}.")
else()
message(STATUS "TensorRT ${NV_TENSORRT_MAJOR_INT}.${NV_TENSORRT_MINOR_INT}.${NV_TENSORRT_PATCH_INT} < ${req_major}.${req_minor}.${req_patch}.")
endif()
endfunction()

# TensorRT 10 GA onwards, the TensorRT libraries will have major version appended to the end on Windows,
# for example, nvinfer_10.dll, nvinfer_plugin_10.dll, nvonnxparser_10.dll ...
if (WIN32 AND TRT_GREATER_OR_EQUAL_TRT_10_GA)
check_trt_version(10 0 1 TRT_VERSION_OK_10_0_1)
if (WIN32 AND TRT_VERSION_OK_10_0_1)
set(NVINFER_LIB "nvinfer_${NV_TENSORRT_MAJOR}")
set(NVINFER_PLUGIN_LIB "nvinfer_plugin_${NV_TENSORRT_MAJOR}")
set(PARSER_LIB "nvonnxparser_${NV_TENSORRT_MAJOR}")
Expand Down Expand Up @@ -116,7 +131,7 @@
set(TENSORRT_LIBRARY ${TENSORRT_LIBRARY_INFER} ${TENSORRT_LIBRARY_INFER_PLUGIN} ${TENSORRT_LIBRARY_NVONNXPARSER})
MESSAGE(STATUS "Find TensorRT libs at ${TENSORRT_LIBRARY}")
else()
if (TRT_GREATER_OR_EQUAL_TRT_10_GA)
if (TRT_VERSION_OK_10_0_1)
set(ONNX_USE_LITE_PROTO ON)
endif()
onnxruntime_fetchcontent_declare(
Expand Down
Loading