Polygraphy INT32 comparison can overflow and falsely pass at zero tolerance
维护者通常 6 天内回复
评估
调研方向
issue 提到了 Polygraphy 的 SimpleCompareFunc,并提供了仅使用 CPU 的复现步骤;请找到它的实现和现有的 comparator 测试。先以零容差运行复现步骤,然后为 INT32_MIN 与零的比较以及 INT32_MAX 与 INT32_MIN 的比较添加边界用例。当两项比较都以预期的非负差值失败,且相关测试通过时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
Description
Polygraphy's simple comparator subtracts INT32 arrays in INT32, so differences can overflow before the absolute value is computed. In particular, the absolute value of the minimum INT32 remains negative and an incorrect output can be reported as matching even with zero tolerances.
Reproduction
On main at 16ed0636df41e4a27d46f82d9028fc50fadc7200:
import numpy as np
from polygraphy.comparator import IterationResult, SimpleCompareFunc
a = IterationResult(outputs={"out": np.array([-2147483648], dtype=np.int32)})
b = IterationResult(outputs={"out": np.array([0], dtype=np.int32)})
result = SimpleCompareFunc(rtol=0, atol=0)(a, b)["out"]
print(bool(result), result.max_absdiff) # actual: True, -2147483648.0
The comparison should fail, with a nonnegative absolute difference of 2147483648. A second boundary pair, INT32_MAX versus INT32_MIN, should produce a difference of 4294967295 without wrapping. Reproduced on CPU using NumPy 2.5.4; no TensorRT engine or GPU is required.
- 主要语言
- 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 天内回复
-
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 天内回复
-
onnx_graphsurgeon: Constant with float8_e4m3fnuz values is exported as FLOAT8E4M3FN可能已有人在做 @luicarus 于 60 天前认领。 未关闭Module:GraphSurgeon
难度 1/5 1 小时以内 新手友好度 92/100
维护者通常 6 天内回复
相似的 Issue
-
难度 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 条评论 ·
-
Feature request
难度 2/5 1-3 小时 新手友好度 65/100
qbittorrent/qBittorrent#25338 ·
维护者通常 2 天内回复
-
Needs: Attention Needs: Version Info Platform: Android Platform: tvOS
难度 2/5 1-3 小时 新手友好度 72/100
react/react-native#60180 · 3 条评论 ·
维护者通常 2 天内回复