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
[Codegen][GenericVectorization] Fix incorrect usage of std::accumulation that led to overflow (iree-org#21920)
The `std::accumulation` for checking if the vector exceeds size limit
uses literal integer '1' as the initial value, which effectively makes
the entire calculation to use int32_t (on most platforms) as the
accumulator data type.
This might lead to sign overflow when one of the dimension sizes is
between 32 bits and 64 bits, and bypass the check.
------
This issue was originally observed with tensor with dynamic shape like
`<1x8x?xf32>`, in which case the ValueBoundConstraintSet somehow think
the upper bound for this was enormously large, hence overflowing the
check fixed in this PR. One might argue that something went wrong in
ValueBoundConstraintSet which I kind of agree. Nevertheless, the
`std::multiplies<int64_t>()` used in `std::accumulate` in this case
hints that we _do_ want to use int64_t as the accumulator type. So we
should fix this issue anyway.
Signed-off-by: Min Hsu <[email protected]>
0 commit comments