Fix sort_test build on toolchains without native float16#3113
Open
dcsid wants to merge 1 commit into
Open
Conversation
jan-wassenberg
left a comment
Member
There was a problem hiding this comment.
Thanks :) FYI #3109 fixes the missing #if. Let's wait for that one to land, then merge.
I'm curious which compiler you're targeting? HWY_HAVE_SCALAR_F16_OPERATORS is not universal, but ought to be widely available. Perhaps we can get that to 1, or maybe we should extend the emulation of hwy::float16_t.
std::iota with T{0} requires construction from int, and -kInf requires
unary minus; the emulated hwy::float16_t provides neither. Use
ConvertScalarTo and ScalarAbs instead. Fixes google#3112.
jan-wassenberg
approved these changes
Jun 12, 2026
Contributor
Author
|
Rebased onto #3109, now just the No particular compiler, just hit it on the CI matrix. FWIW the emulated |
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.
sort_test.ccfails to build wherehwy::float16_tis emulated:std::iotawithT{0}needs construction fromint, and-kInfneeds unary minus (GCC 9–12, Clang 11–15, armv7, ppc64le, LoongArch64, Windows LLVM). Fixes #3112.ConvertScalarTo<T>, andx == kInf || x == -kInfwithScalarAbs(x) == kInf.HWY_HAVE_FLOAT16(as inCallAllSortTraits): f16GetLanedoes not compile on LSX (noted in sort_test fails to build on toolchains without native float16 (since 636d64d8) #3112).Errors reproduce under
-DHWY_HAVE_SCALAR_F16_TYPE=0and compile cleanly with the fix;sort_test --gtest_filter='*SelectWithNaN*'passes on AArch64.