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
Add CMake option to enable saturation checker for ConvSymKernelAvx2 (microsoft#24220)
### Description
<!-- Describe your changes. -->
This PR adds a new CMake option:
onnxruntime_ENABLE_CONVSYMKERNELAVX2_SAT_CHECKER. When enabled, this
option activates a saturation checker for the VPMADDUBSW instruction
used in the ConvSymKernelAvx2 path.
The checker works by calling a helper function before each VPMADDUBSW
instruction. This function simulates the computation using C++ and
intrinsics with higher-precision types (int32_t) to detect whether the
result exceeds the bounds of int16_t (i.e., greater than INT16_MAX or
less than INT16_MIN).
By default, the checker logs a warning only once per inference session.
However, the logic can be easily extended to print more frequently if
needed. Developers can also reuse this pattern to implement similar
saturation checks for other instructions.
### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
On some models running with AVX2 (instead of AVX-VNNI), we've observed
accuracy degradation due to saturation in vectorized instructions. This
saturation checker provides a way to debug and detect those cases by
reporting potential overflow in intermediate computations.
0 commit comments