Convert onnx to engine failed by using trtexec, stack overflow;

Description

I am trying to convert the onnx format of a model to engine format, which is a simplified model using the ‘onnxsim’ tool.
This ONNX format model, before being simplified using ONNXSIM, both static input size and dynamic input size models will report errors.
After simplification using onnxsim, static input size onnx models can be converted to engine format normally;

For the onnx exported from dynamic axes (also simplified by the onnxsim tool), export the engine and use trtexec to convert the onnx. In the console, no abnormal information is output and the conversion is stopped.

I opened the trtexec project using visual studio 2022 and set the input parameters for the conversion of trtexec. When I ran the trtexec project, I received the following error:

Unhandled exception at 0x00007FF8DC59B27B (ntdll.dll) in trtexec.exe: 0xC00000FD: Stack overflow (parameters: 0x0000000000000001, 0x00000040BE513FD4).

The trtexec project converts this Onnx model, and the call stack in visual studio is as follows:

ntdll.dll!00007ff8dc59b27b()	Unknown
nvinfer.dll!00007ffff29fc984()	Unknown
nvinfer.dll!00007ffff0ac6f17()	Unknown
nvinfer.dll!00007fffef5bd36f()	Unknown
nvinfer.dll!00007fffef94037e()	Unknown
nvinfer.dll!00007fffefd8b438()	Unknown
nvinfer.dll!00007fffefd8b47f()	Unknown
nvinfer.dll!00007fffefd8b47f()	Unknown
...                                                                         # repeat `nvinfer.dll!00007fffefd8b47f()	Unknown` 2398 times;
nvinfer.dll!00007fffefd8b47f()	Unknown
nvinfer.dll!00007fffefd8b47f()	Unknown
nvinfer.dll!00007fffefd8cf5a()	Unknown
nvinfer.dll!00007fffefd8d832()	Unknown
nvinfer.dll!00007fffefbb5792()	Unknown
nvinfer.dll!00007fffefb6b4bf()	Unknown
nvinfer.dll!00007fffefb6b9db()	Unknown
>	trtexec.exe!nvinfer1::IBuilder::buildSerializedNetwork(nvinfer1::INetworkDefinition & network, nvinfer1::IBuilderConfig & config) Line 10181	C++
trtexec.exe!sample::networkToSerializedEngine(const sample::BuildOptions & build, const sample::SystemOptions & sys, nvinfer1::IBuilder & builder, sample::BuildEnvironment & env, std::basic_ostream<char,std::char_traits<char>> & err) Line 1206	C++
trtexec.exe!sample::modelToBuildEnv(const sample::ModelOptions & model, const sample::BuildOptions & build, sample::SystemOptions & sys, sample::BuildEnvironment & env, std::basic_ostream<char,std::char_traits<char>> & err) Line 1278	C++
trtexec.exe!sample::getEngineBuildEnv(const sample::ModelOptions & model, const sample::BuildOptions & build, sample::SystemOptions & sys, sample::BuildEnvironment & env, std::basic_ostream<char,std::char_traits<char>> & err) Line 1402	C++
trtexec.exe!main(int argc, char * * argv) Line 404	C++
[External Code]	

Environment

TensorRT Version: 8.6.1
GPU Type: NVIDIA GeForce GTX 1650
Nvidia Driver Version: 536.23
CUDA Version: 11.8
CUDNN Version: v8.9.4
Operating System + Version: windows 10
Python Version (if applicable): 3.8
TensorFlow Version (if applicable):
PyTorch Version (if applicable): 1.13.1+cu116
Baremetal or Container (if container which image + tag):

Relevant Files

Here is the onnx model I used.
“md_coco_model_240419_v01.onnx”,It is the original model exported from pytorch. Its official warehouse is https://github.com/IDEA-Research/MaskDINO

“md_coco_model_240419_v01_onnx_sim.onnx”。It is a simplified model after onnxsim。

Steps To Reproduce

1 md_coco_model_240419_v01.onnx is the original model exported from pytorch. Its official warehouse is https://github.com/IDEA-Research/MaskDINO
2 md_coco_model_240419_v01_onnx_sim.onnx。It is a simplified model after onnxsim, and its simplification command is as follows:

Simplify the ONNX format model using onnxsim:

onnxsim md_coco_model_240419_v01.onnx md_coco_model_240419_v01_onnx_sim.onnx

When using trtexec to export the engine, the conversion command is as follows:

trtexec --onnx=md_coco_model_240419_v01_onnx_sim.onnx --explicitBatch --minShapes=input:1x3x800x1280 --optShapes=input:2x3x800x1280 --maxShapes=input:2x3x800x1280 --shapes=input:2x3x800x1280 --workspace=4096 --buildOnly --saveEngine=md_coco_model_240419_v01_onnx_sim.engine --verbose 

When using the visual studio project of trtexec, running and exporting this model, the call stack information and exception information shown in Description.

Personal attempts

In visual studio, increasing the stack reserved size does not work.
When running this conversion command on another machine containing T1000 (8GB memory), the same error will be reported.

How to locate and solve this conversion problem?