[BUG] nvonnxparser: dynamic batch (-1) + constant-size Split causes uninitialized gather index during shape inference → buildSerializedNetwork returns nullptr
维护者通常 6 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- cpp
调研方向
Start by examining the nvonnxparser handling of ONNX Split nodes with constant split sizes and dynamic input dimensions, then trace the shape inference path that produces the gather index. Reproduce with the attached dynamic-batch model and compare against the static-batch model and minimal Conv model. Done means the dynamic model builds successfully or fails with a meaningful per-node error.
由索引模型根据 Issue 内容生成。
描述
Description
When parsing an ONNX model whose input has a dynamic batch dimension (-1) and whose
graph contains Split nodes with constant split sizes (opset 13, split input as
int64 initializer), IBuilder::buildSerializedNetwork() fails and returns nullptr.
The TensorRT logger reports:
[TRT-LOG Error] IBuilder::buildSerializedNetwork: Error Code 4: API Usage Error
(ISliceLayer node_of_sp_12: gather index (1630337677504) must be less than length (5) of data.)
The gather index 1630337677504 is an obviously uninitialized/garbage value (looks like
a wild pointer read), not a real dimension — this smells like a shape-inference bug where
uninitialized memory is consumed as a gather index when the Split node's split sizes are
constant but the input tensor has a dynamic batch dim.
Reproduction matrix
| Model | batch | profile | Result |
|---|---|---|---|
| 1-node Conv, input [-1,3,640,640] | dynamic | min/opt/max set | builds fine |
| Full YOLOv8s-style model (218 nodes), input [1,3,640,640] | static | none | builds fine |
| Same full model, input [-1,3,640,640] | dynamic | min/opt/max set | buildSerializedNetwork returns nullptr |
Same model runs fine in onnxruntime with dynamic batch. The Split nodes use constant
sizes ([32,32], [64,64], [128,128], [256,256] on axis=1 — standard C2f bottleneck
branch split).
Environment
- TensorRT 10.11 (also reproduced with 10.13)
- Windows 10 x64, driver 511 series, RTX 4060 Laptop GPU
- CUDA 12.3 runtime libs (also reproduced with CUDA from TRT 10.13 package)
- Parsing via C API:
nvonnxparserwith an explicit-batch network, optimization
profile min=1/opt=8/max=1000 configured before build
Minimal reproducer
Attaching yolo_dynamic.onnx (the failing model, 44MB) and tmp_min_dyn4.onnx
(1KB, minimal dynamic Conv that PASSES — showing the API usage is correct).
yolo_static1.onnx = same model with batch pinned to 1, builds fine.
Any parser invocation of the failing model with a dynamic-batch profile reproduces
the error above; no exotic flags needed (FP16 on/off, workspace size make no difference).
Expected behavior
Either build the engine, or reject the graph with a meaningful per-node error.
Reading uninitialized memory as a gather index is a parser bug.
通过网盘分享的文件:bug nvonnxparser
链接: https://pan.baidu.com/s/1wY8YsIyz6YtgmbssMNiXBw?pwd=s18n 提取码: s18n
--来自百度网盘超级会员v6的分享
- 主要语言
- C++
- 星标
- 13.5k
- 派生
- 2.4k
- 平均合并
- 6 天 21 小时
- 30 天内合并 PR
- 3
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NVIDIA/TensorRT 的其他 Issue
-
Module:Polygraphy
难度 2/5 1-3 小时 新手友好度 77/100
维护者通常 6 天内回复
-
Polygraphy NumPy Top-K sorts unsigned and minimum signed integers incorrectly可能已有人在做 @0z5a 于 16 天前认领。 未关闭Module:Polygraphy
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 6 天内回复
-
Polygraphy INT32 comparison can overflow and falsely pass at zero tolerance可能已有人在做 @0z5a 于 16 天前认领。 未关闭Module:Polygraphy
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 6 天内回复
-
onnx-graphsurgeon: Graph.toposort() hits RecursionError when a graph has a local function and an If/Loop node可能已有人在做 @gabortar 于 39 天前认领。 未关闭Module:GraphSurgeon
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 6 天内回复
-
Polygraphy parse_meta accepts a shape with a missing bracket可能已有人在做 @SashaMIT 于 51 天前认领。 未关闭Module:Polygraphy
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 6 天内回复
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 91/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 69/100
maplibre/maplibre-native#5072 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 79/100
tenstorrent/tt-umd#4017 ·
维护者通常 3 天内回复
-
difficulty:easy func:gui prio:low type:bug
难度 2/5 1-3 小时 新手友好度 72/100
NatronGitHub/Natron#1538 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
hyprwm/hyprsunset#103 · 1 条评论 ·