[runtime] Only enable _Float16 when the compiler supports it#9189
Open
pkubaj wants to merge 1 commit into
Open
[runtime] Only enable _Float16 when the compiler supports it#9189pkubaj wants to merge 1 commit into
pkubaj wants to merge 1 commit into
Conversation
The clang branch of the HALIDE_CPP_COMPILER_HAS_FLOAT16 detection enables _Float16 whenever `_Float16` is a reserved keyword (detected via __is_identifier). However, clang reserves the keyword on *all* targets since clang 8 while only actually *supporting* the type on some. On a target where clang reserves but does not support _Float16 (e.g. PowerPC) the check is a false positive and the build fails with "error: _Float16 is not supported on this target". clang (and gcc) only predefine the __FLT16_* limit macros when the target actually supports _Float16, so additionally require defined(__FLT16_MANT_DIG__). This is the compiler-independent "better way to detect if the type is supported" the adjacent comment asks for, and it is a no-op on every target where _Float16 already worked.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9189 +/- ##
=======================================
Coverage ? 69.20%
=======================================
Files ? 254
Lines ? 78274
Branches ? 18729
=======================================
Hits ? 54170
Misses ? 18521
Partials ? 5583 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Member
|
Do you by chance have a Godbolt link you can share to demonstrate the macro issue (perhaps on PPC)? |
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.
The clang branch of the HALIDE_CPP_COMPILER_HAS_FLOAT16 detection enables _Float16 whenever
_Float16is a reserved keyword (detected via __is_identifier). However, clang reserves the keyword on all targets since clang 8 while only actually supporting the type on some. On a target where clang reserves but does not support _Float16 (e.g. PowerPC) the check is a false positive and the build fails with "error: _Float16 is not supported on this target".clang (and gcc) only predefine the _FLT16* limit macros when the target actually supports _Float16, so additionally require defined(FLT16_MANT_DIG). This is the compiler-independent "better way to detect if the type is supported" the adjacent comment asks for, and it is a no-op on every target where _Float16 already worked.
Checklist