diff --git a/cmake/onnxruntime_providers.cmake b/cmake/onnxruntime_providers.cmake index 53508e64d0..39e00e2592 100644 --- a/cmake/onnxruntime_providers.cmake +++ b/cmake/onnxruntime_providers.cmake @@ -696,7 +696,9 @@ if (onnxruntime_USE_TENSORRT) endif() include_directories(${TENSORRT_INCLUDE_DIR}) - + # ${TENSORRT_LIBRARY} is empty if we link nvonnxparser_static. + # nvonnxparser_static is linked against tensorrt libraries in onnx-tensorrt + # See https://github.com/onnx/onnx-tensorrt/blob/8af13d1b106f58df1e98945a5e7c851ddb5f0791/CMakeLists.txt#L121 set(trt_link_libs cudnn cublas ${CMAKE_DL_LIBS} ${TENSORRT_LIBRARY}) file(GLOB_RECURSE onnxruntime_providers_tensorrt_cc_srcs CONFIGURE_DEPENDS diff --git a/tools/ci_build/build.py b/tools/ci_build/build.py index 1e9681be0c..2a32a8bcf2 100644 --- a/tools/ci_build/build.py +++ b/tools/ci_build/build.py @@ -499,7 +499,10 @@ def parse_arguments(): "--use_tvm_hash", action="store_true", help="Build ipp-crypto for hash generation. It is used by TVM EP only" ) parser.add_argument("--use_tensorrt", action="store_true", help="Build with TensorRT") - parser.add_argument("--use_tensorrt_builtin_parser", action="store_true", help="Use TensorRT builtin parser") + parser.add_argument( + "--use_tensorrt_builtin_parser", action="store_true", default=True, help="Use TensorRT builtin parser" + ) + parser.add_argument("--use_tensorrt_oss_parser", action="store_true", help="Use TensorRT OSS parser") parser.add_argument( "--tensorrt_placeholder_builder", action="store_true", help="Instantiate Placeholder TensorRT Builder" ) @@ -916,7 +919,8 @@ def generate_build_tree( "-Donnxruntime_USE_TENSORRT=" + ("ON" if args.use_tensorrt else "OFF"), "-Donnxruntime_SKIP_AND_PERFORM_FILTERED_TENSORRT_TESTS=" + ("ON" if not args.tensorrt_placeholder_builder else "OFF"), - "-Donnxruntime_USE_TENSORRT_BUILTIN_PARSER=" + ("ON" if args.use_tensorrt_builtin_parser else "OFF"), + "-Donnxruntime_USE_TENSORRT_BUILTIN_PARSER=" + + ("ON" if args.use_tensorrt_builtin_parser and not args.use_tensorrt_oss_parser else "OFF"), "-Donnxruntime_TENSORRT_PLACEHOLDER_BUILDER=" + ("ON" if args.tensorrt_placeholder_builder else "OFF"), # set vars for TVM "-Donnxruntime_USE_TVM=" + ("ON" if args.use_tvm else "OFF"),