diff --git a/cmake/onnxruntime_providers_nv.cmake b/cmake/onnxruntime_providers_nv.cmake index 6dfacedb0f124..06d44b5289518 100644 --- a/cmake/onnxruntime_providers_nv.cmake +++ b/cmake/onnxruntime_providers_nv.cmake @@ -30,13 +30,6 @@ endif() set(CXX_VERSION_DEFINED TRUE) - # There is an issue when running "Debug build" NV EP with "Release build" TRT builtin parser on Windows. - # We enforce following workaround for now until the real fix. - if (WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug") - set(onnxruntime_USE_TENSORRT_BUILTIN_PARSER OFF) - MESSAGE(STATUS "[Note] There is an issue when running \"Debug build\" TRT EP with \"Release build\" TRT built-in parser on Windows. This build will use tensorrt oss parser instead.") - endif() - find_path(TENSORRT_INCLUDE_DIR NvInfer.h HINTS ${TENSORRT_ROOT} PATH_SUFFIXES include) diff --git a/onnxruntime/core/providers/nv_tensorrt_rtx/nv_execution_provider.cc b/onnxruntime/core/providers/nv_tensorrt_rtx/nv_execution_provider.cc index 020d4be56580e..265ab265d461b 100644 --- a/onnxruntime/core/providers/nv_tensorrt_rtx/nv_execution_provider.cc +++ b/onnxruntime/core/providers/nv_tensorrt_rtx/nv_execution_provider.cc @@ -514,7 +514,7 @@ bool ApplyProfileShapesFromProviderOptions(std::vectorisShapeTensor()) { int shape_size = nb_dims == 0 ? 1 : static_cast(profile_min_shapes[input_name][i].size()); - std::vector shapes_min(shape_size), shapes_opt(shape_size), shapes_max(shape_size); + std::vector shapes_min(shape_size), shapes_opt(shape_size), shapes_max(shape_size); LOGS_DEFAULT(VERBOSE) << "[Nv EP] shape size of this shape tensor is " << shape_size; @@ -522,9 +522,9 @@ bool ApplyProfileShapesFromProviderOptions(std::vector(min_value); - shapes_max[j] = static_cast(max_value); - shapes_opt[j] = static_cast(opt_value); + shapes_min[j] = static_cast(min_value); + shapes_max[j] = static_cast(max_value); + shapes_opt[j] = static_cast(opt_value); LOGS_DEFAULT(VERBOSE) << "[Nv EP] shapes_min.d[" << j << "] is " << shapes_min[j]; LOGS_DEFAULT(VERBOSE) << "[Nv EP] shapes_max.d[" << j << "] is " << shapes_max[j]; LOGS_DEFAULT(VERBOSE) << "[Nv EP] shapes_opt.d[" << j << "] is " << shapes_opt[j]; @@ -538,9 +538,9 @@ bool ApplyProfileShapesFromProviderOptions(std::vector(j)][i].push_back(opt_value); } - trt_profile->setShapeValues(input_name.c_str(), nvinfer1::OptProfileSelector::kMIN, &shapes_min[0], shape_size); - trt_profile->setShapeValues(input_name.c_str(), nvinfer1::OptProfileSelector::kMAX, &shapes_max[0], shape_size); - trt_profile->setShapeValues(input_name.c_str(), nvinfer1::OptProfileSelector::kOPT, &shapes_opt[0], shape_size); + trt_profile->setShapeValuesV2(input_name.c_str(), nvinfer1::OptProfileSelector::kMIN, &shapes_min[0], shape_size); + trt_profile->setShapeValuesV2(input_name.c_str(), nvinfer1::OptProfileSelector::kMAX, &shapes_max[0], shape_size); + trt_profile->setShapeValuesV2(input_name.c_str(), nvinfer1::OptProfileSelector::kOPT, &shapes_opt[0], shape_size); } // Execution tensor else { @@ -627,15 +627,15 @@ Status ApplyProfileShapesFromInputTensorValue(std::vectorisShapeTensor()) { // shape tensor int shape_size = nb_dims == 0 ? 1 : static_cast(tensor_shapes[0]); - std::vector shapes_min(shape_size), shapes_opt(shape_size), shapes_max(shape_size); + std::vector shapes_min(shape_size), shapes_opt(shape_size), shapes_max(shape_size); for (int j = 0; j < shape_size; j++) { - shapes_min[j] = *(trt_profiles[0]->getShapeValues(input_name.c_str(), nvinfer1::OptProfileSelector::kMIN)); - shapes_max[j] = *(trt_profiles[0]->getShapeValues(input_name.c_str(), nvinfer1::OptProfileSelector::kMAX)); - shapes_opt[j] = *(trt_profiles[0]->getShapeValues(input_name.c_str(), nvinfer1::OptProfileSelector::kOPT)); + shapes_min[j] = *(trt_profiles[0]->getShapeValuesV2(input_name.c_str(), nvinfer1::OptProfileSelector::kMIN)); + shapes_max[j] = *(trt_profiles[0]->getShapeValuesV2(input_name.c_str(), nvinfer1::OptProfileSelector::kMAX)); + shapes_opt[j] = *(trt_profiles[0]->getShapeValuesV2(input_name.c_str(), nvinfer1::OptProfileSelector::kOPT)); } - trt_profile->setShapeValues(input_name.c_str(), nvinfer1::OptProfileSelector::kMIN, &shapes_min[0], shape_size); - trt_profile->setShapeValues(input_name.c_str(), nvinfer1::OptProfileSelector::kMAX, &shapes_max[0], shape_size); - trt_profile->setShapeValues(input_name.c_str(), nvinfer1::OptProfileSelector::kOPT, &shapes_opt[0], shape_size); + trt_profile->setShapeValuesV2(input_name.c_str(), nvinfer1::OptProfileSelector::kMIN, &shapes_min[0], shape_size); + trt_profile->setShapeValuesV2(input_name.c_str(), nvinfer1::OptProfileSelector::kMAX, &shapes_max[0], shape_size); + trt_profile->setShapeValuesV2(input_name.c_str(), nvinfer1::OptProfileSelector::kOPT, &shapes_opt[0], shape_size); } else { // execution tensor nvinfer1::Dims dims_min, dims_opt, dims_max; @@ -692,15 +692,15 @@ Status ApplyProfileShapesFromInputTensorValue(std::vector shapes_min(shape_size), shapes_opt(shape_size), shapes_max(shape_size); + std::vector shapes_min(shape_size), shapes_opt(shape_size), shapes_max(shape_size); int shape_range_size = static_cast(shape_ranges_per_input.size()); if (shape_size == shape_range_size) { // If shape size matches, check/update shape range for (int j = 0; j < shape_size; ++j) { auto& shape_range = shape_ranges_per_input[j][0]; // only has one profile - shapes_min[j] = static_cast(shape_range[0]); - shapes_max[j] = static_cast(shape_range[1]); - shapes_opt[j] = static_cast(shape_range[2]); + shapes_min[j] = static_cast(shape_range[0]); + shapes_max[j] = static_cast(shape_range[1]); + shapes_opt[j] = static_cast(shape_range[2]); const auto& tensor_shape_value = values[j]; // Update shape range lower bound @@ -734,9 +734,9 @@ Status ApplyProfileShapesFromInputTensorValue(std::vectorsetShapeValues(input_name.c_str(), nvinfer1::OptProfileSelector::kMIN, &shapes_min[0], shape_size); - trt_profile->setShapeValues(input_name.c_str(), nvinfer1::OptProfileSelector::kMAX, &shapes_max[0], shape_size); - trt_profile->setShapeValues(input_name.c_str(), nvinfer1::OptProfileSelector::kOPT, &shapes_opt[0], shape_size); + trt_profile->setShapeValuesV2(input_name.c_str(), nvinfer1::OptProfileSelector::kMIN, &shapes_min[0], shape_size); + trt_profile->setShapeValuesV2(input_name.c_str(), nvinfer1::OptProfileSelector::kMAX, &shapes_max[0], shape_size); + trt_profile->setShapeValuesV2(input_name.c_str(), nvinfer1::OptProfileSelector::kOPT, &shapes_opt[0], shape_size); } else { // Execution tensor nvinfer1::Dims dims_min(dims), dims_opt(dims), dims_max(dims); for (int j = 0, end = nb_dims; j < end; ++j) {