Skip to content

ActivationOpNoInfTest.Softsign fails on x86_64 (AVX/AVX2) due to reciprocal underflow in Eigen #27923

@mudream4869

Description

@mudream4869

Describe the issue

We observed a numerical discrepancy in the Softsign operator when using AVX/AVX2 vectorized paths in recent versions (v1.21+). For extreme input values (e.g., FLT_MAX), the output underflows to 0.0 instead of saturating to ~1.0.

This behavior currently causes the bundled ActivationOpNoInfTest.Softsign to fail on x86_64 platforms.

To reproduce

Build:

./build.sh --config RelWithDebInfo --build_shared_lib --parallel --compile_no_warning_as_error --skip_submodule_sync --cmake_extra_defines onnxruntime_USE_AVX=ON

Unittest Output

[ RUN      ] ActivationOpNoInfTest.Softsign
.../onnxruntime-1.24.4/onnxruntime/test/unittest_util/checkers.cc:471: Failure
The difference between cur_expected[i] and cur_actual[i] is 1, which exceeds tolerance, where
cur_expected[i] evaluates to 1,
cur_actual[i] evaluates to 0, and
tolerance evaluates to 0.00010999999358318746.
i:6
Google Test trace:
.../onnxruntime-1.24.4/onnxruntime/test/unittest_util/checkers.cc:649: provider type: CPUExecutionProvider
.../onnxruntime-1.24.4/onnxruntime/test/unittest_util/base_tester.cc:898: registered execution providers: CPUExecutionProvider

.../onnxruntime-1.24.4/onnxruntime/test/unittest_util/checkers.cc:471: Failure
The difference between cur_expected[i] and cur_actual[i] is 1, which exceeds tolerance, where
cur_expected[i] evaluates to -1,
cur_actual[i] evaluates to -0, and
tolerance evaluates to 0.00010999999358318746.
i:7
Google Test trace:
.../onnxruntime-1.24.4/onnxruntime/test/unittest_util/checkers.cc:649: provider type: CPUExecutionProvider
.../onnxruntime-1.24.4/onnxruntime/test/unittest_util/base_tester.cc:898: registered execution providers: CPUExecutionProvider

[  FAILED  ] ActivationOpNoInfTest.Softsign (1 ms)

Urgency

No response

Platform

Linux

OS Version

24.04

ONNX Runtime Installation

Built from Source

ONNX Runtime Version or Commit ID

v1.21 ~ v1.24.4

ONNX Runtime API

C++

Architecture

X64

Execution Provider

Default CPU

Execution Provider Library Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions