-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Handle compiler warnings for TRT EP #9956
Conversation
onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc
Outdated
Show resolved
Hide resolved
onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc
Outdated
Show resolved
Hide resolved
onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc
Outdated
Show resolved
Hide resolved
@@ -1104,7 +1105,7 @@ TensorrtExecutionProvider::GetCapability(const GraphViewer& graph, | |||
|
|||
// Remove subgraphs if its size is less than the predefined minimal size | |||
for (auto it = supported_nodes_vector.begin(); it != supported_nodes_vector.end(); ++it) { | |||
const int subgraph_size = it->first.size(); | |||
const int subgraph_size = static_cast<int>(it->first.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought about changing from "const int subgraph_size" to "const size_t subgraph_size". Which means the type of min_subgraph_size_ should be changed to size_t as well. However, min_subgraph_size_ is one of C APIs, it's better not to modify it.
@@ -1432,8 +1433,8 @@ common::Status TensorrtExecutionProvider::Compile(const std::vector<Node*>& fuse | |||
auto trt_context = trt_state->context->get(); | |||
auto trt_profile = &(trt_state->trt_profile); | |||
auto alloc = trt_state->scratch_allocator; | |||
int num_inputs = input_indexes.size(); | |||
int num_outputs = output_indexes.size(); | |||
int num_inputs = static_cast<int>(input_indexes.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we change to "size_t num_inputs", we will need to add "static_cast<int32_t>(i)" to "auto input = trt_state->network->get()->getInput(i);" at line 1510.
So don't change this part and also it's not highly possible number of inputs is large enough to overflow 'int' type.
Modify code for removing compiler warning of C4244, C4267 and C4996 of TRT EP in order to comply with Service 360 security rules.
Here is the issue from BinSkim: https://msdata.visualstudio.com/DefaultCollection/Vienna/_workitems/edit/1523090/