-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[libclc] Fix double NAN_MASK in __clc_nan #163522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
0x7ff0000000000000 is +inf. Change it to quiet nan 0x7ff8000000000000.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an incorrect NaN mask value for 64-bit floating point numbers in libclc. The value 0x7ff0000000000000
represents positive infinity, not NaN, and is corrected to 0x7ff8000000000000
which represents a quiet NaN.
- Corrects the NAN_MASK constant for 64-bit floating point from positive infinity to quiet NaN
…pirv_ocl_nan NAN_MASK fix is cherry-pick of llvm/llvm-project#163522 Also fix a few build warnings `'__CLC_FUNCTION' macro redefined`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should really just use __builtin_nan
done in de867d4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I looked at this before but wasn't sure about removing the payload. As you point out it still adheres to the spec so I'm fine with it.
Oh right I forgot about the weird string format for __builtin_nan. Technically you could try to find a string to map the value to |
It's probably better to go back to not using the builtin, failing a way to get the string |
0x7ff0000000000000 is +inf. Change it to quiet nan 0x7ff8000000000000.