Skip to content

Copybara import of the project: - #11719

Merged
copybara-service[bot] merged 2 commits into
masterfrom
test_1001395747
Oct 18, 2026
Merged

copybara-service[bot] merged 2 commits into
masterfrom
test_1001395747

Conversation

@copybara-service

Copy link
Copy Markdown
Contributor

Copybara import of the project:

--
58760a2 by Cameron Beeley cameron.beeley@gmail.com:

Fix ambiguous std::isnan call on xnn_float16 in vbinary tester

Where the compiler and CPU support it, src/xnnpack/math.h defines
xnn_float16 as the native _Float16 type (XNN_HAVE_FLOAT16, e.g. x86_64
with F16C and clang >= 15 or GCC >= 12). std::isnan has no _Float16
overload, so the implicit conversions to float, double and long double
are all equally good candidates and overload resolution is ambiguous:

test/vbinary-microkernel-tester.cc:66:11: error: call to 'isnan' is ambiguous
if (std::isnan(y_ref[i])) {

Minimal reproduction under libstdc++ 15:
_Float16 x = 1.0f; std::isnan(x); // error: ambiguous
_Float16 x = 1.0f; std::isnan(float(x)); // compiles

This is the only compile error in a 797-target x86_64 build, so it
blocked every test that links vbinary-microkernel-tester. Cast to
float, matching how the surrounding lines already use
static_cast(y_ref[i]).

Does not affect ARM64, where xnn_float16 is a struct with a single
operator float(), making the conversion unambiguous.

FUTURE_COPYBARA_INTEGRATE_REVIEW=#11545 from anagnorisis2peripeteia:fix-f16-isnan-overload-ambiguity 58760a2

anagnorisis2peripeteia and others added 2 commits October 7, 2026 16:57
Where the compiler and CPU support it, src/xnnpack/math.h defines
xnn_float16 as the native _Float16 type (XNN_HAVE_FLOAT16, e.g. x86_64
with F16C and clang >= 15 or GCC >= 12). std::isnan has no _Float16
overload, so the implicit conversions to float, double and long double
are all equally good candidates and overload resolution is ambiguous:

  test/vbinary-microkernel-tester.cc:66:11: error: call to 'isnan' is ambiguous
      if (std::isnan(y_ref[i])) {

Minimal reproduction under libstdc++ 15:
  _Float16 x = 1.0f; std::isnan(x);       // error: ambiguous
  _Float16 x = 1.0f; std::isnan(float(x)); // compiles

This is the only compile error in a 797-target x86_64 build, so it
blocked every test that links vbinary-microkernel-tester. Cast to
float, matching how the surrounding lines already use
static_cast<float>(y_ref[i]).

Does not affect ARM64, where xnn_float16 is a struct with a single
operator float(), making the conversion unambiguous.
…verload-ambiguity

PiperOrigin-RevId: 1001960780
@copybara-service
copybara-service Bot merged commit c7c8a48 into master Oct 18, 2026
26 checks passed
@copybara-service
copybara-service Bot deleted the test_1001395747 branch October 18, 2026 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants