From 08e22bf09902fcb3d883650a1882551ede6f950c Mon Sep 17 00:00:00 2001 From: Chi Lo Date: Wed, 22 Jan 2025 23:17:43 +0000 Subject: [PATCH] lintrunner -a --- .../providers/tensorrt/tensorrt_execution_provider.cc | 11 +++++------ .../providers/tensorrt/tensorrt_execution_provider.h | 2 +- .../tensorrt/tensorrt_execution_provider_helper.cc | 6 +++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc b/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc index 49bd0f2dea..f62ee7ab78 100644 --- a/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc +++ b/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc @@ -2481,7 +2481,7 @@ TensorrtExecutionProvider::GetCapability(const GraphViewer& graph, std::vector nodes_vector(number_of_ort_nodes); std::iota(std::begin(nodes_vector), std::end(nodes_vector), 0); - std::set exclude_ops_set; // currently not support to exclude ops + std::set exclude_ops_set; // currently not support to exclude ops /* * There is a known performance issue with the DDS ops (NonMaxSuppression, NonZero and RoiAlign) when running TRT EP with TRT 10. @@ -2668,10 +2668,10 @@ TensorrtExecutionProvider::GetCapability(const GraphViewer& graph, } } - #if NV_TENSORRT_MAJOR >= 10 +#if NV_TENSORRT_MAJOR >= 10 // TRT EP will take appropriate actions later to prevent performance degradation if the graph has DDS op that run by TRT 10. is_dds_op_in_graph_ = IsDDSOpInSubGraph(graph, result, dds_op_set_); - #endif +#endif const size_t number_of_subgraphs = supported_nodes_vector.size(); if (number_of_trt_nodes == 0) { @@ -2773,8 +2773,7 @@ common::Status TensorrtExecutionProvider::RefitEngine(std::string onnx_model_fil common::Status TensorrtExecutionProvider::Compile(const std::vector& fused_nodes_and_graphs, std::vector& node_compute_funcs) { - - #if NV_TENSORRT_MAJOR >= 10 +#if NV_TENSORRT_MAJOR >= 10 // There is a known performance issue with the DDS ops (NonMaxSuppression, NonZero and RoiAlign) when running TRT EP with TRT 10. // The issue arises because when cudaStreamSynchronize is called after inference, GPU memory is released back to the OS. // As a result, for the next inference run, TRT reallocates GPU memory from the OS, introducing overhead and leading to performance degradation. @@ -2784,7 +2783,7 @@ common::Status TensorrtExecutionProvider::Compile(const std::vectorsetGpuAllocator(trt_gpu_allocator_.get()); } #endif - + for (auto& fused_node_graph : fused_nodes_and_graphs) { const GraphViewer& graph_body_viewer = fused_node_graph.filtered_graph; const Node& fused_node = fused_node_graph.fused_node; diff --git a/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.h b/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.h index 27b6971c3f..5bf1bc35e9 100644 --- a/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.h +++ b/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.h @@ -641,7 +641,7 @@ class TensorrtExecutionProvider : public IExecutionProvider { /** * Check if DDS op is in the ComputeCapability/subgraph. - */ + */ bool IsDDSOpInSubGraph(const GraphViewer& graph, std::vector>& compute_capabilities, std::unordered_set& dds_op_set) const; diff --git a/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider_helper.cc b/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider_helper.cc index 24c6d44ef1..104594ce4d 100644 --- a/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider_helper.cc +++ b/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider_helper.cc @@ -261,13 +261,13 @@ void TensorrtExecutionProvider::SetAllGraphInputs(Graph& graph) const { // Check if DDS op is in the ComputeCapability/subgraph. bool TensorrtExecutionProvider::IsDDSOpInSubGraph(const GraphViewer& graph, - std::vector>& compute_capabilities, - std::unordered_set& dds_op_set) const { + std::vector>& compute_capabilities, + std::unordered_set& dds_op_set) const { auto is_dds_op = [&](const auto& node) { if (dds_op_set.find(node->OpType()) != dds_op_set.end()) return true; return false; }; - + for (auto& compute_capability : compute_capabilities) { auto& indexed_sub_graph = compute_capability->SubGraph(); for (auto i : indexed_sub_graph->Nodes()) {