Inconsistent behaviour of plugin enqueue method when inputs has empty shapes(i.e. 0 on batch dimension)
@samurdhikaru is already working on this.
Since Mar 31, 2023.
- Dominant language
- C++
- Stars
- 13.4k
- Forks
- 2.4k
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 2
Description
Description
i got a onnx model(maskrcnn) and converted it into trt engine by using trtexec, there are 2 custom ops in onnx model, so i implemented 2 corresponding plugins in tensorrt, one is NMSRotatedPlugin and another is ROIAlignRotatedPlugin. when testing inference on the converted trt engine, i found that when inputs has empty shapes, the inputs/outputs parameters of enqueue method of these 2 plugins are given differently by tensorrt.
As for ROIAlignRotatedPlugin, it has 2 inputs and 1 output, when the 1st dimension of the 2nd input is 0(which means no rois), the output should be empty(0 in the 1st dim). the inputs/outputs parameter are non-null pointer and the "checked the 0 condition and return" logic works fine, as show in the following picture

As for NMSRotatedPlugin, it has 3 inputs and 2 outputs, when the 1st dim of the first 2 inputs are 0(which means no bbox were found), the 1st output should also be empty(0 in the 1st dim). but this time the inputs/outputs parameter are given null pointers, and after "checked the 0 condition and return" logic, tensorrt throws out "illegal memory access" error, as show in followig pictures:

I think the illegal memory access is related to the null-pointers and i don't know why the parameter passing behaviour are different(i.e. one gets non-null pointers and the other get null) on these 2 plugins.
Environment
TensorRT Version: 8.6.0
GPU Type: RTX 3090
Nvidia Driver Version: 470.129.06
CUDA Version: 11.4
CUDNN Version: 8.8.0
Operating System + Version: Ubuntu 20.04.4 LTS
Python Version (if applicable): 3.8
TensorFlow Version (if applicable): none
PyTorch Version (if applicable): 1.9
Baremetal or Container (if container which image + tag): container
Relevant Files
Steps To Reproduce
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.