You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] [Relax][TOPI] Max and min reductions replace infinities with finite extrema #20935
The maximum of a nonempty all-negative-infinity tensor is -inf; the minimum of an all-positive-infinity tensor is +inf. ONNX ReferenceEvaluator agrees.
Actual behavior
On LLVM CPU, ReduceMax([-inf,-inf,-inf]) returns -3.4028234663852886e38 and ReduceMin([inf,inf,inf]) returns +3.4028234663852886e38. Finite-value controls return 7 correctly. This concerns nonempty infinity-only inputs, separately from CUDA NaN propagation in #19518 and ArgMin indices in #20866.
Environment
TVM 0.28.dev0, LLVM 18.1.3, Linux x86_64; Python 3.12.3, NumPy 2.5.4, ONNX 1.22.0. Installed binary build revision is unknown. Current main was inspected statically, not rebuilt.
I had a working patch for this locally and just opened #20983. It uses -inf / +inf as the float16/32/64 max/min identities, keeps the finite extrema for bfloat16, float8 and integer types, and also updates the reducer registry used by rfactor and cross-thread reduction. Numeric tests cover TE and ONNX ReduceMax/ReduceMin.
I saw your earlier note asking to work on this. If you are actively working on it, let me know and we can consolidate; I am happy to review your patch or hand this over instead of keeping a competing PR.
Activity
GoyalIshaan commentedon Nov 9, 2026
Could I work on the max/min reduction identities here, with LLVM CPU regression tests for all-infinite inputs and finite controls?
This request was generated and posted by an AI assistant on my behalf; I would do the implementation and submit the PR myself.
YidaWeng commentedon Nov 15, 2026
I had a working patch for this locally and just opened #20983. It uses
-inf/+infas the float16/32/64 max/min identities, keeps the finite extrema for bfloat16, float8 and integer types, and also updates the reducer registry used byrfactorand cross-thread reduction. Numeric tests cover TE and ONNX ReduceMax/ReduceMin.I saw your earlier note asking to work on this. If you are actively working on it, let me know and we can consolidate; I am happy to review your patch or hand this over instead of keeping a competing PR.