Description
There seems to be a bug where a model crashes if launched with a different shape than the one provided in the opt field of the optimization profile. It is a stereo vision model whose inputs are three images, two in color and one in grayscale. When compiled with the following optimization profile:
SetTrtProfileMinShapes("img1:1x3x512x512,img2:1x3x512x512,disp_init:1x512x512");
SetTrtProfileOptShapes("img1:1x3x1024x896,img2:1x3x1024x896,disp_init:1x1024x896");
SetTrtProfileMaxShapes("img1:1x3x2048x2048,img2:1x3x2048x2048,disp_init:1x2048x2048");
And run with images of shape 1024x768 it crashes with error:
Non-zero status code returned while running TRTKernel_graph_main_graph_7509437748431248464_0 node. Name:'TensorrtExecutionProvider_TRTKernel_graph_main_graph_7509437748431248464_0_0' Status Message: TensorRT EP execution context enqueue failed.
On the other hand, if it is compiled with:
SetTrtProfileMinShapes("img1:1x3x512x512,img2:1x3x512x512,disp_init:1x512x512");
SetTrtProfileOptShapes("img1:1x3x1024x768,img2:1x3x1024x768,disp_init:1x1024x768");
SetTrtProfileMaxShapes("img1:1x3x2048x2048,img2:1x3x2048x2048,disp_init:1x2048x2048");
It now crashes when run with images of shape 1024x896. This does not make sense. 768 and 896 are both between the minimum and the maximum, why do I need to specify the exact value in the opt field? Even if I set a higher value to the width like 1024 it crashes. It needs to be the exact value that is used later.
What’s even more confusing is that it only crashes on Blackwell GPUs. The same code, model and data does not crash in a A5000 for this scenario. However, in 5080 and 5060 Ti it crashes. If there is something else we need to configure, please let us know. We just want to have real dynamic shapes without crashing. If it causes a recompilation is fine, but a crash is inadmissible.
Environment
TensorRT Version: 10.13.0.35
GPU Type: Blackwell Series 50
Nvidia Driver Version: 595.97
CUDA Version: 12.4
CUDNN Version: 8.9.7
Operating System + Version: Windows 10 / 11
ONNXRuntime: 1.18.0
Relevant Files
Model onnx file:
Steps To Reproduce
The full codebase is very convoluted so I won’t share it. The idea is to load the model using onnxruntime in C++ with TensorRT backend. For the images you can just create zero images of the specified shapes and the crash will happen too, it is independent of the data. If you cannot reproduce, then that counts as a solution so please just provide the script to not reproduce so that we can compare on our side and apply the changes to make it work.