Possible incorrect INT8 Q/DQ depthwise Conv + Concat output in TensorRT 11.3 on RTX 5060

Đang mở
#4,907 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 6 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
8/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp, python, pytorch
Lĩnh vực
ai-infra-agents

Hướng nghiên cứu

The issue is a suspected INT8 Q/DQ layout or stride bug in the TensorRT 11.3 optimized path, reproduced by the attached repro.onnx, input.npz, reproduce.py and inspector JSON files. Start by running reproduce.py at opt level 0 and 3 to confirm the RMSE gap, then compare the depthwise Conv output strides in inspector_trt11.json against inspector_trt10.json. Done would mean a root cause isolated to a writer, reader or metadata component, which requires engine internals rather than a simple edit.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Module:Accuracy Module:Quantization

Description

I observed a large output mismatch between TensorRT 11.3.0.99 and ONNX Runtime for a reduced INT8 Q/DQ convolution graph on an RTX 5060 under WSL2. TensorRT 10.13.3.9 produces output much closer to ONNX Runtime on the same GPU and input.
The attached repro is a 48-node, fully synthetic model. All model weights and the input are generated from fixed random seeds; it contains no pretrained weights or images. The model has FP32 input and output, explicit INT8 Q/DQ, and approximately this structure:

input [1,128,160,160]
-> INT8 Q/DQ -> depthwise Conv (groups=128, stride=2)
-> six ordinary Conv + ReLU stages, with intermediate branches
-> Concat (128 + 6*96 = 704 channels)
-> INT8 Q/DQ -> 1x1 Conv + ReLU
-> output [1,256,80,80]
With ONNX Runtime CPU as the reference, I obtain:
Backend :TensorRT 11.3.0.99 Builder optimization level:0 Relative RMSE:0.916985 Cosine similarity:0.402695
Relative RMSE is sqrt(mean((TRT - ORT)^2)) / sqrt(mean(ORT^2)). All outputs were finite. The comparison uses a single fixed synthetic input, not model accuracy or mAP. Both TensorRT versions were tested in separate Python environments; their binary dependencies can differ.
I also tested ONNX Runtime CUDAExecutionProvider; profiling showed 40 CUDA node events. Its output differs from ORT CPU by relative RMSE 0.0563 and maximum absolute error 0.0296; I have not separately investigated that difference. Relative to the ORT CUDA result, TensorRT 11.3 level 0 still has relative RMSE 0.9170, while TensorRT 10 has 0.0563. The attached reproduction script uses ORT CPU so that the CUDA execution provider is not required.

Environment

TensorRT Version: 11.3.0.99 (tensorrt_cu13); comparison: 10.13.3.9 (tensorrt_cu13)
NVIDIA GPU: GeForce RTX 5060, compute capability 12.0
NVIDIA Driver Version: WSL nvidia-smi reports KMD 610.62, NVIDIA-SMI 610.43.02, CUDA UMD 13.3
CUDA Version: nvcc reports toolkit 13.4.92; PyTorch reports build CUDA 13.2; installed Python CUDA runtime package is 13.2.75
CUDNN Version: PyTorch reports 9.26.0; installed packages include nvidia-cudnn-cu12==9.26.0.51 and nvidia-cudnn-cu13==9.24.0.43. The exact cuDNN dependency, if any, used by this engine has not been determined.
Operating System: Ubuntu 22.04.5 LTS under WSL2, kernel 6.18.33.2-microsoft-standard-WSL2, x86_64
Python Version: 3.10.21
PyTorch Version: 2.14.0+cu132
ONNX / ONNX Runtime / NumPy: 1.21.0 / 1.22.0 / 2.2.6; ORT reference uses CPUExecutionProvider
Baremetal or Container: WSL2, no container
Builder settings: strongly typed, 512 MiB workspace, TF32 enabled by default, optimization levels 0 and 3 as shown above. Engine input/output are LINEAR FP32.
The driver/toolkit mix may be relevant. The CUDA 13.4 release notes list R615 as the corresponding driver branch, while CUDA 13.x minor-version compatibility permits older R580+ drivers with feature limitations. I have not tested an R615 driver or native Linux and would appreciate confirmation that this environment is supported.

Relevant Files

Attached: trt11_int8_qdq_repro.zip.

  • repro.onnx and input.npz: fixed synthetic model and input.
  • generate_repro.py: generates the model and input independently.
  • reproduce.py: builds and runs TensorRT and compares against ORT CPU.
  • trace_unfused.py and analyze_layout.py: optional intermediate-tensor investigation.
  • inspector_trt10.json, inspector_trt11.json, and results_*.json: captured layer information and results.

Steps To Reproduce

In a Python environment with NumPy, ONNX Runtime CPU, CUDA-enabled PyTorch, and TensorRT 11.3.0.99:
`unzip trt11_int8_qdq_repro.zip
cd trt11_int8_qdq_repro

python reproduce.py --model repro.onnx --input input.npz
--expected-version 11.3.0.99 --opt-level 0 --output result_11.npz
On the reporting machine this avoids the large error for the reduced graph:
python reproduce.py --model repro.onnx --input input.npz
--expected-version 11.3.0.99 --opt-level 3 --output result_11_opt3.npzIn a separate Python environment with TensorRT 10.13.3.9, using the same supplied model and input:python reproduce.py --model repro.onnx --input input.npz
--expected-version 10.13.3.9 --opt-level 0 --output result_10.npz`

Each run prints the loaded versions, hashes and metrics and saves ORT and TensorRT output tensors. README.md also documents an optional unfused-tensor trace and how to regenerate the synthetic model and input.
Have you tried the latest release? No. I have not yet tested TensorRT 11.4.1, a newer driver, or native Linux.
Can this model run on other frameworks? Yes. ONNX Runtime 1.22.0 CPUExecutionProvider runs it; TensorRT 10.13.3.9 with the settings above is close to that output.

Additional investigation

The TensorRT 11.3 level-0 Engine Inspector reports the depthwise Conv output as an INT8 view with logical shape [1,128,80,80] and strides [4505600,1,56320,704]. TensorRT 10's engine includes separate Concat-related reformat/copy layers. A stride of 704 is valid for a properly populated 704-channel Concat buffer; the stride alone does not prove an error.
With unfused tensor debugging enabled, the final TensorRT 11.3 output is bit-identical to the non-debug engine output on this input. In the captured depthwise output, a simulation that packs the ORT-quantized 128-channel output densely in NHWC, zero-fills the remaining region, and reads using the 704-channel view reproduces the captured INT8 tensor exactly. Feeding that captured tensor into an ORT downstream subgraph yields a relative RMSE of 0.0102 against the TensorRT 11.3 output, versus 0.9170 when feeding the normal ORT tensor.
This suggests a possible layout/stride inconsistency in the optimized path, but I have not established whether the writer, reader, optimizer metadata, debug capture, driver/toolkit interaction, or another component is responsible. Could NVIDIA help confirm whether the attached case is expected to be supported and whether this is a known issue?

trt11_int8_qdq_repro.zip

Ngôn ngữ chính
C++
Star
13.5k
Fork
2.4k
Merge trung bình
6 ngày 21 giờ
Pull request đã merge (30 ngày)
3

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của NVIDIA/TensorRT

Tất cả issue của NVIDIA/TensorRT

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.