Repository navigation
Copybara import of the project: - #11719
Merged
Merged
Conversation
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
Bot
force-pushed
the
test_1001395747
branch
from
October 18, 2026 22:45
bfbec6d to
c7c8a48
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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